Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef unsigned char tile_t;
typedef struct {
// size is the number of tiles between the center of the pile and any of its edges
// so, size 0 has one tile, size 1 has 1+8 = 9 tiles, size 2 has 1+8+16=25 tiles, etc.
int size;
#include <stdio.h>
#include <stdbool.h>
#define MAX_TURNS 12
// true if we've found a way for the game to end by MAX_TURNS
// false if not
bool play(int turn, int p0, int p1, int p2) {
turn++;
{-# LANGUAGE NoMonomorphismRestriction, FlexibleContexts #-}
module Quantum where
import Data.Complex
import Control.Monad.Random
import Control.Lens
-- |Dot product of complex vectors
dotprod a b = sum (zipWith (*) a (map conjugate b))
@arirahikkala
arirahikkala / navigateonpaste.js
Created May 11, 2013 11:09
Navigate on paste as is usual on Unix browsers, and that works on current Chrome versions (unlike the extension on the Chrome Web Store).
// ==UserScript==
// @name Navigate on Paste
// @namespace http://github.com/arirahikkala
// @version 0.1
// @description Navigate on paste as is usual on Unix browsers, and that works on current Chrome versions (unlike the extension on the Chrome Web Store).
// @match http://*/*
// @copyright 2013, Ari Rahikkala
// ==/UserScript==
document.body.onpaste=function(e){
{-# LANGUAGE NoMonomorphismRestriction #-}
module MatrixStuff where
import Data.List (sortBy, transpose, findIndex, find)
import Data.Ord (comparing)
import Control.Monad (ap)
import Control.Monad.Instances
import Data.Ratio
import Data.Complex