MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / playTicTacToe_fiveInARow

Method playTicTacToe_fiveInARow

code/main/ATree.ts:316–342  ·  view source on GitHub ↗
(x1: number, y1: number, x2: number, y2: number)

Source from the content-addressed store, hash-verified

314 }
315
316 private playTicTacToe_fiveInARow(x1: number, y1: number, x2: number, y2: number): ATreeTicTacToeSign{
317 // Variables
318 var column: number = x1;
319 var row: number = y1;
320 var counter: number = 0;
321 var currentSign: ATreeTicTacToeSign = null;
322
323 while(column >= 0 && column < 5 && row >= 0 && row < 5){
324 if(this.ticTacToeBoard[column][row] != ATreeTicTacToeSign.NO_SIGN){
325 if(this.ticTacToeBoard[column][row] != currentSign){
326 currentSign = this.ticTacToeBoard[column][row];
327 counter = 1;
328 }
329 else
330 counter++;
331 }
332 else counter = 0;
333
334 if(currentSign != null && counter == 3)
335 return currentSign;
336
337 column += x2;
338 row += y2;
339 }
340
341 return null;
342 }
343
344 private playTicTacToe_tryAgain(): void{
345 this.startTicTacToe();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected