• 沒有找到結果。

Theory of Computer Games (Fall 2020) Homework 2

N/A
N/A
Protected

Academic year: 2022

Share "Theory of Computer Games (Fall 2020) Homework 2"

Copied!
21
0
0

加載中.... (立即查看全文)

全文

(1)

Theory of Computer Games (Fall 2020) Homework 2

NTU CSIE

Due: 14:20 (UTC+8), December 24, 2020

(2)

Game Description

Outline

1 Game Description

2 Homework Requirements

3 Submission and Grading Policy

(3)

Game Description

Einstein W¨ urfelt Nicht! (Dame)

Game Rules

1 The game is played on a 6x6 board. Initially, there are 6 red and 6 blue pieces located at top leftandbottom rightconsecutively.

2 The initial pieces configuration is random.

3 In a turn, player can move any piece of its own one square forward in one of thethree directions closer to the opponent’s corner.

4 A player can capture other pieces by landing on their square and then replacing them. Note that a player is allowed to capture a piece of its own.

5 A player can pass if and if only there is no legal move available

(4)

Game Description

Terminal Condition

The game is over when:

1 If the last redpiece is captured, blueplayer wins

2 If the last bluepiece is captured, redplayer wins

3 If sixred pieces reach corner, red player wins

4 If sixblue pieces reach corner, blueplayer wins

5 If all remainingblue pieces and all remainingredpieces reach corner, If number of red pieces is greater than blue pieces,redplayer wins If number of blue pieces is greater than red pieces,blueplayer wins If number of blue pieces is equal to red pieces, player with highest corner piece number wins

If number of blue pieces is equal to red pieces and SouthEast and NorthWest corner have the same piece number, then it is adraw

(5)

Game Description

Terminal Condition

A player has reached corner when all of its remaining pieces:

Cannot capture opponent’s piece Cannot move to an empty square

5 Blue pieces same number of no red pieces at corner pieces, 4 > 3 left

Blue won Blue won Blue won

(6)

Game Description

Einstein W¨ urfelt Nicht! (Dame)

Initial board Blue can only capture Blue won!

Red: E, S, SE its own piece Blue: W, N, NW

(7)

Game Description

Let’s Play

Compilation

Run make under hw2 directory.

It’ll generate 4 executables: game, random, conservative and greedy.

game is the main gaming environment, while the others are baseline agents.

How to Play

The game supports AI-AI, AI-human and human-human mode.

You can choose which mode to play by specifying [-f] (first player) and/or [-s] (second player).

For example, the following command runs random and vs human mode

$ ./game -f ./random

(8)

Homework Requirements

Outline

1 Game Description

2 Homework Requirements

3 Submission and Grading Policy

(9)

Homework Requirements

Requirements

HW Requirements

1 Implement an agent of modified Einstein W¨urfelt Nicht! (Dame) using Monte-Carlo Tree Search.

2 Beat the conservativeAI and thegreedy AI.

3 Analyze the performance of your agent

(10)

Homework Requirements

Part I: Einstein Agent

Basic Requirements

1 Write an agent that receives opponent’s last move (from game) and sends move accordingly back.

2 We’ve handled most parts of the communication. Receive messages byreading from stdin and send messages bywriting to stdout.

3 Read everythingcharacter-by-character: if you expect a message of length k, read one character k times instead of directly reading a string of length k.

4 Remember to flushevery time after writing a message to stdout.

(11)

Homework Requirements

Part I: Einstein Agent (Cont’d)

Basic Requirements

1 You can assume that every move your agent receives is valid.

2 Your agent should send a valid move within 10 seconds. If game receives an invalid move, or doesn’t receive a move within the time limit, your agent will be killed and your opponent wins immediately.

(12)

Homework Requirements

Message Format

Message Format R: Received, S: Sent

R1: 12 characters that denote initial pieces configuration, e.g.

345120345120 (see illustration) R2: A single character

’f’: you are thefirst player

’s’: you are thesecond player

R3: 2 characters, can be ”--” (pass) or nd (otherwise), where n = number of piece to be moved

d = direction: 0 (vertical), 1 (horizontal), 2 (diagonal) S : 2 characters, can be ”--” (pass) or nd (otherwise) only.

(13)

Homework Requirements

Frame of an Agent

1: while True do 2: receive R1, R2

3: B ← Board(R1)

