View on GitHub

Pokermanager

Homework for C++ course project at Aalto University

Download this project as a .zip file Download this project as a tar.gz file

AS-0.3301 - project document

Subject - Poker Manager

Authors:

280600 Peng Liu peng.liu@aalto.fi
281201 Qiuyang Tang qiuyang.tang@aalto.fi
245027 Nataliia Trifonova trifonn1@cc.hut.fi

Last updated:

12.12.2010

Platform supported: Mac OS, Linux (i386/amd64)

Libraries to be installed:

  1. Sqlite3 installation: (school linux machines do not have libsqlite3-dev library, and we don't have sudo permisson there to install it, so we will demonstrate the program using our own laptop)

    sudo apt-get install sqlite3 libsqlite3-dev

  2. Gnuplot installation:

    sudo apt-get install gnuplot

  3. Qt installation:
    • Verify that you are in your home directory: cd ~
    • Download the Qt SDK binaries: wget http://goblin.tkk.fi/Qt_SDK_Lin64_offline_v1_1_3_en.run
    • Change the file permissions to make the file executable: chmod u+x Qt_SDK_Lin64_offline_v1_1_3_en.run
    • Execute the installer file and follow the instructions of the graphical installer: ./Qt_SDK_Lin64_offline_v1_1_3_en.run

The main window consists of six tab pages: general, hands, sessions, money won, positions and graph. Click "load history file" button to load the history from text file to the database. The file name of the current history file is displayed on the window.

Choose a player in the combo box of players, the statistics will be shown in the tab pages.

On the "general" tab page, the hands history of the current player is displayed in the table of player details. The table of player statistics shows the general statistics.

In the "hands" tab page, the times and winning percentage of different starting hands are shown in the statistics table. The table shows the history filtered by the chosen private cards. When double click a row in the table, the table of session details shows the whole history of the chosen session.

In the "sessions" tab page, by setting the beginning date and ending date, the sessions took place between these two dates are shown in the table. When double click a row in the table, the table of session details shows the whole history of the chosen session. The statistics table shows the statistical results between the two dates.

In the "money won" tab page, the value between 0 and 100 can be chosen by the slider. The table shows the sessions in which the player won money above the value. When double click a row in the table, the table of session details shows the whole history of the chosen session.

The "positions" tab page shows the statistical results for small blind and big blind. The table can also be filered by different positions.

The "graph" tab page shows money won over hands played for the player.

Terminology:

Program architechture

The program includes 5 source files: fileIO.cc, player.cc, sqltest.cc, mainwindow.cc and main.cc. The sqltest.cc includes the interface to the sqlite database. File fileIO.cc provides the function to read from a given text history file, parses every possible line in it, and saves the result in structure in a sqlite database. FIle player.cc includes a player class, which provides methods to calculate player related statistics. In mainwindow.cc and main.cc, we set up graphic user interface using QT. The following is the diagram of the system architecture.

Layer 1 mainwindow.cc Graphic UI Statistic Module Parse Module Database Interface player.cc player.hh hands_played money_won vpip pref total_actions raise bet call agression_factor wtsd wsd threeBet cbet cards blind vpipB pfrB wsdB wtsd filoIO.cc filoIO.hh game_date game_id table_id action phase cards player money position sqltest.hh sqltest.cc open query count colum close Gnuplot dataset gnuplot_cmd

We decided to use this architecture because at the beginning we decided to use sqlite database, then we need a database interface to create and make queries to the databse. The parse module is compulsory to read the history and parse important information, in our design, after extracted information, we directly save it to our database. When looking into our project requirements, we need to make statistics to a given player, so we implemented a statistic module and created a player class, it has methods to get different statistics. To plot the money won, we need to use gnuplot in the system, so we firstly print the dataset to plot in a file, and then call the gnuplot using preconfigured settings, after we got the picture, we embedded it into our graphical UI. The graphical UI can filter through different queries to our database. We think and discuss as well as doing the coding, gradually we get a clear structure of the program like this.

Data structures and algorithms

Peng's data structures:

Nataliia's data structures:

Nataliia's algorithms:

Qiuyang's data structures:

Class mainwindow contains the methods to work with graphical user interface, including the slots connected to different siganls and private members to work with the database and player class.

Known bugs

Nataliia's bugs:

In order to check the results of statistics calculation I used PockerTracker software with the same history files. I found some differences:

Peng's bugs:

The fileIO.cc can not parse the time zone correctly. In the implementation. we directly ignored the time zone.

Tasks sharing and schedule

Liu Peng

Implement and test the fileIO part, read from history file and parse valuable information; Create a database and save the parsed information in efficient and easy-to-read format in the database. Implement plotting the player's money history using gnuplot and embed the figure to the graphical user interface.

Tang Qiuyang

Study and create user friendly graphical user interface of the program. Implement the filter in the graphical UI.

Nataliia Trifonova

Implement the sqlite database interface, which can be used to do create/open database, make queries and close database actions. Implement most of the statistics, implement the player class.

Communication:

Face to face discussion We have group meetings twice a week to show our progress and discuss different problems we met, and make plans for the next few days. Social network discussion We frequently used facebook to chat in group, discussing about problems and give suggestions to each other.

Amount of work done in different phases:

Things to be improved:

Basicly we have changed our orginal plan a lot. It is because at the beginning we didn't have a clear picture what to do and how to design the big picture of the program. After really do the coding work, we modify and improve our schedule step by step. Schedule seems haven't changed much, we basically followed the milestones, but we met much more frequently than originally planned. But next time we shall make a clearer milestone for the team.

Differences to the original plan

Among "Additional requirements" we did not implement calculation pot odds to improve hand review, because we added much more statistics and pot odds calculation seems not that easy.

Among "More stats and features, e.g. tip a dealer, burn cards before draw, etc." requirements we implemented position statistics and added stats for a player when he/she was on big blind/small blind. "Tip a dealer and burn cards before draw" are the actions which made during the game. This part we just did not delete when we eventually understood the aim of the project (programming not the game, but statistical SW)

Program architecture was changed and is described in the corresponding part in details. Briefly, we had class Player and class Database which contains methods to work with DB. And basically, we didnt have any Data manager as we read history directly to the DB and then by making queries and some code calculat the statistics.

As for "Task sharing" part some changes were made as well. They will be described in the corresponding part. Of course, deadlines where shifted and we had a way more meetings.

We think our plan was not bad, since it covered the main actions each should do, the main ideas of what our programm should calculate and present, gave us rough orientation to deadlines and approximate scope of the work. In any case sometimes it is difficult to stick to the plan.

References

SQLite documentation: http://www.sqlite.org/docs.html

SQLite code example: http://www.dreamincode.net/forums/topic/122300-sqlite-in-c/

C++ documentaion: http://www.cplusplus.com/reference/

Qt documentation: http://doc.qt.digia.com/

A brief gnuplot tutorial by Henri Gavin: http://people.duke.edu/~hpgavin/gnuplot.html