IMPLEMENTATION DETAILS In the study materials, you can find the following files: tournament.cpp: the main code which simulates the tournament tournament.h: the header file which you should include in your cpp file sampleAIs.cpp: 4 examples of simple (and not very good) AIs You are expected to submit a cpp file similar to one of the 5 parts of sampleAIs.cpp. In particular, you implement the SOLUTION structure, which consists of 4 items: Name: the name of the strategy (e.g. your surname(s)) ShortName: the name shortened to 7 characters Init: You may implement an initialization function to do some precomputation and/or initialize your memory. This function will be called only once at the very beginning of the tournament. AI: This function is called every time you are to decide, and also after the showdown to inform you what the opponent has rolled. The parameters are: op: the id of the current opponent b: the current value of the game parameter B (how many chips a player bets) state: the current state of the "hand": an even number means that you are the first player (small blind), an odd number means that you are the second player (big blind); 0, 1 means you are to decide what to do; 2, 3 means your opponent has folded; 4, 5 means the game has come to a showdown d: when state = 0, 1, it says what you have rolled; when state = 4, 5, it says what your opponent has rolled The return value: zero means you want to fold, non-zero means you want to bet/call (relevant only when state = 0, 1; otherwise ignored) FURTHER IMPLEMENTATION NOTES Please, declare all your global variables and functions (except the SOLUTION structure) as static so that their names do not collide with variables/functions of others, or enclose them within your own namespace. We advise you not to use dynamic allocation (which would tremendously slow down your program) and use global variables/arrays instead. You may call rand to make your strategy non-deterministic. Do not call srand (the seed setting function), that is our responsibility. The return value of the AI function is irrelevant when state >= 2, but DO return a value even in this case; otherwise the behavior is undefined and the program may crash. In C/C++, all global memory is set to zero at the beginning of execution. This means you do not have to implement the initialization function at all if the only thing it would do is zeroing your global variables. Your implementation should satisfy the following: it uses no more than 64 MB of memory the initialization function runs within 10 minutes the average running time of the AI function is under 1 microsecond (i.e. asymptotically constant time) If you have any further questions regarding the rules of the tournament or the specification, please look into the files. If you do not find the answer there, ask in the forum. DEADLINES There is a soft deadline on 12 December. By this day, you should submit an almost-final solution. We will look at it and tell you that it is OK or that there is some serious problem (it sometimes crashes, uses too much time/memory, ...). We will try to give you the feedback by 15 December, so that you have about a week to fix/finish it. The hard deadline is on 22 December. MINIMAL REQUIREMENTS You must put a reasonable amount of effort into coming up with a sophisticated strategy and implement it. In particular, your strategy must be more sophisticated than the sample ones. On the other hand, we will not penalize you for a strategy that is based on a complex idea, correctly implemented, but turns out to be very poor in the tournament. WHAT YOU ARE STRONGLY ENCOURAGED TO DO The tournament will be a society of miscellaneous strategies, so it is definitely a good idea to write a strategy that varies its behavior in response to the behavior of the opponent. You might even guess what strategies the others (or we) are going to write and write a strategy that is optimal against them. However, the sample AIs will not take part in the tournament, so if you write a strategy that tries to identify the behvaior and then play optimally against that, it will probably not yield any further points. Still, it may be a good idea to write such a strategy and run a practice tournament for yourself, just to make sure your ideas and implementation are correct. WHAT YOU ARE STRONGLY DISENCOURAGED TO DO There is a simple way to win the tournament if two programs cooperate: Program A plays some predetermined sequence in the first (say) 100 moves and then plays some very good strategy. For each opponent, program B looks at the first 100 moves of the opponent, and if they match the predetermined sequence, it plays so that the opponent gets as many points as possible, while if they do not match, it plays so that the opponent gets as few points as possible. Of course, this is considered cheating. You must not cooperate with other students anyhow.