Skip to content

Instantly share code, notes, and snippets.

77a78,79
> coke
> cokes
84a87
> collier
89a93
> colt
157a162
> cote
186a192
@bouk
bouk / gist:4178408
Created November 30, 2012 20:34
result
9,12d8
< celt
< celts
< ceres
< cerf
15,17d10
< cf
< ci
< cipro
23d15
@bouk
bouk / gist:4178208
Created November 30, 2012 20:06
Letterpress cheater
#include <string>
#include <algorithm>
#include <list>
#include <cstring>
#include <fstream>
#include <iostream>
#include <cctype>
#include <vector>
#include <set>
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Needs program filename argument"
exit 1
fi
executable=`mktemp`
echo "Testing $1"
echo
@bouk
bouk / gist:3939575
Created October 23, 2012 15:47
Proper todo list!
# encoding: UTF-8
module BoukeTodoApp
class TodoList
def initialize(filename)
@items = []
@filename = filename
self.load
end
@bouk
bouk / gist:3939072
Created October 23, 2012 14:31
Blah
# encoding: UTF-8
TodoItem = Struct.new(:done, :contents)
todos = []
if File.exists? 'list.td'
File.open('list.td') do |f|
todos = f.read.split("\n")
todos.map! { |item|
new_item = TodoItem.new
new_item.done, new_item.contents = item.split("|")
new_item
'''
The algorithm works as follows:
It simply checks all positions, with positions being marked with None (unknown) x (part of a ship) or o (no ship)
Because the description says that ships can't touch (including diagonally) you know for sure that if a position
has the part of a ship that the positions diagonal to it don't, like so:
o.o
.x.
o.o
@bouk
bouk / index.html
Created September 8, 2015 15:22
Maps Overlay
<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html {
height:100%
}
body {
height:100%;
@bouk
bouk / index.html
Created September 8, 2015 15:22
Perlin Noise
<!DOCTYPE html>
<html>
<head>
<style>
* {
padding:0;
margin:0;
}
#canvas {
width:400px;
$(document).ready(function()
{
}
);