Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl Yogi authored and Karl Yogi committed Aug 5, 2016
1 parent cbefb63 commit 2d09028
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# tttengine
tic tac toe game engine. This work as a js library.

# Jobs
- maintain the game logic, like this is A's turn, then B's turn.
- check player's move is legitimate
- web appearance callback

# Functions
chooseRole(v)
## board.chooseRole(v)
Use this function to define which player do you want to choose. You can choose 'x' or 'o'.


## board.move(i)
Use this function to define the next move you want to take. 'i' should between 1~9. Although engine will not allow you cover ocuppied shape, try not to be dummy.

move(i)
## board.getStatus()
Use this function to get the status of the board. It will return an array which be like ["o", "o", "-", "-", "-", "x", "x", "-", "-"].

getWinner()
## board.isEnd()
Use this function to check if the game is end.

# Thanks
Tic Tac Toe front-end framework by the courtesy of Ricky.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

function yourAI() {
//***** start your AI code inside ******//
console.log(board.getStatus());
// Demo right now
while(board.currPlayer == board.selectedPlayer)
{
Expand Down

0 comments on commit 2d09028

Please sign in to comment.