Question: . Using pseudocode, write a simple algorithm to check for a winner in a game of noughts and crosses. The board is represented by a

 . Using pseudocode, write a simple algorithm to check for a

. Using pseudocode, write a simple algorithm to check for a winner in a game of noughts and crosses. The board is represented by a 2-dimensional array: Grid (3,3) int The blank squares have a value of zero, while an X is +1 and an O is -1. Your algorithm will traverse the three rows, three columns and two diagonals looking for a line of three (O or X), at which point it will stop and return the winner (O or X). Otherwise it will return N for no winner or S for stalemate (the grid is full but no winning lines)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!