Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment to create new AI agents #42

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Pabloo22
Copy link

@Pabloo22 Pabloo22 commented Mar 8, 2021

The purpose of this changes is to have a more appropiate and tidy environment to develop new AI agents. It also contains an agent based on minimax algorithm.

New files

  • game_AI_vs_AI: this file allows us to spectate a game between 2 agents
  • agents: where all the different agents will be implemented. It contains an agent based on minimax algorithm wich uses a original heuristic based on the Odd-Even strategy of connect4. It also contains a random agent.

New feautures:

In ConnectGame:

New methods:
  • make_movement
  • play_game
  • compare_agents

In GameBoard:

The changes made in this class have two objectives. The first one is to improve efficient (very useful for the future AI agents).
The second one is to be able to know which squares verified that if a player had a piece in a given coordinate he would win (win squares). This will be very useful for future AI agents that calculate the heuristic of a board .

New attributes
  • slots_filled. It makes more efficient to calculate ties
  • p1_win_squares and p2_win_squares. A set with the coordinates of the win squares.
Methods changed
  • drop_piece
  • horizontal win
  • vertical win
  • diagonal win
  • winning move
  • tie move
New methods
  • is_valid_coord
  • _set_horizontal_win_squares
  • _set_vertical_win_squares
  • _set_diagonal_win_squares
  • _set_win_square
  • _analyze_square

In GameData:

New attributes
  • winner

@bymayanksingh
Copy link
Owner

I will let you know about this PR asap.. have few things on my plate as of now.. btw thanks for the effort :)

The MinimaxAgent uses also the alpha  beta pruning to improve the speed. I have also made some changes to have a cleaner code in other files and some improvements in the compare_agent method of ConnectGame.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants