Skip to content

Instantly share code, notes, and snippets.

@kdrnic
kdrnic / 5.js
Created December 9, 2017 00:20
fs = require("fs");
inp = fs.readFileSync("input5.txt").toString();
inp = inp.split("\n").filter(lin=>lin.length).map(lin=>parseInt(lin));
inpCopy = inp.slice();
pc = 0;
steps = 0;
while(pc >= 0 && pc < inp.length){
pc += inp[pc]++;
steps++;
}
@kdrnic
kdrnic / 3.js
Created December 9, 2017 02:13
number = 289326;
odd = 1;
radius = 0;
while(odd * odd < number){
odd += 2;
radius++;
}
odd -= 2;
radius--;
x = radius;
frame = 0;
GAME_STATE_WAIT = 0;
GAME_STATE_GAMEOVER = 1;
GAME_STATE_PLAY = 2;
gameState = 0;
oldButtons = [0, 0, 0, 0];
debug = false;
render = true;
clearScreen = true;
@kdrnic
kdrnic / 1.js
Last active January 7, 2018 08:54
/*
Motivation: Explore ways of programming enemies and other game entities with complex behavior
Description: This enemy has both a human and werewolf forms.
It spends only a certain time in each, and then transforms into the other.
The werewolf form runs to the player and attacks him, the human form walks around randomly and peacefully, with periods of sitting still.
This version uses the classic big Update method, with a switch implementing a simple state machine.
*/

!!! Rockman technical data

!! Introduction

This is technical data that has been analyzed from the Rockman game ROM for the purpose of making Rockman tool-assisted speedruns as precise as possible.

The [http://bisqwit.iki.fi/jutut/megamansource/|disassembly] of the game has been an invaluable help in discovering these.

The Legend of Zelda: The Minish Cap
Return to Castle Wolfenstein
Half Life
Half Life: Blue Shift
Half Life: Opposing Force
Half Life 2
Half Life 2: Episode 1
Half Life 2: Episode 2
Dark Messiah of Might & Magic
Castlevania
@kdrnic
kdrnic / main.c
Last active March 23, 2018 23:23
#include <allegro.h>
#include <stdio.h>
#include <string.h>
typedef int face[3];
typedef char texture[64];
typedef struct mesh
{
V3D *verts;
V3D_f *verts_f;
main.c: In function 'draw_mesh':
main.c:186:40: warning: passing argument 5 of 'clip3d_f' from incompatible pointer type [-Wincompatible-pointer-types]
clip3d_f(POLYTYPE_FLAT, 0.1, 0.1, 3, ts, vs, t2s, bout);
^~
In file included from ..\libs\allegro-mingw-4.2.2\allegro-mingw-4.2.2\include/allegro/internal/alconfig.h:44:0,
from ..\libs\allegro-mingw-4.2.2\allegro-mingw-4.2.2\include/allegro/base.h:41,
from ..\libs\allegro-mingw-4.2.2\allegro-mingw-4.2.2\include/allegro.h:25,
from main.c:1:
..\libs\allegro-mingw-4.2.2\allegro-mingw-4.2.2\include/allegro/3d.h:74:14: note: expected 'const V3D_f ** {aka const struct V3D_f **}' but argument is of type 'V3D_f ** {aka struct V3D_f **}'
AL_FUNC(int, clip3d_f, (int type, float min_z, float max_z, int vc, AL_CONST V3D_f *vtx[], V3D_f *vout[], V3D_f *vtmp[], int out[]));
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
union
{
unsigned int u;
float f;
} a;
#include <allegro.h>
#include <stdio.h>
#include <string.h>
void usage()
{
printf("bitmap conversion tool for truecolor to paletted\nusage:\nbmpconv in <directory>\nbmpconv out <directory>");
}
int w = 0, h = 0, x = 0;