This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <allegro5/allegro.h> | |
#include <allegro5/allegro_primitives.h> | |
#include <math.h> | |
typedef struct vertex_s { | |
float x; | |
float y; | |
} vertex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
typedef struct simple_s { | |
int x; | |
int y; | |
} *simple_p, simple; | |
typedef struct fancy_s { | |
simple s; | |
int dx; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// array.c | |
// GameEngine | |
// | |
// Created by Zachary Becker on 3/31/11. | |
// Copyright 2011 Home. All rights reserved. | |
// | |
#include "array.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
typedef unsigned long ul; | |
/* | |
* Finds the nth prime | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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') |
OlderNewer