Skip to content

Instantly share code, notes, and snippets.

View hanss314's full-sized avatar

hanss314

  • Toronto
View GitHub Profile
@hanss314
hanss314 / AoC.rule
Created December 11, 2020 06:27
Advent of Code Day 11 Part 1 Solution
@RULE AoC
@TABLE
n_states:3
neighborhood:Moore
symmetries:permute
var i={0,1}
var j={0,1}
import shlex
from game import MultiplayerAvocado
from subprocess import Popen, PIPE
MOVES = {
0: 'slice',
1: 'mash',
2: 'eat',
3: 'buy'
import curses
import time
from minesweeper import MineSweeper
def main(size=(10, 10), mines=10):
screen = curses.initscr()
height, width = screen.getmaxyx()
init_curses()

Keybase proof

I hereby claim:

  • I am hanss314 on github.
  • I am hanss314 (https://keybase.io/hanss314) on keybase.
  • I have a public key whose fingerprint is 7528 691A E363 4C6D AC27 0695 82B2 DD62 93C7 0B9A

To claim this, I am signing this object:

@hanss314
hanss314 / votecounter.py
Created November 20, 2017 03:32
bfb vote counter
'''
Copyright 2017 hanss314
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
public void rotSymRandomize(int deadDensity){
for(int x = 0; x<(WIDTH/2); x++){ //doesn't cover everything for odd widths, but it's good enough
for(int y = 0; y<HEIGHT; y++){
Tile t = allTiles[x][y];
Tile pair = allTiles[WIDTH-1-x][HEIGHT-1-y];
int state = MathUtil.randInt(0,deadDensity*2)
switch(state){
case 0: t.setState(1);
pair.setState(2);
break;
@hanss314
hanss314 / StringParser.java
Created March 5, 2017 21:26
Game string parser and maker
final String charTable = "0123456789:;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
public String getCaryString(){
int humanNum = 0;
int timeLimitNum=99999;
int timeBonusNum=99999;
if(redBot){
humanNum+=(2*redDepth+4);//(redDepth/2+1)*4
}
if(blueBot){
humanNum+=(blueDepth/2+1);
@hanss314
hanss314 / AI.java
Created March 5, 2017 21:19
GOLAD AI
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.ArrayList;
import java.lang.Math;
import java.util.Random;
class AI implements Callable<int[][]> {
private Tile[][] allTiles = new Tile[0][0];