Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

problem 1) Implement this function in C:

void populateGameBoard(char gameBoard[][COL_SIZE], int rowSize, int colSize, int numPieces);

This function takes in entire game board passed from main, the row size, the column size of the playable game board, and number of pieces to place (num_pieces). Inside the function develop the way to populate 2D array randomly by calling getPieceType (basically function which randomly generates (returns) character of either 'T' or 'A') to obtain either ‘A’ or ‘T’ to place on the playable game board portion up to the size of numPieces. numPieces is decided by the row size of the 2D array -- meaning that if rowSize = 10, then the board would start with 10 game pieces.

Note: This function also should handle the case that max element size would be met and number of units plus incoming number pieces would create an infinite loop. Develop the way to prevent the infinite loop.

A solution is below

For ex: a 3 * 3 game board has at max 9 elements but also requires a placement of 3 additional units, but already 7 units present on game board. If this is the case decrement the number of additional units to fit the max number of units in the playable game board portion.

THIS IS WHAT THE GAMEBOARD LOOKS LIKE:

Player's life left is [100]

Number of devastor missiles is [0]

Player's score is [0]

    a     b      c    d     e     f     g     h      i      j
a [   ] [   ] [   ] [   ] [   ] [   ] [   ] [ A  ] [   ] [   ]
b [   ][ T ] [   ] [   ] [   ] [   ] [   ] [   ] [   ] [   ]
c [   ] [   ] [   ] [   ] [ A  ] [   ] [   ] [   ] [   ] [   ]

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M94704

Have any Question? 


Related Questions in C/C++

Assignmentgoals developing problem-solving skills declaring

Assignment Goals: Developing problem-solving skills, declaring variables, multi-way branches, data validation. Problem: Complete Programming Challenge 4.19 in your text book. Do not accept values larger than 10 meters or ...

C projectphase 11- you need to take input from user study

C project Phase 1 1- You need to take input from user study year (proper value check from 1 to 4) 2- Take input semester (proper value check 1 to 8) 3- Calculate GPA (use Loop, calculate GPA for semester 1,2,3...) Exampl ...

Assignmentthis is the programthis program will use 2

Assignment This is the program: This program will use 2 different data structures to perform the same tasks; a vector and a dynamically sized array Write a complete C++ program that will: Declare a vector of integers wit ...

Programming assignmentwrite a c program that allows the

PROGRAMMING ASSIGNMENT Write a C program that allows the user to make some banking transactions. The program should first prompt the user to enter the current balance of his/her bank account (in dollars and cents). The p ...

Discussionkeyboard versus file input please respond to the

Discussion "Keyboard versus File Input" Please respond to the following: • Suppose you are designing a C++ application that needs to capture user input specifically via a keyboard or from a file. Determine the method tha ...

The second portion instruction shown below which is the

The second portion (instruction shown below) which is the actual C++ program is needed by this Saturday. Write a C++ program that is menu-driven that allows for the following menu choices:Load an exam: Loading an exam sh ...

Write a program to draw a symmetric shape of your own using

Write a program to draw a symmetric shape of your own using C++ user-defined functions and arrays. The program should draw a shape in its original and opposite forms (black and white and then white and black). Please con ...

Write a c application that does the followingitem 1 prompts

Write a C++ application that does the following: ITEM 1: Prompts the user to choose one of the following series: 1 + 1/2 + 1/3 + ... + 1/n ((((x * 2) * 2) * ...) * 2) series of n multiplications x + (x * 1) + (x * 2) + ( ...

Programming assignment image processing - pointers class

Programming Assignment: Image Processing - Pointers, Class & Dynamic Data This project is called "Image Processing" which will shrink an input image, convert a color image to gray image , add random noise to an image, ad ...

Programming in cbubba tubs bbq rub is a company that makes

Programming in C++ Bubba Tub's BBQ Rub is a company that makes different BBQ dry rubs and sauces. They make each product when it is ordered with the freshest ingredients and sell it by the unit. A unit is 2 ounces of pro ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen