Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am localvoid on github.
  • I am localvoid (https://keybase.io/localvoid) on keybase.
  • I have a public key whose fingerprint is 16FC FAC9 87E9 B1B8 E987 F582 BF96 BBDD 3AA1 D750

To claim this, I am signing this object:

@localvoid
localvoid / hex.cpp
Last active March 24, 2019 19:06
Hex Game with Monte Carlo AI
#include <array>
#include <algorithm>
#include <cinttypes>
#include <memory>
#include <iostream>
#include <iomanip>
#include <utility>
#include <random>
#include <cstring>
#include <cstdio>
@localvoid
localvoid / hex_bitboard.cpp
Created November 19, 2013 06:22
Hex Game BitBoard with very fast algorithm to determine the winner
#include <algorithm>
#include <iostream>
#include <memory>
#include <utility>
#include <cassert>
#include <cinttypes>
#include <cstring>
/*
BitBoard
@localvoid
localvoid / hex_bit_board.cpp
Last active December 28, 2015 16:39
Probabilistic algorithm to determine the End Game in the game Hex. False negatives are possible, false positives are not.
#include <algorithm>
#include <iostream>
#include <memory>
#include <utility>
#include <cassert>
#include <cinttypes>
/*
Probabilistic algorithm to determine the End Game in the game Hex.
@localvoid
localvoid / adjacent_hex.cpp
Created November 9, 2013 12:37
algorithm to find all adjacent vertices on the Hexagonal Lattice
#include <cinttypes>
#include <iostream>
#include <iterator>
#include <utility>
/*
Find all adjacent vertices in the Hex Board.
position = position - 1 + difference;
/*
Coursera course: C++ For C Programmers <cplusplus4c-002>
Homework 2: "Implement Dijkstra's Algorithm"
Implement a Monte Carlo simulation that calculates the average
shortest path in a graph. The graph can be generated using a
pseudo-random number generator to produce edges and their costs. The
shortest path algorithm will be Dijkstra’s.
/*
* CSE 351 HW1 (Data Lab )
*
* Boris Kaul <me@boriskaul.com>
*
* bits.c - Source file with your solutions to the Lab.
* This is the file you will hand in to your instructor.
*
* WARNING: Do not include the <stdio.h> header; it confuses the dlc
* compiler. You can still use printf for debugging without including
LETTERS = "abcdefghijklmnopqrstuvwxyz"
def prepare(line, subst):
result = []
for word in line.split():
out = []
for c in word:
out.append(subst[c] if c in subst else LETTERS)
result.append(out)
return result