Question: In this problem, you will add a function to your Connect 4 program that draws an empty game board on the turtle screen. ( a

In this problem, you will add a function to your Connect 4 program that draws an empty game board on the turtle screen.
(a) First, design your game board. You may model it on the one I showed in Lecture 15 if you want. Whatever you do, draw the board by hand first. Include in your picture any titles, headings, or labels. Also, indicate colors you will use for different parts of the board.
(b) Write out the tasks your function will perform to draw the game board. For example, my function did the following:
Declare the turtle and the screen to be global variables
Get the turtle and the screen.
Set the screen background color and title.
Write the heading "CONNECT 4" near the top of the screen.
Draw a green rectangle representing the game play area.
Draw a 7 by 6 grid of white circles in the green rectan-gle.
Write the numbers underneath the columns.
If your board is set up like mine, you can use these same tasks. If you design a different screen, vary the tasks ap-propriately. Post a screenshot of your tasks on Canvas.
(c) Save your game program from Assignment 14 as a new file.
I called mine connect4v3. In this new file, add a function that draws the empty game board. I named this function drawgameboard (), but use whatever name you want. The function should contain commands that perform the tasks you listed above. See Lecture 15 for information on how I implemented the tasks.
(d) To draw the game board when the game is played, add a call to the function near the beginning of main ().
(e) Play the game and see if the game board looks like what you want.
3. The last problem left you with a program that draws a game board where nothing happens. Now add a function that colors in an appropriately-located white circle in the turtle screen after a player moves. I named this function drawmoveonboard (), but choose a different name if you want. Recall from Lecture 15 that I called this function in main (), and I usedthe variables columnnum, rownum, and insertcolor as parameters.
After the function is completed, test it by playing the game.
Make sure it colors in the correct circle in the turtle screen.
When the function is working, post screenshots of the function code and the output of the game (with the game board) on Canvas.
4. Your program should contain a function that determines if a player has won. In my program, this function is called evaluatewin ().
Add code to this function that prints a message on the turtle screen when a player wins.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!