Skip to content

Instantly share code, notes, and snippets.

View MichaelEstes's full-sized avatar

Michael Estes MichaelEstes

View GitHub Profile
@MichaelEstes
MichaelEstes / C++ Conway's Game of Life
Last active March 25, 2022 18:45
C++ Conway's Game of Life
//Michael Estes
//Conway's Game of Life C++
#include <iostream>
#include <fstream>
using namespace std;
void enterBoard(char firstBoard[][45], int& rows, int& columns);
void fileBoard(char firstBoard[][45], int &rows, int &columns);
@MichaelEstes
MichaelEstes / C++ Connect 4 Command Line
Last active February 15, 2023 23:53
C++ Connect 4 Command Line
//Michael Estes
//Connect 4 Console C++
#include <iostream>
using namespace std;
struct playerInfo
{
char playerName[81];
char playerID;
};
@MichaelEstes
MichaelEstes / Connect 4 Command Line C#
Last active July 14, 2024 20:55
Connect 4 Command Line C#
//Michael Estes
//Connect 4 Command Line C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public struct playerInfo
@MichaelEstes
MichaelEstes / 2D Platformer in Python
Last active April 4, 2024 22:43
2D Platformer in Python
import pygame, random, sys
pygame.init()
global screen, size, background, state, mainState, jumpState
mainState = 0
jumpState = 1
slideState = 2
size = [800, 600]
black = 0, 0, 0
white = 255, 255, 255
screen = pygame.display.set_mode(size)
@MichaelEstes
MichaelEstes / SFML Shape-Circle Collision Detection
Last active August 29, 2015 14:06
AABB Collision detection between a SFML shape and circle
bool CheckCollisionShapeCircle(sf::Shape & shape, sf::CircleShape circle){
sf::Vector2f shapePoint, shapePosition, circleCenter;
float radius;
sf::FloatRect shapeBounds = shape.getLocalBounds();
int numPoints = shape.getPointCount();
shapePosition = shape.getPosition();
circleCenter = circle.getPosition();
radius = circle.getRadius();
@MichaelEstes
MichaelEstes / Graphic Vectors
Last active February 18, 2024 13:30
Geometry Vector Classes in C++ (2D & 3D, Length, Normalize, Dot Product & Cross Product(3D), angles)
//Start of Vectors.h file
#include <cmath>
#ifndef FLYNNVECTOR_H
#define FLYNNVECTOR_H
#define pi 3.14159
@MichaelEstes
MichaelEstes / Rectangle2D
Last active August 29, 2015 14:06
2D Rectangle Class in C++, includes collision detection (Header and CPP file)
#include "vector.h"
#include "circle.h"
using namespace std;
#ifndef RECTANGLE_H
#define RECTANGLE_H
class Rectangle2D{
@MichaelEstes
MichaelEstes / Ray2D
Last active August 29, 2015 14:06
2D Ray Class in C++ (unfinished)
#include "vector.h"
class Ray2D{
public:
gVector2 origin, direction, pointOnRay;
float length;
rayType type;
Ray2D() : origin(0, 0), direction(0, 0), length(0){};
Ray2D(gVector2 o, gVector2 d, float l = 0) : origin(o), direction(d), length(l){
@MichaelEstes
MichaelEstes / Linked List Duplication
Created October 16, 2014 22:38
Duplicating a linked list
node duplicateList(node* list)
{
node *currentNode = list, *newNode = nullptr, *tempNode = nullptr;
while (currentNode)
{
tempNode = new node;
tempNode->tag = currentNode->tag;
tempNode->next = currentNode->next;
tempNode->random = currentNode->random;
currentNode = currentNode->next->next;
#include <iostream>
using namespace std;
const int array_length = 2048;
struct Q{
int first;
int last;
unsigned char data[array_length];