Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment To provide some structure in this project, the following shell is pro

ID: 3633288 • Letter: A

Question

Assignment
To provide some structure in this project, the following shell is provided. You do not have to use this exact shell in your project, but the desired structure of the program and the functions involved is best explained by looking at some starting code:

// INCLUDES
#include <stdio.h>

// DEFINES
#ifndef __TRUE_FALSE__
#define __TRUE_FALSE__
#define TRUE 1
#define FALSE 0
#endif

// ROWS and COLS must be between 1 and 9
#define ROWS 7
#define COLS 7

// MARKER CODES
#define MARKONE 'X'
#define MARKTWO 'O'
#define BLANK ' '

// VICTORY CODES
#define NOWIN 0
#define MARKONEVICTORY 1
#define MARKTWOVICTORY 2
#define TIE 3
#define ERROR 4
#define EPIC_FAIL 5

// GAME PARAMETER CODES
#define CONSECUTIVE_MARKS_REQUIRED 3

// PROTOTYPES
void InitializeBoard(char[ROWS][COLS]);
void DisplayBoard(char[ROWS][COLS]);
int PlayerMove(int, int, char[ROWS][COLS], char);
int VictoryCheck(int, char[ROWS][COLS]);
void DisplayVictoryMessage(int);

// MAIN
int main() {
// THE CORE LOGIC FOR YOUR GAME GOES HERE

// exit program
return 0;
}

// FUNCTION IMPLEMENTATIONS
void InitializeBoard(char board[ROWS][COLS]) {
// YOUR IMPLEMENTATION GOES HERE
}

void DisplayBoard(char board[ROWS][COLS]) {
// YOUR IMPLEMENTATION GOES HERE
}

int PlayerMove(int row, int col, char board[ROWS][COLS], char symbol) {
// YOUR IMPLEMENTATION GOES HERE
}

int VictoryCheck(int winRequirement, char board[ROWS][COLS]) {
// YOUR IMPLEMENTATION GOES HERE
}

void DisplayVictoryMessage(int victoryCode) {
// AN IMPLEMENTATION FOR THIS FUNCTION WAS PROVIDED IN A WEEKLY ASSIGNMENT
}
Minimally, the following functions should exist in your program. You may add additional functions if you desire, but please make sure the provided functions exist in some form within your program.

void InitializeBoard(char[ROWS][COLS]);
FUNCTION EXPLANATION
This function should initialize the board. The board is represented in the game as a two-dimensional array. The dimensions of the board in rows and columns are provided in the provided preprocessor directive statements. When the board is initialized, all spaces within the board array should be set to the blank space. The function returns no value.

void DisplayBoard(char[ROWS][COLS]);
FUNCTION EXPLANATION
This function should display the board in an organized, intuitive fashion. Details on the way this function works can be found in the weekly assignments. The function takes a single two-dimensional array as its only argument. That array should contain information about the pieces that are on the board at specific coordinates. Please note that this is the only function that draws things on the screen. Your main() may contain some prompting code to get player moves, but this function should be doing most of the drawing in the program. It return no value.

int PlayerMove(int, int, char[ROWS][COLS], char);
FUNCTION EXPLANATION
This function is called when the core logic of your program attempts to put a player marker on the board. The first two arguments represent the row and column on the board where the user wishes to place a piece. Please note that in your interface, the upper-left corner of the board should be coordinate (1, 1). However, within the board array, the upper-left space would be coordinate (0, 0). Make sure the PlayerMove() function performs the appropriate offset calculation to ensure the piece is actually going where it belongs. The third argument is a two-dimensional array representing the board. The fourth argument is a character that represents the symbol that the player wants to place on the board. Ideally, you should use X and O. The ASCII codes used to represent these markers are set in the preprocessor directive within your program. The function should return TRUE is the move was successfully placed on the board. The function should return FALSE if the player attempts to make a move that is off of the board or make a move that collides with a piece that already exists on the board. Optionally, you can print a small error message on the screen if one of these error conditions occurs. Make sure the printed error message results in an intuitive user interface once the program is complete.

int VictoryCheck(int, char[ROWS][COLS]);
FUNCTION EXPLANATION
This function’s first argument is an integer representing the number of adjacent symbols the player needs on the board in a horizontal, vertical, or diagonal fashion to win the game. The second argument is a two-dimensional array representing the board. The VictoryCheck() function should systematically scan the board looking for winners and return a value containing one of the predefined victory codes discussed in class. Please consult your weekly assignments for specific details on the victory codes NOWIN, MARKONEVICTORY, MARKTWOVICTORY, TIE, ERROR, EPIC_FAIL.

void DisplayVictoryMessage(int);
FUNCTION EXPLANATION
The implementation for this function was provided in your weekly assignments. The function takes a single integer argument and displays a user-friendly message indicating the interpretation of a particular victory code.

Explanation / Answer

Dear... Giving you the sample code for given Assignment. i hope it is helpful to you. // Tic.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #define X 'X' #define O 'O' #define yes 1 #define no 0 int check (char[][3], int, int); void counteratk (char x[][3], char turn); void progress (char x[][3]); void main() { char x[3][3]; int row,col,correct=yes,turn,game=yes,counter=0,r,c,d; for (row=0; row
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote