This file contains hidden or 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 "move.h" | |
| #include "data_types.h" | |
| #include <math.h> | |
| #define GRAVITY 0.6 | |
| #define OUTPUT_LENGTH 2 | |
| #define DIRECTION 0 | |
| #define DIR_LEFT -1 |
This file contains hidden or 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
| // Make the actual 2d array | |
| map->mask = (bool**) calloc(map->width, sizeof(bool*)); | |
| for (int i=0; i<map->width; i++) | |
| { | |
| map->mask[i] = (bool*) calloc(map->height, sizeof(bool)); | |
| } | |
| // Data is stored in the first 6 bits of every byte, and apparently bottom-right to top-left | |
| int bitmask = 0x1; | |
| char* index = end_position - 1; |
This file contains hidden or 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
| void generate_view_matrix(GLfloat *matrix, point *cam_pos, point *cam_dir) | |
| { | |
| // http://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml | |
| // f = cam_dir, up = (0|1|0) | |
| // s = normalize(f X up) | |
| // u = s X f | |
| double x = cam_dir->x, y = cam_dir->y, z = cam_dir->z; | |
| double l = sqrt(z*z + x*x); | |
| double s_x = -z/l, s_z = x/l; | |
| double u_x = -s_z*y, u_y = s_z*x - s_x*z, u_z = s_x*y; |
This file contains hidden or 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
| float *grid_vertices; | |
| int index = 0; | |
| grid_vertices = calloc(9, sizeof(float)); | |
| grid_vertices[index++] = -5.0; | |
| grid_vertices[index++] = 0.0; | |
| grid_vertices[index++] = -1.0; | |
| grid_vertices[index++] = 5.0; | |
| grid_vertices[index++] = 0.0; | |
| grid_vertices[index++] = -1.0; |
This file contains hidden or 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
| // Create a VAO | |
| GLuint gridVAO; | |
| glGenVertexArrays(1, &gridVAO); | |
| glBindVertexArray(gridVAO); | |
| // Allocate and upload the VBO data | |
| GLuint gridVBO; | |
| glGenBuffers(1, &gridVBO); | |
| glBindBuffer(GL_ARRAY_BUFFER, gridVBO); | |
| glBufferData(GL_ARRAY_BUFFER, MAP_WIDTH * MAP_HEIGHT * sizeof(float) * 3, grid_vertices, GL_STATIC_DRAW); |
This file contains hidden or 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 <limits.h> | |
| #include <stdlib.h> | |
| #include <math.h> | |
| #include <string.h> | |
| // For profiling | |
| #include <time.h> | |
| // Size of each individual image | |
| int image_width=0; |
This file contains hidden or 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
| from __future__ import division, print_function | |
| from PIL import Image | |
| import sys | |
| import math | |
| IMAGE_WIDTH = int(sys.argv[3]) | |
| IMAGE_HEIGHT = int(sys.argv[4]) | |
| # sys.argv[5] is a string marking the shift parameter, we don't need that | |
| CAMERA_DISTANCE = 20 |
This file contains hidden or 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
| from __future__ import division, print_function | |
| from scipy import stats | |
| import math | |
| x_file = open("X", "r") | |
| x_data = x_file.read().split() | |
| x_file.close() | |
| y_file = open("Y", "r") |
This file contains hidden or 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
| from __future__ import division, print_function | |
| def is_alive(x, y, board): | |
| neighbours = 0 | |
| for i in [-1, 0, 1]: | |
| for j in [-1, 0, 1]: | |
| neighbours += board[(y+j)%8][(x+i)%8] | |
| # The value of the point itself is not important, and should be removed | |
| neighbours -= board[y][x] |
This file contains hidden or 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
| package GUI; | |
| import java.awt.*; | |
| import java.awt.event.ActionEvent; | |
| import java.awt.event.FocusEvent; | |
| import java.awt.event.FocusListener; | |
| import java.awt.event.MouseEvent; | |
| import java.beans.PropertyChangeListener; | |
| import java.io.IOException; |