Analysis on the choice of the lead in the game of Contract Bridge.
This project is designed in modules, each of them has different usages:
-
data: Downloads .lin files from Vugraph in BBO [5] and parses files to create hdfs dataframe. Also functions to search for specific biddings
-
learning: Different approaches to try and learn through the data of expert players, using CNN and ML methods
-
reinforcement_learning: Uses reinforcement learning based on the articles [1][2], using the OpenAI gym [4] and DDS [3]
-
legacy: Old functions and datasets in the older format.
This is the data module. It contains:
-
bbo: Scripts to download the .lin bbo files and those files compressed as raw_lin_data_i.7z
-
auxiliary_functions.py: Self-explanatory. For instance, functions to compute longest_color and strongest_color
-
enums.py: dicts to encode different aspects of Bridge
-
parser.py: parses the .lin files and creates a hdfs dataframe.
-
store.hdfs: hdfs dataframe
-
tools.py, enum.py: auxiliary functions and auxiliry dicts, used by parsing
-
symmetry.py: symmetry proposed by a Bridge player, that would generate more data for the case of No trumps
Folder with learning methods based on CNNs and ML:
-
1nt.ipynb: Approach using Scikit learn machine learning machinery
-
CNN_version1_for_1NTPPP.ipynb: Approach using CNN with TensorFlow
-
CNN_main.py: Final code that unifies our CNN approach with optimized parameters for the different objectives, e.g. determine the color of the leading card, and analysis of correlations according to the bidding analyzed.
-
color_high_low.py: CNN to guess the best color and if should play high or low. Included in CNN_main
-
create_research_tree.py: creates prefix tree, so we can analyze which biddings are more recurrent, we found 72 that showed more than 300 data points.
-
path_jupy, template_use_data.py: Legacy.
-
treat_biddings.py: Pre-treatments to the data
[TODO]
- encode_and_parsing:
a. encode: Encode and Decode the String representing the bidding to an array of numbers
b. parsing: functions for reading the hands of players and determining the lead. Hands are encoded in 4 52-vectors of booleans representing the presence or not of the card, one for each player
-
parseHeading: Tools to decode the heading of .lin files according to HowToReadHeading
-
HowToReadHeading: Human decoding of .lin headings
Thank you Véronique Ventos and Tristan for the guidance in this daring project And specially to every member of the team: Ayman, Eduardo, Ian, Pierre-Emmanuel, Yann, Zigfrid and Ziyed!
- Automatic Bridge Bidding Using Deep Reinforcement Learning, Chih-Kuan Yeh and Hsuan-Tien Lin
- Contract Bridge Bidding by Learning, Chun-Yen Ho and Hsuan-Tien Lin
- Double-Dummy Solver, http://privat.bahnhof.se/wb758135/
- OpenAI, https://openai.com
- Vugraph archive, http://www.bridgebase.com/vugraph_archives/vugraph_archives.php