Skip to content

MrHappyOne/Machine-Learning-Checkers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

I made this for my high school science fair. 

Email: takeabyteoutofthis@gmail.com

It uses a simple alpha beta pruning algorithm to find the "best" move, based on the score. Although currently it is still a little buggy and can't really beat a human.

Most of the algorithms are in the 'Logic' class. 

There are a methods that are not being used at the moment, but will hopefully be finished one day.
  Game.learn()
  Game.learnLoop()
  Game.checkDir()

In addition 'FileSystem.java' is not being used at the moment.

Those methods and class were going to be used to make a learning mode. The learning mode would have the AI play games against its self and record them. However at the moment this is not practical, because with the current state of the algorithms in 'Logic.java' the AI would always make the same moves. This could be solved by adding randomness.

Here are some future improvements:
- Improve the alpha beta pruning algorithm (Logic.getBestMove()) and the scoring algorithm (Logic.getScore()) to favor       taking pieces. (Started in 0.02)
- Improve the GUI: no more need for console, draggible checkers pieces, and game history/past moves viewer.
- Implement learning mode (read paragraph above).

-- Logic.getScore() && Logic.AnalyzePiece()
The current scoring algorithm favors pieces that are close to kingship, if the piece are on either edge of the board (column 1 & 8), and how many possible moves it has.

--------------------------
Version History

----
0.05
----

Overall:
  - Saving and loading games works.
  - Added some checks to getBestMove.
  - Key controls for GUI. No more terminal needed! (arrow keys control selector, enter selects tile, backspace deselects tile, a displays info about piece in terminal).
  - Adjusted scoring formual.
  - Added selector class.
  - Resized board.

Glitches
  - Key controls can glitch out, but doesn't crash game.
  - Random move is a little glitchy.

----
0.02
----

Helper.java
- added getPossibleAttacks() to Helper and intergreted it in the scoring algorithms.
- added provision to checkSquare() to make sure move is within the bounds of board.
- added provision to isLegal() to check if move is within bounds of board. This prevents the app from crashing if the user provides failty piece coordinates.

Logic.java
- Modified scoring algorithm to consider the possible attacks.
- Modified bestMove() to start to consider future moves (this is not fully implemented yet).

Canvas.java
- shows score on top of pieces in GUI.

Summary:
The intelligence and its decision making has greatly increased. It is now less likely to make stupid moves.

About

I made this for my high school science fair project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages