Skip to content

Instantly share code, notes, and snippets.

View Abhilekhgautam's full-sized avatar
🎯
Focusing

Abhilekh Gautam Abhilekhgautam

🎯
Focusing
View GitHub Profile
import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Objects;
public class AWT_TicTacToe implements ActionListener {
JFrame frame = new JFrame();
JPanel titlePanel = new JPanel();
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Player{
String name, symbol;
boolean isWinner = false;
boolean myTurn = false;
import java.awt.Cursor;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.util.function.Consumer;
import java.util.regex.Pattern;
import java.awt.Color;
import javax.swing.*;
import java.lang.Math;
@Abhilekhgautam
Abhilekhgautam / blink_lcd.ino
Created February 6, 2024 09:35
Solution to Firmware Engineering Internship Assesment
const int LED_ONE = 7;
const int LED_TWO = 12;
void setup()
{
Serial.begin(9600);
pinMode(LED_ONE, OUTPUT);
pinMode(LED_TWO, OUTPUT);
bool OnUserUpdate(float fElapsedTime) override
{
Clear(olc::BLACK);
DrawSprite(fPlayerPositionX, fPlayerPositionY, sprPlayer.get());
if (GetKey(olc::Key::LEFT).bHeld) {
fPlayerPositionX = fPlayerPositionX - fPlayerVel * fElapsedTime;
}
if (GetKey(olc::Key::RIGHT).bHeld) {
fPlayerPositionX = fPlayerPositionX + fPlayerVel * fElapsedTime;
}
#define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"
struct Enemy{
float x;
float y;
bool alive;
};
struct Bullet{
#define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"
struct Enemy{
float x;
float y;
bool alive;
};
struct Bullet{
@Abhilekhgautam
Abhilekhgautam / infix_to_postfix.cpp
Last active December 4, 2021 13:26
A C++ program to convert an infix string to postfix string using stack data structure.
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
using std::string;
using std::vector;
enum operators {close = ')' , open = '(' , plus = '+' , min = '-' , mul = '*' , divide = '/', exp = '^'};
@Abhilekhgautam
Abhilekhgautam / 15_fall_5b.cpp
Last active April 14, 2021 16:01
Create a class Soccer Player with integer member jersey number , goals and assists , overload the > operator to find the greatest player on the basis of sum of total goals and assists, create an array of 11 player and necessary constructor to initialize them and find the greatest player among them.
#include<iostream>
using namespace std;
class soccerPlayer{
int jerNo,goals,assists;
public:
//constructor
soccerPlayer(int jer=0,int goal=0,int assist=0):jerNo(jer),goals(goal),assists(assist){}
bool operator >(soccerPlayer);