commit e969b1e17eca0104e8415041f4a449a28dde3d14
parent b30a5d9d32d3ef31e2e2a59c1d2960c35449d21a
Author: Wilson Gheen <wilson@wilsonrgheen.com>
Date: Sat, 17 Dec 2022 04:33:09 -0600
Remove hardcoded board
Diffstat:
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/life.c b/life.c
@@ -14,7 +14,6 @@
#define WIDTH(x) sizeof(x[0]) * 8
#define MAX_ROWS 24
-static uint64_t gosper[MAX_ROWS] = {0x0000000800000000, 0x0000001400000000, 0x0030001a18000000, 0x0028001b18000000, 0x6604001a00000000, 0x6924001400000000, 0x0604000800000000, 0x0028000000000000, 0x0030000000000000};
#define BOARD gosper
void print_board(uint64_t board[], int rows, int cols) {
@@ -106,23 +105,15 @@ size_t load_board_from_file(uint64_t **board, char *filename) {
}
int main() {
-/* uint64_t *board = BOARD;*/
uint64_t *board = 0;
char *filename = "mbytes";
const size_t rows = MAX_ROWS;
const size_t cols = sizeof board[0] * 8;
- if(!board) {
- if(load_board_from_file(&board, filename) < 1) {
- printf("FATAL: Failed to load board from file %s.\n", filename);
- return 1;
- }
- }
- else {
- size_t paddingRows = MAX_ROWS - (sizeof board / sizeof board[0]);
- if (paddingRows > 0)
- memset(board + rows, 0, paddingRows * (sizeof board[0]));
- }
+ if(load_board_from_file(&board, filename) < 1) {
+ printf("FATAL: Failed to load board from file %s.\n", filename);
+ return 1;
+ }
play(board, rows, cols);
tb_shutdown();