Commit Graph

16 Commits

Author SHA1 Message Date
Woody Folsom
d0ee1e647b Implemented agent which chooses to play winning, losing or random moves by solving a simplified MDP model of the game using policy iteration.
Portions of MDP/solver code by Ciaran O'Reilly and Ravi Mohan used under MIT license.
2012-04-30 13:35:40 -04:00
Woody Folsom
21e5d89447 Implemented naive Monte Carlo move generator (simulates 10 random moves for 3 turns by each player).
Consequently, it performs strictly worse than Alpha-Beta, but usually avoids setting players up for an easy capture,
unlike Alpha-Beta.
2012-04-29 14:59:25 -04:00
Marshall
1eebacf963 - Diagonal lines are no longer removed. 2012-04-29 12:45:49 -04:00
Woody Folsom
c53ff75ea4 Added configurable computer player - use 'com=random', 'com=minimax' etc as cmd-line args.
Default is AlphaBeta.
Updated ActionListener for UserChooserFrame so that selecting from the list (or typing a new name and pressing RETURN) also triggers the action.
Added the player and computer algorithm names to the title bar e.g. "Bob vs. Alpha-Beta".
2012-04-29 10:18:15 -04:00
Marshall
15ed56134e - Implemented multiple users, including a selection dialog and automatic preference saving and loading.
- Integrated the ANN with the game. The network now predicts a user move, completely ignores it, and trains itself on the players actual move. This integration also included implementing two new functions. The first translates a board state to a boolean array to correspond with input nodes. The second translates a move to a boolean array to correspond with output nodes.
2012-04-29 03:22:19 -04:00
Marshall
a6af6df132 - Reorganized packages so that the computer agents are inside the model package.
- Added support for the player model inside Referee.java; high scores should now persist over a single execution of the program.
- Refactored PlayerModel.java to support game logging. All games are now logged so that we can track overall progress.
- Added scaffolding to allow saving and importing of PlayerModel.java. It is not yet functional, but it will be with two function implementations and then the appropriate calls.
2012-04-28 19:18:28 -04:00
Marshall
1a4c6d865b - Finished HighScoreDialog.java. Now the player can play the game repeatedly. 2012-04-28 16:24:45 -04:00
Marshall
24096b50a8 - Updated the Node interface and its implementations to include a strength() function. This is a double value between 0 and 1 representing the percent activation.
- Updated the PlayerModel to fix a bug in the high score tracking.
- Created HighScoreDialog.java, which displays the high scores from a PlayerModel. In the future, it will have a "New Game" button so that it can be used to transition between games.
2012-04-26 13:04:41 -04:00
Woody Folsom
d9ec72d0fb Alpha-Beta move generator can look 2 plays (4 plies) ahead on a 4x4 board and blocks every possible attempt by the player to connect 3.
It should be possible to play on larger boards when the computers 'move' is changed from playing a tile to picking the player's next available color.
2012-04-14 15:36:02 -04:00
Woody Folsom
74b8eb4622 Revampled MainFrame layout to improve appearance/usability when the number of tiles is very large or small.
Fixed instantiation where a new MouseListener was used to each tile - now only one is used for all Tiles.
Fixed issue where the MouseListener was being added to each tile twice.
2012-04-14 12:02:17 -04:00
Woody Folsom
9619f9a96d Incremental updates. Work in progress to augment Board, Referee, add score for computer player, implement Monte-Carlo simulation.
Renamed Player implementations and changed Player to interface, with the goal of using abstraction to make the human and computer interactions with the game identical for ease of simulation.
2012-04-08 17:25:10 -04:00
Woody Folsom
e0f42531e7 Replaced having 1 MouseListener per Tile JLabel which a single listener which asks the event's associated component for its row, column.
This isn't ideal, but is preferable to putting this information in each of rows x columns different mouse listeners.
Also added a title to the MainFrame.
2012-04-04 17:31:50 -04:00
Woody Folsom
b8df412740 Removed use of Refreshable and replaced with several methods which update the GUI using SwingUtilities.invokeLater().
While not as clean as using ChangeListener, it completely decouples the Model and View aspects,
and also avoids the need to manually paint() a hierarchy of components (a task best handled by Swing/AWT).
2012-04-04 17:15:21 -04:00
Woody Folsom
0f616a3cc6 Continuing gradual process of collecting state from various GUI components and handlers and aggregating it in PlayerController.
Removed references to Refree from some handlers, replacing them with direct use of PlayerController (Law of Demeter).
2012-04-04 15:31:27 -04:00
Woody Folsom
02c4986c30 App can now be built using Ant and run from the JAR file.
Note: this requires adding the res/lib folder to the classpath in order to run in Eclipse (included in this commit).
Another commit will follow to remove build artifacts from git.
2012-04-02 13:54:55 -04:00
Marshall
521fac6e08 -The rest of the game engine. I screwed up the commit last time. 2012-03-31 14:18:08 -04:00