Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //tests draw function with X's and O's
- //tests random boards for each win occurance
- var myGame = MiniBingo();
- i=0;
- while(myGame.IsGameOver() != true){
- var randomNum = Math.floor(Math.random() * 9) + 1
- if (i%2 == 0 && myGame.IsValidMove(randomNum) == true){
- //myGame.MakeMove('O', randomNum);
- i++;
- }
- else if (myGame.IsValidMove(randomNum)){
- myGame.MakeMove('X', randomNum);
- i++;
- }
- }
- console.log("A valid Bingo Has Occured: " + myGame.IsWon('X'));
- if (myGame.IsWonDiagonal('X') === true)
- console.log("Bingo Diagonally.");
- else if (myGame.IsWonHorizontal('X') === true)
- console.log("Bingo Horizontally.");
- else if (myGame.IsWonVertical('X') === true)
- console.log("Bingo Vertically.")
- else if (myGame.IsWonCorners('X') === true)
- console.log("Bingo Corners.")
- else if (myGame.IsWonPostageStamp('X') === true)
- console.log("Bingo Postage Stamp.")
- myGame.PrintBoard('draw');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement