• 沒有找到結果。

TCG HW2 Description

N/A
N/A
Protected

Academic year: 2022

Share "TCG HW2 Description"

Copied!
12
0
0

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

全文

(1)

TCG HW2 Description

November 30, 2013

(2)

HW2 Description

Implement the 7 × 7 kill all go.

Require: UCB, UCT and progressive pruning.

Bonus: other techniques.

Grading policy:

Implement the basic requirement.

Pass the test data.

(3)

Basic Command

reset: reset game.

time i: set the thinking time.

put b/w x y: put the b/w piece at (x, y)

if the game is start, the put is recorded.

display: show the current game board.

start game: start the game

all the move after this command is recorded.

think b/w: make a move of b/w

only work after game is start

quit: end the program.

(4)

About the Template Code

The variable in the template code is naming as follows:

Define constant: all upper letters.

BOARDSIZE, BOUNDARYSIZE.

Array: Initial character is upper letter.

Board, MoveList

Non-array variable: all letter is lower case There are two exceptions, X and Y.

game length, num legal move

(5)

Board structure:

Board[BOUNDARYSIZE][BOUNDARYSIZE]

0 1 2 3 4 5 6 7 8

0 * * * * * * * * *

1 * . . . . . . . *

2 * . . . . . . . *

3 * . . . . . . . *

4 * . . . . . . . *

5 * . . . . . . . *

6 * . . . . . . . *

7 * . . . . . . . *

8 * * * * * * * * *

BOUNDARYSIZE: 9 BOARDSIZE: 7

Board[i][j] is (x,y) = (j, 8-i) in the game board

(6)

Think Function

gen legal move(Board , turn, game length, GameRecord , MoveList)

generate all the legal move return the number of legal moves.

random pick move(num legal moves, MoveList)

randomly pick one legal move

return the selected move.

do move(Board , turn, move)

update the current board with “move“

(7)

gen legal move Function

For each empty intersection

Check if the empty intersection is a legal move Check if the legal move will result in a repeat board Add the move to move list.

each move is a 3 digit integers eij

e denote this is a capture move (1) or not (0).

ij denote the location of Board[i][j]

e.g. 123: put stone in Board[2][3] is a capture move.

e.g. 056: put stone in Board[5][6] is not a capture move.

(8)

Function for Checking Legal Move

count neighboorhood state(Board , X , Y , turn,

∗empt, ∗self , ∗oppo, ∗boun, NeighboorhoodState)

return the number of

Empty intersection Self intersection Opponent intersection Boundary intersection

Record the state of each neighborhood in NeighboorhoodState.

count liberty (X , Y , Board , Liberties)

count the number of liberties in each direction’s string.

The result is saved in Liberties.

Using DFS method.

(9)

Legal Move

A move is legal if

At least one neighborhood intersection is empty.

One of the self string has more than one liberty.

One of the opponent string has only one liberty.

(10)

Do the move

update the Board with put b/w piece at (x, y) update board(Board, X, Y, turn)

put turn’s piece in (X, Y)

will not check if (X, Y) is a legal move.

update board check(Board, X, Y, turn)

put turn’s piece in (X, Y)

will check if (X, Y) is a legal move.

return 1 if (X, Y) is a legal move return 0 if (X, Y) is a inlegal move

(11)

Avoid the repeat board

GameRecord[MAXGAMELENGTH][BOUNDARYSIZE][BOUNDARYSIZE]

game length

Check the all the board in the GameRecord.

(12)

Random Select a Move and Do the Move

Randomly choose one of the legal move.

Update the current board.

參考文獻

相關文件

opinion mining, sentiment analysis, language modeling, legal blogs, test

Prove that the distance between any two vertices of a connected graph G (that is, the length of a shortest walk between these vertices) is less than the number of distinct

Legal: Adobe, the Adobe logo, and InDesing are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries. All

Move fast and try not to make the elastic band fall on the ground.. Now move with the

使用會員應確保裝運前檢驗機構在出口商首度與其接觸時,即提供出口商一

Some of the commodities under this item subject to legal import inspection announced by the Bureau of Standards, Metrology and Inspection, ministry of

Plant, Roger (2012), Draft Report on the Application of International Legal Instruments of Human Trafficking and Forced Labour: A Case of Taiwan,

The inflection points, absolute minimums, and -intercepts all move farther from the origin as 