4: myTurn ← R2==”f” ? True : False 5: while True do

6: if B.terminal() then

7: break

8: end if

9: if myTurn == False then 10: receive R3

11: do opponent’s move R3on B 12: else

13: choose a move S 14: do the move S on B

15: send S

16: end if

17: myTurn ←!myTurn 18: end while

19: end while

(14)

Homework Requirements

Algorithms

1 You are required to implement the following algorithms:

UCT tree searchwith tree expansion based on UCBscore Addat least oneof Progressive Pruning (PP) or RAVE

2 Singe core, and no more than 4GB RAM

3 You can add plug-in learning + training data, but the training needs to be done by TA in 30 minutes using hardware described above

4 Your agent will be tested by

$ ./game -f [your agent] -s [our agent] -r 5

(15)

Homework Requirements

Part II: Agent Performance Analysis

Report Structure

Your report should include but not limited to:

1 Implementation

How tocompile and runyour code in linux. Don’t upload the compiled executable file.

What algorithm and heuristic you implemented.

2 Experiments

Results and findings of your implementation

3 Discussion

Observe your refinement on UCT tree search and (PP/RAVE), try to measure the improvements.

(16)

Submission and Grading Policy

Outline

1 Game Description

2 Homework Requirements

3 Submission and Grading Policy

(17)

Submission and Grading Policy

Submission

Directory hierarchy:

student id// e.g. r08922166(lowercase) Makefile// make your code

src// a folder contains all your codes report.pdf// your report

Compress your folder into azip file and submit to https://www.csie.ntu.edu.tw/˜tcg/2020/hw2.php.

Due to server limitation, the file size is restricted to2 MB.

(18)

Submission and Grading Policy

Grading Policy

1 Beat the baselines (10 points)

BeatSimple Conservative Agent(SCA) (5 points) BeatSimple Greedy Agent(SGA) (5 points)

2 Report (5 points)

3 Bonus

DominateSimple Greedy Agent(SGA) Peer competition

BeatHidden Benchmark

(19)

Submission and Grading Policy

Beat the Baselines

One round consists of 2 games with alternating first player.

We will calculate the total net score of 5 rounds between your agent and the baseline agents

You can get S , S ∈ {−2, −1, 0, 1, 2} score for each round Win: +1 point

Draw: 0 point Lose: −1 point

We consider total net score no less than zeroas beating the baseline.

(20)

Submission and Grading Policy

Bonus

Dominate SGA

Get total net score of strictly more than 2 when playing againts Simple Greedy Agent (SGA) in 5 rounds (+1 point)

Peer Competition

N = number of HW participants.

We will host a 5-round game between each participant.

Get net score strictly more than 5 × (N − 1) (+1 point).

Top K agents will be awarded more points, where K will be decided later, based on the results.

(21)

Submission and Grading Policy

Bonus

Beat Hidden Benchmark

You will have 3 rounds to fight the hidden benchmark.

W = net score after 3 rounds

Additional bonus points of min(max(W , 0), 3)

參考文獻

相關文件

Other vegetables, prepared or preserved otherwise than by vinegar or acetic acid, frozen, Other than products of heading No. adzuki bean, all varieties and red long bean),

If he divided them equally into several groups, each group has the same number of pieces of blue paper and green paper respectively and no paper is

obtained by the Disk (Cylinder ) topology solutions. When there are blue and red S finite with same R, we choose the larger one. For large R, it obeys volume law which is same

OGLE-III fields Cover ~ 100 square degrees.. In the top figure we show the surveys used in this study. We use, in order of preference, VVV in red, UKIDSS in green, and 2MASS in

2-1 註冊為會員後您便有了個別的”my iF”帳戶。完成註冊後請點選左方 Register entry (直接登入 my iF 則直接進入下方畫面),即可選擇目前開放可供參賽的獎項,找到iF STUDENT

In this regard, by focusing on three types of poems, including Nanyue Mountain Living Poetry (25 pieces of “Random Poems of Nanyue Mountain Living,” 8 pieces of “Mountain

ix If more than one computer room is opened, please add up the opening hours for each room per week. duties may include planning of IT infrastructure, procurement of

Two cross pieces at bottom of the stand to make a firm base with stays fixed diagonally to posts. Sliding metal buckles for adjustment of height. Measures accumulated split times.