This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4c3c2c | |
5c3c2c | |
6c3c2c | |
7c3c2c | |
8c3c2c | |
9c3c2c | |
Tc3c2c | |
Jc3c2c | |
Qc3c2c | |
Kc3c2c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 | |
/ \ | |
2 3 | |
/ \ | |
4 5 | |
(z/vector-zip [1 [2 [3 [4 5]]]]) | |
. | |
/ \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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] |