Skip to content

Instantly share code, notes, and snippets.

#include "Coordinate.h"
Coordinate::Coordinate(){
this->x = 0;
this->y = 0;
}
Coordinate::Coordinate( int x, int y ){
this->x = x;
this->y = y;
}
@towc
towc / index.html
Created February 27, 2018 13:26
Tic Tac Toe
<div id="errors" style="
background: #c00;
color: #fff;
display: none;
margin: -20px -20px 20px;
padding: 20px;
white-space: pre-wrap;
"></div>
<div id="root"></div>
<script>
const fs = require('fs');
const { promisify } = require('util');
const hash = require('./hash');
const { dbs: dbsPath } = require('./paths');
const readFilePromise = promisify(fs.readFile);
const getDBFileContentsFromName = async name => readFilePromise(`${dbsPath}/${name}`, 'utf-8');
const getNodeContentsFromName = async name => getDBFileContentsFromName(`${name}.json`);

Keybase proof

I hereby claim:

  • I am towc on github.
  • I am towc (https://keybase.io/towc) on keybase.
  • I have a public key ASD06MGN3CbnVAtPMw9btIXfLazvuVqFs2CQidfYqcH5ggo

To claim this, I am signing this object:

import java.io.IOException;
public class App {
public static void main(String[] args) throws IOException {
Server server = new Server();
server.register("/", new HandleRoot());
server.register("/abc", new HandleAbc());
server.start();
}
}
import java.io.IOException;
public class App {
public static void main(String[] args) throws IOException {
Server server = new Server();
server.register("/", new HandleRoot());
server.register("/abc", new HandleAbc());
server.start();
}
}
@towc
towc / aoc-15.js
Last active December 16, 2018 11:29
const fs = require('fs');
const [WALL, EMPTY, ELF, GOB] = [0, 1, 'elf', 'gob'];
const maxDist = 200;
const ents = [];
const coord = (x, y) => ({ x, y });
const delta = (pos, x, y) => ({ x: pos.x + x, y: pos.y + y });
const cell = pos => board[pos.y][pos.x];
const setCell = (pos, v) => board[pos.y][pos.x] = v;
@towc
towc / input
Created December 15, 2018 20:54
################################
##########G###.#################
##########..G#G.G###############
##########G......#########...###
##########...##.##########...###
##########...##.#########G..####
###########G....######....######
#############...............####
#############...G..G.......#####
#############.............######
@towc
towc / aoc-16.js
Last active December 16, 2018 09:59
const fs = require('fs');
const [OP, A, B, C] = [0, 1, 2, 3];
const samples = fs.readFileSync('input', 'utf-8')
.split('\n\n')
.map(cluster => cluster.split('\n'))
.filter(lines => lines.length === 3)
.map(lines => {
return ({
const fs = require('fs');
const [WALL, EMPTY, ELF, GOB] = [0, 1, 'elf', 'gob'];
const maxDist = 200;
let ents = [];
const coord = (x, y) => ({ x, y });
const delta = (pos, x, y) => ({ x: pos.x + x, y: pos.y + y });
const cell = pos => board[pos.y][pos.x];
const setCell = (pos, v) => board[pos.y][pos.x] = v;