Skip to content

Instantly share code, notes, and snippets.

{
| termtris: a console mode frontend for learntris, written in free pascal.
| copyright 2013 michal j wallace. all rights reserved.
| available to the public under the terms of the MIT/X11 license.
}
{$mode objfpc} {$H+}
program termtris;
uses
kvm, kbd, cw,
process,
# this is just the third step
input = [ 2, 8, 3, 5 ] # an array of unique items
n = len(input)
# (...)
order = [ 3, 0, 2, 1 ] # first two steps created this
output = [ 0 ] * n
+-------------+
| |
| room 2 |
| |
+-----+ +----+
| |
-----------------+ +-----------------
<- rm 1 rm 3 ->
--------------------------------------
@tangentstorm
tangentstorm / something.kt
Last active August 29, 2015 13:57
first attempt at using kotlin
/**
* Created by michal on 3/25/2014.
*/
import java.util.ArrayDeque
import java.util.Map;
import java.util.HashMap
trait WjData {
}
*background: black
*foreground: grey70
font: *-fixed-*-*-*-32-*
xterm*faceName: Bitstream Vera Sans Mono
xterm*faceSize: 14
xterm*vt100*foreground: grey70
xterm*vt100*background: black
@tangentstorm
tangentstorm / gist:10699845
Last active August 29, 2015 13:59
a colorforth-like thing in coffeescript
# colorforth inspired programming system
module 'colorcode'
imports ['b4', 'key'], ()->
$jq('#rhs')
.html(
'''
<div id="rhs-block" tabindex="0"/>
<div id="rhs-status" tabindex="1"/>
''')
MODULE hello;
IMPORT Out := Console;
BEGIN Out.String("hello world"); Out.Ln;
END hello.
from itertools import product, combinations, permuatations
ranks = 'AKQJT98765432'
suits = 'abcd'
def high_flops():
# the order of the cards is relevant here
# suit a will be suit of leftmost card.
# suit b is first different suit encountered left to right.
{$mode delphi}
program rankhand;
uses sysutils;
var
handRankDb : array[0..32487833] of UInt32;
dbFile : File;
numRead : cardinal;
begin
Assign(dbFile, 'HandRanks.dat');
#include<stdio.h>
//-- macros ---
#define I int // I = any int
#define A int // A = specifically an address in vm's ram
#define B int // B = int used as boolean
#define C char // C = char type
#define U8 char // U8= 8 bits
#define V void // V = void