Pokerstats - Hold'em and Omaha Statistics

PokerStats - Hold'em and Omaha Statistics

PokerStats is a software for Linux (and probably other *nix variants) which allows you to track your play, as well as your opponents in Hold'em and Omaha cash games. It reads the hand histories generated by PokerStars client and creates statistics about players and their tendencies. A savvy player can use this information as an additional tool when making decisions.

Features

New/Hot Features

  • HUD - FPDB's Heads-Up Display ported to PokerStats
  • Omaha is now a supported game (currently only in git)

Shows the basic statistical information for players: VPIP, PFR, attempt to steal, continuation-bet frequency, 3bet/4bet frequency and so on.

  • Visualisation of your monetary progress with a graph
  • Statistics about individual hands
  • Player notes
  • Positional statistics
  • Filtering by dates and game level

Download

Latest release: pokerstats-0.3.99 (1.1 MB)

Git tree:

git://bostik.iki.fi/src/pokerstats.git

What does it do?

  • Basic functionality
  • Money graph
  • Most often needed stats
  • Hand reader and HUD in their separate processes for reliability
  • Simple set-o-meter

Requirements

  • Python
  • PostgreSQL
  • Python-Psycopg2
  • PyGTK2+
  • Python-matplotlib
  • Python-dbus
  • Python-libxml2
  • Python-wnck

License

GNU General Public License 3

You are free to use the software as you wish. You are free to learn from it. You can improve or modify it as you wish. You can redistribute it to anyone you want to. The only requirement is that if you pass the software to someone else, you need to provide them with your modifications and grant them the same privileges.

Known Problems

Every now and then the pot calculations are off. About once every 8000 hands a small blind is missed. Also, some shove-contests may end up being miscalculated. If you know which hand triggers this behaviour, please report it.

History

I wanted a poker statistics software that would run natively on my system. But more than that, I wanted to understand how they worked on the inside.

When I first started playing, the only client that would work neatly with WINE was PokerStars. So I took to that. Later on, when I decided to take poker seriously, I found out that there was a selection of very sophisticated statistics software written to help the players analyse their own, as well as their opponents' game.

At the time, the state-of-the-art software was Poker Tracker, which I tried to get working with WINE, without success. I only needed a very basic subset of all the features, so instead of installing another operating system for just casual poker playing, I decided to write my own statistics tool instead. How hard could it be?

And that's how it started.

Wayland for Kids

Educational Computing

What do you get if you combine Wayland, in-car minimonitor and Raspberry Pi? In my case, a perfect setup for our daughter who just loves computers.

Background

Our daughter has been infatuated with computers since before she could crawl. A physical keyboard which produces immediate effects on the screen is a particular favourite. Since it's impossible to draw the little lady away from computers, we might as well let her have one of her own.

The idea for this project was to build a simple computer we could let our daughter to play with, and which would automatically boot to a kiosk-like state. There were only a few requirements:

  • Cheap
  • Low power consumption
  • Movable around the house as needed
  • Easy to hack

The computer part was easy: Raspberry Pi fits all the specifications. If it breaks, replacement cost won't even exceed that of a few beers. I still wanted the setup to be simple, so any monitor I chose would have to have HDMI input and relatively small physical size. I found the answer in a rather unexpected place - small in-car monitors. They fit the physical specifications - and they come with HDMI inputs by default. In comparison, cheapest desktop monitors are heavier, way bigger, and tend to omit HDMI. (At least for the hardware available where I live.)

One thing still missing is the enclosure for RPi. It's a work-in-progress, made of a leftover piece of 3mm thick acrylic plate which cost next to nothing. The piece is also big enough to provide material for a dozen setups.

Construction

The setup looks and behaves like this:

? (Click image for video)

As a base, I used a thick(ish) piece of plywood.

The monitor's power adapter is literally strapped down with large zip ties. The keyboard and cables are set in their place with smaller ones and matching stick-on hooks.

For powering the RPi, I simply used a quality 1.2A/5V µUSB charger.

