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
while true do | |
minstack = 0 | |
for i=1,16,1 do | |
turtle.select(i) | |
if i == 6 then | |
turtle.suck(1) | |
elseif i%4 ~= 0 and i<12 and turtle.getItemCount() <= minstack then | |
turtle.suckUp(1) | |
minstack = turtle.getItemCount() | |
end |
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
class Entity | |
{ | |
public: | |
Entity(list<Entity*>); | |
~Entity(); | |
}; | |
include/entity.h|8|error: expected ‘)’ before ‘<’ token| |
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
from __future__ import division, print_function | |
import sys, os, time, random, math, socket, string, pickle | |
import itertools | |
def parsemsg(s): | |
# Stolen from Twisted. Parses a message to it's prefix, command and arguments. | |
"""Breaks a message from an IRC server into its prefix, command, and arguments. | |
""" |
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 "main.h" | |
#include "move.h" | |
#include "find_path.h" | |
#include "load_map.h" | |
#include "generate_navmesh.h" | |
#include "navmesh.h" | |
#include "export_navmesh.h" | |
#include "data_types.h" | |
#include <stdio.h> | |
#include <stdint.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
const float vertexPositions[] = { | |
a, 0.0f, -4.0f, 1.0f, | |
-a, 0.0f, -4.0f, 1.0f, | |
0.0f, b, -4.0f, 1.0f, | |
0.0f, -b, -4.0f, 1.0f | |
}; | |
GLuint gridVBO; | |
glGenBuffers(1, &gridVBO); |
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
void generate_projection_matrix(GLfloat *matrix, double fovx, double aspect, double nearDist, double farDist) | |
{ | |
// Based on the gluPerspective implementation in java | |
double deltaDist = farDist - nearDist; | |
double cot = 1 / tan(fovx*M_PI / (2*aspect*180)); | |
// Column-major ordering, matrix[0*4 + 1] is right beneath matrix[0*4 + 0] | |
matrix[0*4 + 0] = cot / aspect; | |
matrix[0*4 + 1] = 0; | |
matrix[0*4 + 2] = 0; |
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
public static void gluPerspective(float fovy, float aspect, float zNear, float zFar) { | |
float sine, cotangent, deltaZ; | |
float radians = fovy / 2 * GLU.PI / 180; | |
deltaZ = zFar - zNear; | |
sine = (float) Math.sin(radians); | |
if ((deltaZ == 0) || (sine == 0) || (aspect == 0)) { | |
return; | |
} |
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
void export_navmesh(Navmesh *mesh, char* name) | |
{ | |
char filename[strlen(name)+strlen(".navmesh")]; | |
strcpy(filename, name); | |
strcat(filename, ".navmesh"); | |
FILE *f; | |
f = fopen(filename, "w"); | |
fwrite((const void*) &(mesh->num_rects), sizeof(int), 1, f); | |
RectLinkedList *l; |
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
char* get_commands(Navmesh *mesh, Character *character, Rect *current_rect, Rect *next_rect) | |
{ | |
char *output = calloc(sizeof(char), OUTPUT_LENGTH); | |
// If we're not inside our current/last rectangle, then we are in the air flying towards our destination, so we should just continue to do that | |
if (character->x < current_rect->bottomleft.x || character->x > current_rect->bottomright.x || character->y < current_rect->topleft.y || character->y > current_rect->bottomleft.y) | |
{ | |
// Get the equation of the parabola of our current falling (in the form y = ax^2 + bx + c) | |
double a, b, c; | |
a = GRAVITY/2; |
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
// If we're not inside our current/last rectangle, then we are in the air flying towards our destination, so we should just continue to do that | |
if (character->x < current_rect->bottomleft.x || character->x > current_rect->bottomright.x || character->y < current_rect->topleft.y || character->y > current_rect->bottomleft.y) | |
{ | |
// Get the equation of the parabola of our current falling (in the form y = ax^2 + bx + c) | |
double a, b, c; | |
a = GRAVITY/2; | |
b = sqrt(character->hs*character->hs + character->vs*character->vs) - 2*a*character->x; | |
c = character->y - a*character->x*character->x - b*character->x; | |
// Test whether we'll land within the right boundaries with the current path |