“Texas Hold 'Em”
Total Page:16
File Type:pdf, Size:1020Kb
University of Nottingham Supervisor - Graham Kendall gp-gxk2 2nd Year Software Engineering Project - “Texas Hold ‘Em” Group Members: wxa00u Wafa Al-Ajmi wlc00u Wai Leuk Chu kxg00u Keeran Gohil mjn00u Micheal James Nolan vxp00u Viral Patel txw00u Timothy Wood ‘Final Group Report’ May 2002 Gp-gxk2 Group Project May 2002 Contents Page page 2 1. Abstract page 5 2. Introduction page 6 2.1. Initial Problem page 6 2.2. Brief Introduction page 6 3. Research page 8 3.1. Brief History of Poker page 8 3.2. Poker Variations page 8 3.3. Rules of the Game page 9 3.4. Betting Strategy page 9 3.5. AI Computer Modelling Methods page 9 3.6. GUI - Design Options page 10 4. The Back-End page 11 4.1. The Need for a Back-End page 11 4.2. Research page 11 4.3. An Example Back-End page 11 4.3.1. A working Model page 12 4.3.2. Perfect Information page 13 4.3.3. Obvious Limitations page 13 4.4. Developing the Model page 13 4.4.1 Stripping the Back-End page 13 4.4.2 Modifications to Accommodate a GUI page 14 4.4.2.1. Getting a Card page 14 4.4.2.2. Getting a Decision page15 4.4.3. Putting it all together – the Back-End Class page16 4.4.4. Putting it all together – the Poker Class page16 5. Building a Computer Poker Player page18 Poker Theory page19 Implementations page20 6. Front-End Design - GUI page21 Initial Ideas page21 Mock Up Design page21 7. Creating the GUI page22 7.1. Initial Design page22 8. Developing the GUI page24 8.1. Limitations of the Interim GUI page24 Page 2 Gp-gxk2 Group Project May 2002 8.2. Developing a Front-End page24 8.2.1. GUI layout and Features page24 8.2.2. Interaction With The User page25 8.2.3. Establishing Initial Game Data page25 8.2.4. Representing Dealt Cards page26 8.2.5. Establishing User Decisions page27 8.2.6. Board and Hold Cards page 28 8.3. Implementation page28 8.3.1. Implementation details page28 8.3.2. Back-End & Front-End Communication page29 9. Back-End & Front-End Communication page30 9.1. Background to Message Passing page30 9.2. Research page30 9.3. Control page31 9.3.1. Back-End to Front-End Message Passing page31 9.3.2. An Intermediate Class page32 9.4. Message Area page33 9.4.1. Initial Requirements page33 9.4.2. Naïve Implementation page33 9.4.3. Producer-Consumer Analogy page34 9.4.4. Building the Message Area page35 9.4.5. The Implementation page36 9.4.6. The Messages page37 9.4.6.1. Message Syntax page37 9.4.6.2. Implemented Messages page37 9.4.6.2.1. Messages to the Front-End page37 9.4.6.2.2. Messages to the Back-End page38 10. Division of Labour page39 10.1. Meetings page39 10.2. Web Site page39 10.3. Time plan page39 11. Evaluation page40 11.1. Limitations of the Software page40 11.1.1. Limitations of the GUI page40 11.1.2. Limitations of the Message Area page40 11.1.3. Limitations of the AI page41 11.2. Overall Successes of the Project page42 Page 3 Gp-gxk2 Group Project May 2002 12. Bibliography page43 Appendix page45 Appendix Ai page45 Appendix Aii page45 Appendix Bi page46 Appendix Bii page46 Appendix Biii page47 Appendix Biv page47 Appendix C page49 Page 4 Gp-gxk2 Group Project May 2002 1. Abstract Games are an interesting and challenging domain for Computer Science Research. However, developing a program to play a strategic game involves converting application of theoretical concepts to practical situations. Recently Poker has received a lot of attention from Computer Scientists and game researchers. The game is logistically simple yet strategically complex. Most importantly, Poker is a non-deterministic game with imperfect information. Due to these factors Poker provides an excellent domain for investigating problems of decision making under conditions of uncertainty. In this report we will discuss how we went about creating a high class automated Poker playing program that plays a legal game of Poker. Each section will describe how the separate points were addressed and how we sorted out any encountered problems. Also, some sections are divided into subsections giving detail of all the steps that were followed to create our high performance Poker player. Page 5 Gp-gxk2 Group Project May 2002 2. Introduction Initial Problem In this section of the report we will describe the initial task that was set for our Group project at the beginning of the academic year. Texas Hold 'Em (gp-gxk2) This year Dr Kendall is supervising two projects but both groups will be given the same project and will have to produce a piece of software that competes against the other group and, potentially, other players as well. The competition will take place at some time convenient to ourselves (possibly the open day). The group that wins this competition will be awarded a prize of £75. Your task is to develop an automated poker player that plays "Texas Hold 'Em". This is the variation of poker used in the World Series of Poker played in Las Vegas each year. At the end of the project I will arrange a competition so that the two groups can play against each other (and possibly other players) to see which group can win most (or lose less!!) chips. The group that wins this competition will be awarded a prize of £75. The competition will take place at www.paradisepoker.com, on one of their Texas Hold 'Em play tables (so you should use this as a test bed). When we run the competition we will choose a table to play at (which could have other players as well), both players will start with the same number of chips (which I will announce just before we start) and we will play for a given time period (which I will announce just before we start). Whilst the competition is underway you are not allowed to change the way the automated player plays. You are only allowed to enter commands that keeps it informed of the game status and allows it to decide what to do. As well as playing a legal (and hopefully good!!) game of poker your project should also be graphically pleasing. The graphical display should also, of course, represent the current state of the game accurately. The method you use to play poker is up to you (e.g. rule based, mathematical, heuristics, evolutionary etc.). At the start of the project I will give both teams an identical set of notes that you can use to start your research. Note - Any changes that were made to this problem description will be declared later in the report. Brief Introduction Past research efforts of the Artificial Intelligence community have concentrated on building high performance computer game programs where conditions of certain information, performance and progress can easily be measured. This was first achieved by the ‘Deep Blue Victory’ over the World Chess Champion ‘Garry Kasparov’. The success that was achieved by this program is due to the ‘Brute Force Search algorithm’. As the correlation of search speed to program performance was faster this allowed the program to succeed [ref 1]. However, in recent years, a number of interesting games have attracted the attention of the AI researchers such as ‘Poker’ and ‘Bridge’. These games have been avoided in the past as they have imperfect information (they have hidden information, unknown to opponents). Therefore, the ‘Brute Force Search’ was not successful in this area as it searches game trees hence it works for perfect information games (no hidden factors). However, Poker has a number of attributes that make it an interesting domain. These attributes include: Page 6 Gp-gxk2 Group Project May 2002 • Multiple competing agents (more than two players), • Imperfect knowledge as the opponent hold hidden cards, • Risk management that involve different betting strategies and consequences, • Agent modelling, allowing the player to identify patterns in the opponent strategy and exploring them, • Deception, which could be bluffing and dealing with unreliable information. All of these attributes are challenging dimensions to a difficult problem that attracted the computing community [ref 2]. Research started on this area few years ago, but up until now, programmers could not build a program that can play a world championship game. This is due to two reasons, firstly, the limitation of the program and the complexity of the game activities and secondly most of the research has been done on a simple type of game that includes only two players only and one round of betting. However, research continues in the field of creating a high performance Poker playing program. The remainder of this report will show the work done by our group to complete the task of building an automated Poker Player. Page 7 Gp-gxk2 Group Project May 2002 3. Research We as a group felt that this section was a very important part of the project, as it is vital that we all the facts about poker before we get stuck in to the project. Various areas of research needed to be carried out, including everything from the history of Poker to the AI modelling of Poker. Also, many members of our group had never played poker before this project was started, meaning we had to learn how to play Poker before we got started on the project to gain a better grasp of the task in hand.