Skip to content

Instantly share code, notes, and snippets.

(defn f
[]
(reduce (fn [list new-val] (let [[left right] (split-with (fn [val]
(>= val new-val))
list)]
(concat left [new-val] right)))
(take 1 (range 2000))
(drop 1 (range 2000))))
@dabd
dabd / gist:5891970
Last active December 19, 2015 03:39
PokerStars Game #519: Tournament #1, STATE:519:cc/cc/cc/cr293c:Ts5s|7h6s/9dTh8h/7s/3c:-293|293:tartanian5|hyperborean
Seat 1: hyperborean (20000 in chips)
Seat 2: villain (20000 in chips)
hyperborean: posts small blind 50
tartanian5: posts big blind 100
*** HOLE CARDS ***
Dealt to hyperborean [7h6s]
Dealt to tartanian5 [Ts5s]
hyperborean: calls 50
tartanian5: checks
@dabd
dabd / gist:5892668
Created June 29, 2013 21:05
25bb 10/20 blinds
TEXAS HOLD'EM:
Infosets, Canonical cards only:
Round 0
Infosets : 2.90273e+15 2902725151134588
Nontrivial Infosets : 2.90273e+15 2902725151134588
Infoset-Actions : 8.70818e+15 8708175453403257
Continuing : 2.90273e+15 2902725151134419
Terminal : 2.90273e+15 2902725151134419
Round 1
Infosets : 1.09783e+23 109783138007343270029248
@dabd
dabd / gist:5902296
Created July 1, 2013 16:22
isomorph flops (1755)
4c3c2c
5c3c2c
6c3c2c
7c3c2c
8c3c2c
9c3c2c
Tc3c2c
Jc3c2c
Qc3c2c
Kc3c2c
PokerStars Game #2425: Tournament #1, STATE:2425:r300c/cr900c/cr2700c/r5400r20000f:9c6c|8hAh/AdAc8c/5d/Ts:-5400|5400:hyperborean_iro|entropy
Seat 1: hyperborean_iro (20000 in chips)
Seat 2: villain (20000 in chips)
entropy: posts small blind 50
hyperborean_iro: posts big blind 100
*** HOLE CARDS ***
Dealt to entropy [8hAh]
Dealt to hyperborean_iro [9c6c]
entropy: raises 200 to 300
hyperborean_iro: calls 200
(defrecord Node [value label])
(def a-tree
[(Node. 1 "root") [(Node. 2 "two") [(Node. 3 "three") (Node. 4 "four")]]])
(w/postwalk (fn [x] (if (instance? Node x) (:value x) x)) a-tree)
1
/ \
2 3
/ \
4 5
(z/vector-zip [1 [2 [3 [4 5]]]])
.
/ \
(loop [loc (z/vector-zip [1 [2 3]])]
(if (z/end? loc)
(z/root loc)
(recur
(z/next
(z/edit loc (fn [n & args] (if (and (number? n) (odd? n))
(* 2 n)
n)))))))
@dabd
dabd / gist:7666778
Last active December 29, 2015 11:49
(ns testzip.core
(:require [clojure.zip :as z]))
(defn make-node [n children]
(cons (first n) children))
(defn tree-zipper [v]
(z/zipper vector? next make-node v))
(defn best
[f coll]
(if (seq coll)
(reduce #(if (f %1 %2) %1 %2) coll)
nil))
(defn most
[f coll]
(if (seq coll)
(reduce (fn [[wins wins-score] x]