Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Hashed Tic Tac Toe


Full description and files here: To get experience creating and using a hashtable, and creating hash functions. Introduction Several artificial intelligence (AI) approaches for computer game playing involving creating dictionaries of possible game piece configurations and the moves which worked best for each configuration. Because the number of possible configurations is large (and some configurations are unlikely), it is not practical to create one large table of all the possible configurations. Instead, a common technique is to use a hash table to store game configurations which have been previously seen along with their likely outcomes. In this project, you will implement a simple tic-tac-toe game, using a hash table to store game configurations to play smarter. Your base program will be automatic play between two computer-controlled players -- a "smart" player that learns and a "dumb" player that chooses moves randomly. Application Setup You must have the following files, and they must obey the javadoc exactly. Note that there are several requirements stated in the file headers that MUST be followed. However, feel free to add other methods. The specified methods are not enough to solve this project. Project4: Your will have a method called play, which will take two Player objects and an int called numGames. It will play the two player objects against each other (One SmartPlayer and one RandomAI) numGames number of times. After the game, play will print a final summary of the series of games and operations of the the tic-tac-toe program must be printed when your program terminates. Your main should call play with numGames equal to a thousand. The summary must contain the following information: statistics about the hash table: number of slots, number of entries, and number of collisions. statistics about wins and losses of the players advice about the best initial move for the smart player and outcomes resulting from that move (backed up with statistics from games played). The initial move suggestion must be based on statistics aquired during the game. Example final summary output. This sample is provided to illustrate all required data. The data does not necessarily reflect expected results. Your format may vary provided it is readable and contains all required data. Sample run: run: [java] FINAL REPORT: [java] [java] The number of slots is: 267 [java] The number of entries is: 218 [java] The % full is: 81.64 [java] The number of collisions is: 1087 [java] Smart player has won 342 times which is 34 percent [java] Random has won 567 times which is 56 percent [java] My favorite first move is: [java] ... [java] .OX [java] ... [java] Won 48.0 out of 71.0 which is 67.60% Requirements and Hints You may not use any built in hashCode() function to generate the hashcode in your TicTacToe class. Everything should be in a package named proj4 All Hashtable operations should be O(1), regardless of load. Your resulting player may be bad at TicTacToe; it may be worse than random. That is still acceptable, as long as all methods are within specification. Attachments
Tags Clarifications