# report代做 | Algorithm作业 | 代写java | 作业scheme | Python | pygame | AI | assignment – CS 4386 Assignment 1

### CS 4386 Assignment 1

report代做 | Algorithm作业 | 代写java | 作业scheme | Python | pygame | AI | assignment – 这个题目属于一个Algorithm的代写任务, 包括了report/Algorithm/java/scheme/Python/pygame/AI等方面, 该题目是值得借鉴的assignment代写的题目

#### 1 Game Rules

There are two players in this game. In each turn, a player can put a chessman in the specified empty cell of the 6*6 board (player 1 is only allowed to put it in the black box, and player 2 is only allowed to put it in the white box). Any player who can connect 3 or 6 adjacent chessman (color does not matter) in a row/column ( no diagonal ) will get 3 or 6 points respectively. The game ends when all the cells are taken by players and the player who gets higher points is the winner.

Case 1- 4 illustrate the rules of this game (Player 1 is denoted by green and Player 2 is denoted by red).

Case 1:

``````Step i Step i+
``````

In this case, player 1 will get 3 points in step i+1 since he connects 3 adjacent chessman.

Case 2:

``````Step i Step i+
``````

In this case, player 2 will get 6 points in step i+1 since he connects 6 adjacent chessman.

Case 3:

``````Step i Step i+
``````

In this case, player 1 will get 3+3=6 points in step i+1 since he connects 3 adjacent chessman both in row and column.

Case 4 : In each turn, a player can put a chessman in the specified empty cell of the 6*6 board (player 1 is only allowed to put it in the black box, and player 2 is only allowed to put it in the white box). If the player puts the chessman in the wrong cell, he will lose the game.

In this case, player 1 wants to put it in white cell. It is an illegal move, so he lose the game.

#### 2 Demo codes

Same code can be also found in Canvas (Files > Assignment1>CS4386_A1_forALL.zip) Note: We will keep improving the demo codes and release the updated ones on Github, which will not be much different from this version. Hence, you can start implementing your AI based on this version now. Meanwhile, if you find any bugs in our demo codes, you can ask questions on Github issues and we will fix them.

How to Run

To run the demo codes, you need to install python3.6 first. The environment tutorial can refer to Appendix: Environment Tutorial (the last two pages).

We support 3 languages for implement your AI: C++, java and Python. Python is the easiest one to implement since our server program is written in Python. Hence, we highly recommend you to use Python. If you are not familiar with Python, you can use Java or C++.

Mode 1 Human VS AI

1. If your AI is implemented by C++: cd cpp g++ AIPlayer.cpp – fPIC -shared -o aiplayer.so cd .. #if you want the Human play first, use python3 game.py Human CPP 1 #if you want the AI play first, use: python3 game.py Human CPP 2
2. If your AI is implemented by Java: cd java javac AIPlayer.java mkdir com mv AIPlayer.class com jar cvf AIPlayer.jar com cd .. python3 game.py Human JAVA 1
3. If your AI is implemented by Python: python3 game.py Human PYTHON 1

Mode 2 AI vs AI #if you want the JAVA AI play with PYTHON AI python3 game.py JAVA PYTHON 1 #if you want the PYTHON AI play with PYTHON AI

``````python3 game.py PYTHON PYTHON 1
``````
##### How to implement your AI algorithm

Take the python version for example, you need to modify the get_move() function in AIPlayer.py. def get_move(self, state, player):

games = self.available_cells(state,player) random_move=random.choice(games) #the end of your algorithm return random_move The example returns a random move, and you should modify it using your own algorithm. If your AI fails to return a move in a long time (e.g. 10 seconds per turn), your opponent will win the game.

You can define your own variables and functions in the AIPlayer Class, but you cannot delete existing variables or functions in AIPlayer Class. Meanwhile, you cannot change the function parameters of get_move() fuction. Note: When implement your AI, you MUST NOT change game.py or gui.py.

#### 3 Scoring scheme and Requirements

Total (20 scores) = Performance of your AI + codes + report Note: Performance of your AI = whether you win the game ( 10 points for winner and 0 for loser) + your obtained points. In addition to the points you win against others, we will also grade you based on the quality of your algorithm.

1. Requirement for the codes: At the beginning of your file (AIPlayer.cpp or AIPlayer.java or AIPlayer.py), add the following comments to your code: (replace / to # in python code) /////////////////////////////////// // CS4386 Semester B, 20 22 – 2023 // assignment 1 // Name: [Your name] // Student ID: [Your student ID] /////////////////////////////////// You only need to submit the folder for the language of your choice and directly zip it to a .zip file. We put a submission example in Canvas for your reference.

`````` Rename the zip file that contains the related files of your AI codes as
CS4386_ 2223 B_[studentID].zip , where [studentID] is your student ID. You need to
submit this zip file to Canvas.
``````

#### 4 Q&A

We have created a discussion on CANVAS. You can ask questions there and the TAs will check it everyday and answer your questions as soon as possible.

The DDL for this assignment is 17 th March.

#### Appendix: Environment Tutorial

We suggest you to use anaconda to run this assignment. And here are 4 steps for you to run Assignment2.

In the following, we take the windows users for example since the case is more complex compared with Linux/MacOS users. For windows users, you can download Anaconda3-5.2.0-Windows- x86_64.exe.

After downloading it, you can install anaconda3 by double clicking the .exe file and remember the installation path (you can refer to https://zhuanlan.zhihu.com/p/61639212). After installation, you need to check that your environment path contains the path of anaconda.

Then you can open the anaconda prompt:

You can use the following command to see the version of anaconda3: conda –version

Step2 create env You need to create an environment for running this assignment. The command is: conda create -n cs4386 python=3.

Then you can activate this env by: conda activate cs

Step3 install packages To install jpype1: pip 3 install jpype

Same to install pygame: pip 3 install pygame Step4 run A 1 You can use the provided commands to run this assignment: python3 game.py Human PYTHON 1