When the system starts, it boots directly into a native Wayland session. Instructions for building Wayland+Weston (reference compositor) can be read here, and followed with a just couple of tiny modifications.

  1. install autoconf, libpam0g-dev (+ vim-nox) in addition to other packages
  2. add --disable-documentation to wayland build configuration
  3. if necessary, rebuild cairo with --enable-glesv2
  4. build weston with --enable-weston-launch
  5. after weston install, change mode on weston-launch:

    -rwsr-xr-x 1 root root 37289 Jan 15 16:41 bin/weston-launch

Session startup scripts

For the automatic session launch, I use a few simple scripts.

** Wayland Environment: **

pi@raspberrypi ~ $ cat wayland-env-setup.sh #!/bin/sh export WLD="$HOME/local" export PATH="$WLD/bin:$PATH" export LD_LIBRARY_PATH="$WLD/lib:/opt/vc/lib" export PKG_CONFIG_PATH="$WLD/lib/pkgconfig:$WLD/share/pkgconfig" export ACLOCAL="aclocal -I $WLD/share/aclocal" export XDG_RUNTIME_DIR="/run/shm/wayland" export XDG_CONFIG_HOME="$WLD/etc" if [ ! -d $WLD/share/aclocal ]; then mkdir -p $WLD/share/aclocal fi if [ ! -d $XDG_RUNTIME_DIR ]; then mkdir -p $XDG_RUNTIME_DIR fi chmod 700 $XDG_RUNTIME_DIR chown pi.pi $XDG_RUNTIME_DIR

** Weston Compositor Launch **

pi@raspberrypi ~ $ cat W #!/bin/bash source ${HOME}/wayland-env-setup.sh exec weston-launch -- --max-planes=0 --idle-time=99999

** Terminal Launch **

pi@raspberrypi ~ $ cat T #!/bin/bash source ${HOME}/wayland-env-setup.sh exec weston-terminal

** Modified /etc/rc.local **

pi@raspberrypi ~ $ cat /etc/rc.local #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. # Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi # Launch Weston as 'pi' if [ -e /home/pi/W ]; then su -l -c '/home/pi/W &' pi fi # Launch terminal inside weston session # but wait until the compositor is ready if [ -e /home/pi/T ]; then printf "Waiting for Weston session..\n" while true; do sleep 1 if [ -e /run/shm/wayland/wayland-0 ]; then break fi done printf "Socket found, compositor ready!\n" su -l -c '/home/pi/T &' pi fi exit 0

Known problems/oddities

The monitor supposedly has a native resolution of 800x480, but the EDID data does not expose this setting. Trying to force this resolution in /boot/config.txt results in black screen and no video output at all. The automatically chosen nearest-match resolution is larger than what the monitor supports, and so the desktop does not fit on screen.

The monitor has to be on when the RPi is booted. Apparently RPi only tries a HDMI handshake at boot time. (Fixed by hdmi_force_hotplug=1 in config.txt)

Disclosure

Some of the fascination for Wayland and car monitors comes from my place of work, Nomovok. Our dealings with bleeding-edge stuff and embedded systems have had an effect on me.

Pastakastike

Minimalistinen, herkullinen pastakastike

Arvioitu valmistusaika: 1h

Ainekset

  • 1kg tomaattipyreetä (2x500g)
  • Nippu basilikaa
  • Valkosipulia, 6-10 kynttä
  • Oliiviöljyä, reilu 1dl
  • Kuivaa chiliä
  • (Paistettua jauhelihaa)

Tarvikkeet

  • Normaalikokoinen kattila
  • Pieni kasari tai liemikattila
  • Tarttumaton paistinpannu

Valmistus

Kaada tomaattipyreet isompaan kattilaan ja laita pienelle lämmölle. Hämmennä vähän väliä, ettei pala pohjaan.

Riko valkosipulinkynnet painamalla niitä veitsen lappeella. Kaada oliiviöljy kasariin. Lisää basilikanlehdet, murskattu chili ja valkosipulit öljyyn. Keitä matalalla lämmöllä kunnes basilika on kuivaa ja valkosipulit kullanruskeita. Kaada siivilän läpi tomaattipyreen sekaan.

Hauduta ja hämmennä seosta kunnes öljy ei enää erotu. Tähän menee yleensä noin puoli tuntia.

