Skip to content

Instantly share code, notes, and snippets.

Game Of Life in Ruby
initialize function gives a few options. You can specify the dimensions
of the board, and you can specify if you want the board to wrap around
to the other side.
evolve simply iterates though the state array and uses the rules to
determine if it should change states.
randomize_game_state is in a separate function, so it can easily be
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include <math.h>
typedef struct vertex_s {
float x;
float y;
} vertex;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
char *msg = (char *)calloc(13, sizeof(char));
strcpy(msg, "Hello World!");
FILE *out = fopen("/dev/stdout", "w");
#include <stdio.h>
typedef struct simple_s {
int x;
int y;
} *simple_p, simple;
typedef struct fancy_s {
simple s;
int dx;
zrbecker@Zach-UVM:~/Documents/Programming$ cat allegro_test.c
#include <allegro5/allegro.h>
int main(int argc, char **argv)
{
al_init();
ALLEGRO_DISPLAY *display = al_create_display(800, 600);
ALLEGRO_EVENT_QUEUE *queue = al_create_event_queue();
al_install_keyboard();
#include <allegro5/allegro.h>
int main(int argc, char **argv)
{
al_init();
ALLEGRO_DISPLAY *display = al_create_display(640, 480);
ALLEGRO_EVENT_QUEUE *queue = al_create_event_queue();
al_register_event_source(queue, al_get_display_event_source(display));
//
// array.c
// GameEngine
//
// Created by Zachary Becker on 3/31/11.
// Copyright 2011 Home. All rights reserved.
//
#include "array.h"
@zrbecker
zrbecker / euler5.c
Created April 22, 2011 05:58
Euler 5
#include <stdio.h>
#include <stdlib.h>
typedef unsigned long ul;
/*
* Factors n into primes
*
* Returns a pointer to an array of
* unsigned longs. This needs to be
@zrbecker
zrbecker / euler7.c
Created April 22, 2011 06:17
Euler 7
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef unsigned long ul;
/*
* Finds the nth prime
*/
@zrbecker
zrbecker / euler8.c
Created April 22, 2011 08:47
Euler 8
#include <stdio.h>
#include <stdlib.h>
void readfile(char *file, int *buffer, int size, int *read) {
FILE *f = fopen(file, "r");
char c;
int pos;
while ( (c = getc(f)) != EOF && pos < size - 1) {
if (c >= '0' && c <= '9')