Skip to content

Instantly share code, notes, and snippets.

View jbutcher5's full-sized avatar

James Butcher jbutcher5

View GitHub Profile
@jbutcher5
jbutcher5 / rps.c
Created September 30, 2023 17:21
A rock paper scissors game with modular arithmetic
#include <stdio.h>
#include <stdlib.h>
#define MOD(x, k) ((x) % (k) + ((k))) % (k)
int main() {
int p1, p2;
puts(
"Welcome to Rock, Paper, Scissors\n"
@jbutcher5
jbutcher5 / traffic.ino
Last active March 29, 2023 12:51
A traffic light simulator for an arduino uno
typedef enum {
Pedestrian,
Traffic
} LightType;
typedef struct {
int lights[2];
int phase;
} PedestrianLights;