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

Function notify

bot-human-tictactoe/script.js:7–30  ·  view source on GitHub ↗
(player,states)

Source from the content-addressed store, hash-verified

5var O_human = false
6const player_controller = (()=>{
7 const notify =(player,states)=>{
8 if(player==PLAYER_X){
9 if(!X_human){
10 //wait for 1 second
11 setTimeout(()=>{
12 let move = agent.pickMove(states, PLAYER_X)
13 let pos = move['i']*3+move['j']
14 cells[pos].select()
15 gameBoard.select(pos)
16 },250)
17 }
18 }
19 else{
20 if(!O_human){
21 //wait for 1 second
22 setTimeout(()=>{
23 let move = agent.pickMove(states,player)
24 let pos = move['i']*3+move['j']
25 cells[pos].select()
26 gameBoard.select(pos)
27 },500)
28 }
29 }
30 }
31 return {notify}
32})()
33const agent = (()=>{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected