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 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 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 near the top of the screen.
Draw a green rectangle representing the game play area.
Draw a by grid of white circles in the green rectangle.
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 appropriately. Post a screenshot of your tasks on Canvas.
c Save your game program from Assignment as a new file.
I called mine connectv 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 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.
The last problem left you with a program that draws a game board where nothing happens. Now add a function that colors in an appropriatelylocated 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 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.
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
