Question: Programing language: C introduction to Programming in C (ELEC129) Assignment 3 Exercise 1 (100% of assignment mark) The objective of this assignment is to implement


Programing language: C
introduction to Programming in C (ELEC129) Assignment 3 Exercise 1 (100% of assignment mark) The objective of this assignment is to implement the tic-tac-toe game with a C program. The game is played by two players on a board defined as a 5x5 grid (array). Each board position can contain one of two possible markers, either X or 'O. The first player plays with 'x' while the second player plays with O. Players place their markers in an empty position of the board in turns. The objective is to place 5 consecutive markers of the same type in a line (a line can be any row, any column or any diagonal). The first player who manages to place 5 markers in a line wins. The game is played until one of the players wins or until the board is full with no player having 5 markers in a line (i.e., the result of the game is a draw) Your program should do the following: 1) Ask at the beginning if the game is going to be played by two human playese. human player vs. human player) or by one human player and the computer (i.e. human player vs. computer). In the latter case (i.e., human player vs. computer) there must be an option that allows the player to choose the first to play (either the computer or himself/herself) 2) Players will play in turns (i.e., the first player will place an 'X on the board, then the second player will place an 'O in the next move, and so on) a. When it is a human player's turn, the selected board position must be introduced by the user by indicating the corresponding row and column numbers. Your program should display numbers around the board, as shown in the example below, in order to assist the player: When it is the computer's turn (in human vs. computer mode), the computer should choose a valid empty position. A possible tactic to choose the position is suggested in point 6 (see below) b
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