Siivilään jääneet palat voi laittaa lautaselle naposteltavaksi.

Keitä pasta, mutta jätä se minuuttia tai kahta vajaaksi. Ota 2-3 kauhallista kastiketta paistinpannulle ja nostele yhden hengen pasta-annos sekaan. Jos käytät jauhelihaa, pistä kourallinen tai pari sekaan. Heittele annosta pannulla jotta se ilmaantuu ja saa kermaisemman koostumuksen.

Kaada lautaselle ja tarjoa.

Tramp - Tray MPD Client

Tramp - Tray Mpd Client

The primary function of a music player is to play audio files. mpd does just that, and Tramp is a minimalistic client with only the bare necessities needed to listen to music.

Features:

  • Tray icon
  • Playlist creation
  • Playlist selection
  • Seeking with mousewheel

Everything else is controlled with mpc by binding actions to multimedia keys.

Get the Source

There are no prebuilt binaries. Just grab the source:

git clone git://bostik.iki.fi/src/tramp.git

and build. The source tree contains required files to build into a debian/ubuntu package. Install the needed build dependencies and make your own package:

sudo aptitude install autotools-dev debhelper-dev libmpd-dev libgtk-3-dev fakeroot

dpkg-buildpackage -rfakeroot

The code, including comments, is just ~1600 lines of C.

Screenshots

Because tramp is a minimalistic client, there won't be much in way of screenshots. However, these are the things you're likely to see when using tramp:

Systray icon: ? ; Main window for playlist selection: ?

In addition, the current playlist is shown in tooltip.

Using Tramp

  • Left-clicking on tray icon pops up the window
  • Right-clicking on window hides it
  • Right-clicking on tray icon also hides window, if it's shown
  • Each scrollwheel click on main window seeks 15 seconds

Configuration Examples

When using tramp, controlling mpd is meant to be done with hardware keys. Practically all modern keyboards sport a variety of "multimedia keys" that may be bound to perform actions of all sorts.

My controls for mpd and audio, from fluxbox keybinding file look like this:

None XF86Forward :ExecCommand mpc next None XF86Back :ExecCommand mpc prev None XF86AudioPlay :ExecCommand mpc play None XF86AudioMute :ExecCommand mpc stop Mod1 XF86AudioPlay :ExecCommand mpc toggle None XF86AudioRaiseVolume :ExecCommand aumix -v +2 None XF86AudioLowerVolume :ExecCommand aumix -v -2

While the unmodified keys require no explanation, I have bound Alt+AudioPlay to "toggle", which really is just mpd's way of saying "Pause/Un-Pause".

BBQ-ribsit Bostikin tapaan

BBQ-ribsit Bostikin tapaan

Arvioitu valmistusaika: 6h

ribsit

Kastikeainekset

  • 500g purkki tomaattipyreetä
  • Pullo Worchestershire-kastiketta
  • Etikkaa, vajaa 1dl
  • Keltasipulia, paljon
  • 5-6 valkosipulinkynttä
  • Hunajaa, 2rkl (vaahterasiirappi ja palmuhunaja käyvät myös)
  • Chiliä maun mukaan
  • Tuoretta sitruunamehua
  • Suolaa
  • Tummaa rommia, noin 1dl
  • Cayenne-pippuria
  • Juustokuminan siemeniä

Muut tarvikkeet

  • Iso kattila
  • Kookas ja laakea astia

Valmistus

Jos chilit ovat kuivia, ne voi laittaa pieneen kattilaan jossa on noin 5dl vettä. Kuumenna kevyellä lämmöllä. Tarkoitus on nesteyttää chilit, ei keittää niitä. Älä heitä vettä pois.

Silppua keltasipulit mahdollisimman pieneksi ja kuullota pannulla pehmeiksi. Älä paista! Kaavi pehmenneet ja läpikuultavat sipulinpalat kattilaan.

Silppua tai murskaa valkosipulit ja sekoita sipuliin.

Leikkaa chileistä kannat pois ja pilko loput niin pieneksi kuin ikinä pystyt. Mikäli käytössä on yleiskone, leikkaamisen sijaan chilit voi myös käyttää pikaisesti soseuttimen kautta. Lisää chilihakkelus tai tahnamainen murska kattilaan.

Lisää kattilaan vajaa 5dl vettä. Jos nesteytit kuivachilejä, käytä siitä jäänyt vesi.

Jauha juustokuminan siemenet morttelissa ja lisää kattilaan.

Keitä sipuli-chili-seosta niin kauan että sipulit alkavat hajota nesteeseen. Tarkoituksena on suurustaa kastike pelkästään sipulin tärkkelyksellä. Lisää vettä tarpeen mukaan pienissä erissä jotta seos ei pala tai paakkuunnu.

Lisää kaikki loput aineet kattilaan ja pistä pienelle lämmölle. Sekoita usein ettei kastike pääse palamaan pohjaan.

Kastiketta keitellään kasaan niin kauan että se ei enää ole vetelää tai nestemäistä. Tähän kuluu helposti parikin tuntia, ja jos sen aikana näyttää siltä että kastike alkaa paksuuntua liiaksi, sekaan kannattaa lisätä tilkka vettä. Mitä pidempään kastike saa hautua, sen parempaa siitä tulee.

Kun kastike on mielestäsi valmis, ota se hellalta ja jätä hautumaan kannen alle. Älä laita kastiketta kylmään.

Ribsit

Ribsien valmistukseen tarvitaan iso kattila ja jokin kookas, puolisyvä astia. Hätätapauksessa syvä uunipelti ajaa asian. Iso metallinen paistivati on oikein hyvä.

Keitä ribsejä kattilassa 40-50 minuuttia, ja kuori lihasta irtoava vaahto päältä pois sitä mukaa kuin sitä kertyy. Siirrä kypsät ribsit puolisyvään astiaan. Peitä astia foliolla. Mikäli kaikki ribsit eivät mahdu kattilaan kerralla, tämän joutuu tekemään muutamassa palassa.

Kun kaikki ribsit ovat astiassa, kaada pieni osa valmistamaasi kastiketta lihojen päälle. Pyörittele ribsejä sen verran että mausteista kastiketta pääsee kaikille pinnoille. Laita folio takaisin päälle ja pistä lihat jääkaappiin vähintään 4 tunniksi.

Ota lihat jääkaapista. Kaada astian pohjalle vajonnut kastike takaisin huoneenlämmössä olevan sekaan.

Grillaus

Grillaa ribsejä noin 3 minuuttia per puoli, valellen niitä koko ajan kastikkeella. Nosta lautaselle ja tarjoile välittömästi.

Syödään sormin.

Blazing Fast 7-card Poker Hand Evaluator

Blazing Fast 7-card Poker Hand Evaluator

So called "twoplustwo algorithm" is the fastest known poker hand evaluator for any form of 7-card poker. It is based on a precomputed lookup-table, through which any hand may be evaluated in 7 steps.

Handeval library computes the lookup table and builds into a shared library to use the table with ease. It also provides python-bindings.

Source and Installation

There is no general build yet, but the source builds directly into a set of debian/ubuntu packages. First, get the source:

git clone git://bostik.iki.fi/src/handeval.git

Build the packages:

dpkg-buildpackage -rfakeroot

which creates these four:

  • libtwoplustwoeval
  • libtwoplustwoeval-data
  • libtwoplustwoeval-dev
  • python-twoplustwo

Then just install the packages. The package libtwoplustwo-data contains the huge (>120MB) lookup table, which is computed during the build.

The following examples assume that the lookup table is installed in the default path as provided by the package.

Using the Evaluator

In C

#include <2p2-eval.h>
...
int hand1[] = { 2, 5, 18, 31, 32, 47, 50 };
int eval1;
long hand_category;
const char *hand_name;

eval_init("/usr/share/twoplustwo/handranks.dat");
eval1 = eval_7_card_hand(hand1);
hand_category = hand_category_id(eval1)
hand_name = hand_category_name(hand_category)

The returned value is the evaluated key for the best poker hand that can be formed by using the seven cards. Bigger value is better, so all evaluated hands can be compared directly.

In Python

import twoplustwo as t
t.init('/usr/share/twoplustwo/handranks.dat')
t.eval_7hand(4, 7, 11, 12, 21, 27, 40)