Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

CUNY BC C Program Run and Compile Connect Four Building A Text Interface Code Writing

CUNY BC C Program Run and Compile Connect Four Building A Text Interface Code Writing

CUNY BC C Program Run and Compile Connect Four Building A Text Interface Code Writing

Question Description

Throughout the course of this semester, you will be building “Connect Four”. If you are not familiar with this game, you can find the rules here: https://en.wikipedia.org/wiki/Connect_Four

You can play the game here: https://www.mathsisfun.com/games/connect4.html

We will not be building a graphical use interface for this game (that is not the focus of this course) but we will be building a text interface to this game.

For this assignment, we will be creating our project and getting some of the structure in place.

Most computer games have a particular structure, whether “guess a number” or Battlefront II. They start with some initialization – set up the data structures that model the “game world”. Then there is the “game loop” – a (nearly) infinite loop that accepts user input, updates the state of the game world, and updates the display. Finally, there is the teardown sequence that happens at game exit.

https://en.wikipedia.org/wiki/Video_game_programming#Game_structure

Game Loop

Connect Four is a game that alternates player 1 and player 2. You should keep track of whose turn it is next.

Your assignment: Create a program that models the structure above.

Create functions:

  • Initialization – print “Setting up the game”. Ask each player their name.
  • Teardown – print “Destroying the game”
  • Accept Input – accept a letter for which column of the game we are going to drop a disc into. Valid letters are A-G (7 columns). You should designate a letter for “Quit the game”. Input must be returned from this function.
  • Update the state of the world – pass the input data to this function. Since we do not have a “world” right now, choosing “A” is the “winning move”, all other letters make the game continue. This method must not print anything. It only does calculations. Results from here update the “global state.”
  • Display the state of the world – Print the result calculated in the state of the world. Later, this should print the board.
  • Main – call initialization, then loop until a flag is set (game over or a player quit), calling accept input, update and display. Outside of the loop, call teardown.

Make variables to define the size of the board (width and height). These can be global variables. Other global variables might include player names, which player should play next and “did anyone quit yet?”

You must submit buildable C source code

Hints:

Don’t write too much code – my solution is about 70 lines of code. If you go TOO much over that, you have done it really wrong. Shorter isn’t better, but longer isn’t better either.

I suggest using scanf for input and printf for output.

Write extra helper functions if you find yourself copy/pasting code.

One mistake that people often make is to have AcceptInput call UpdateWorld which then calls DisplayState. This is not correct. Each of these functions are called by the game loop.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20