Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in VB write a Noughts and crosses program Noughts and crosses is two - player game on a three by three grid. Each player must

in VB write a Noughts and crosses program Noughts and crosses is two-player game on a three by three grid. Each player must get three of their symbol (X or O) in a row to win, taking consecutive turns.
The program should ask each player for a coordinate for their symbol to be placed in, then update the grid/display showing the correct symbols in place.
After each turn, the program should check if the player who has just had their go has won, congratulating them if they have.
It the game gets to the final (9th) turn without a winner, the program should inform the players that the game is a draw.
Part 1: Setup
Set up an empty grid that is displayed on the screen (this could be done by showing a three-be-three grid of dots, signifying empty squares.)
Part 2: Move
Allow the player to choose where to place their symbol (this could be done by inputting coordinates.) The symbol should then be displayed on the grid in the chosen position.
Part 3: Win, Lose or Draw
Once a move has been made, there should be a check to see if the game has been won. Perform the necessary checks, and either continue the game or display a victory message as appropriate. If the grid becomes full, the game ends with no winner.
Part 4: Player 2
After the first player has entered their symbol in a position, the second player should take a turn (as described in part 2). Play alternates between the two players until one player has won.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions