ConnectFour Game (Python代写,Algorithm代写,北美程序代写,美国程序代写,Gettysburg College代写)

In this assignment you will implement an agent to play the game of Connect 4. Your agent will use the alpha-beta search algorithm and the expectimax search algorithm to select the next move given the current board state.

联系我们
微信: biyeprodaixie 欢迎联系咨询

本次CS代写的主要涉及如下领域: Python代写,Algorithm代写,北美程序代写,美国程序代写,Gettysburg College代写

ConnectFour Game

Description

In this assignment you will implement an agent to play the game of Connect 4. Your agent will use the alpha-beta search algorithm and the expectimax search algorithm to select the next move given the current board state.

There are two main files: ConnectFour.py Player.py

ConnectFour.py contains all functions of the game. Player.py contains all types of players that can participate in the game: AIPlayer (Your Implementation) RandomPlayer (Chooses from valid columns with equal probability) HumanPlayer (You)

You need to implement all of the following functions: def get_alpha_beta_move(self, board) def get_expectimax_move(self, board) def evaluation_value(self, board)

These functions serve as a high-level abstraction for interacting with a player. You will likely need to implement other functions in the class to make your code modular and readable. Note that it will likely be too expensive to explore the entire game tree at the beginning of the game so a depth-limited search is a good place to start. To play the game you need to run “python ConnectFour.py arg1 arg2” where arg1 and arg2 are one of AI, random, or human.

For example if you wanted to play against a random player you would run “python ConnectFour.py human random”

If you wanted your AI to play itself you would run “python ConnectFour.py ai ai”

ConnectFour.py takes one optional argument --time that is an integer. It is the value used to limit the amount of time in seconds to wait for the AI player to make a move. The default value is 5 seconds. Note: A human player has to enter their move into the terminal.

Here is the award winning GUI that comes included:

The top text displays the player making the next move. The well-drawn circles in the middle are the places on the game board.

The next move button does exactly what you expect, it moves the game forward by one move.

When the game is over the top text will change to the name of the winning player and 'wins!'

Shown below is an example where I managed to get the best of a Random player:

Deliverables

You will turn in 2 files:

  1. Player.py: this should include your alpha-beta search algorithm and expectimax search implementations in the AIPlayer class
  2. Assignment1.pdf: addresses the following questions:
    1. What heuristic did you use? Why?
    2. Describe how your algorithm performs given different time constraints. How much of the tree can you explore given 5 seconds per turn? 10 seconds? 3 seconds?
    3. Can you beat your algorithm? What is your strategy?
    4. If your algorithm plays itself, does the player that goes first do better or worse in general? Share some of the results.