MCPcopy Create free account
hub / github.com/codemistic/Web-Development / select

Function select

bot-human-tictactoe/script.js:152–166  ·  view source on GitHub ↗
(num)

Source from the content-addressed store, hash-verified

150 let _currPlayer = PLAYER_X
151 const isGameOver = ()=> _gameOver
152 const select = (num)=>{
153 // console.log(num);
154 if(_currPlayer==PLAYER_X){
155 _state[Math.floor(num/3)][num%3] = 1
156 _currPlayer = PLAYER_Y
157 }
158 else{
159 _state[Math.floor(num/3)][num%3] = -1
160 _currPlayer = PLAYER_X
161 }
162 validateBoard()
163 if(!_gameOver)
164 player_controller.notify(_currPlayer,_state)
165
166 }
167 const getChar = ()=>{
168 if(_currPlayer==PLAYER_X) return 'X'
169 else return 'O'

Callers

nothing calls this directly

Calls 1

validateBoardFunction · 0.85

Tested by

no test coverage detected