Project 4: Tribe Squares Solution

\$35.00 \$30.80

Category:

Description

In project 4, you have a great deal of freedom for creativity. We present minimum requirements for grade thresholds. The more features you add, the higher your maximum score. We want you to implement the basic functionality of this game, then make it your own by researching how to add features that you think of.

The basic functionality is defined as follows:

1. The game is played on an 8×8 grid, just like checkers or chess.

1. Two players take turns placing pieces in the grid (by clicking on the squares).

1. A player’s goal is to form one or more squares with her pieces by placing a piece in each of the four corners of a square.

1. A player receives points when she forms at least one square on her move. The score is equal to the area of the square, so a 3×3 square is worth 9 points.
2. Players only receive points for the squares that they form.

1. If a player forms a rotated square, that counts as well (possibly for more points).

1. If a player forms multiple squares with a single move, her multiplier is increased by the number of simultaneous squares she created.

1. If a player forms 0 or 1 squares on a turn, her multiplier resets to 1.

Here’s how the points will work:

For a maximum of 20 points, your program must display an 8×8 grid and allow the user to click in the grid’s spaces. When she clicks, the space should be marked to indicate that it is occupied.

For a maximum of 30 points, your program must include all features above, and must alternate between two different players (colors) when marking grid spaces.

For a maximum of 40 points, your program must include all features above, and must also display which player’s turn it is.

For a maximum of 50 points, your program must include all features above, and must also draw the squares (not including rotated squares) formed by each player in her respective color.

For a maximum of 70 points, your program must include all features above, and must also update and display each player’s score on the screen. Scores must use the score class from project 2.

For a maximum of 80 points, your program must include all features above, and must also incorporate multipliers for multiple simultaneous squares, resetting to 1 if she forms fewer than 2 squares in a single move.

For a maximum of 90 points, your program must include all features above, and must also account for rotated squares.

The remaining 10 points are “dazzle points.” Show us what you can do now that you know the basics of Python programming. Think of some ideas to personalize and improve the game, research how to implement those ideas, and incorporate them into your program. This is your chance to shine. Note that without implementing your own additional features, the maximum score you can receive for this project is a low A-.

Here are some screen captures of my reference implementation. To display the player name, I added an accessor method called get_player_name() to the Score class. As always, these are examples, not prescriptions. You are free to style your program however you like. I chose to use squares and William & Mary’s official colors, specifically William & Mary Green and Spirit Gold.

As we get questions of clarification, we may extend this specification. We will announce via Piazza if the specs are updated.

EXAMPLES (NOT PRESCRIPTIONS)

 Figure 1: Program upon launch. Figure 2: Program after player 0 clicks in space 2, 2. Note that score and multiplier are unchanged.

Figure 3: Program after player 1 clicks in space 6, 3. Note that score and multiplier

Figure 4: After a few more turns, player 1 forms a 2×2 square for 22 = 4 points.

are unchanged

Figure 5: After a few more turns, player 0 places the middle green piece on the right side, forming two simultaneous squares.

Note that (32 + 32)×2 = 18×2 = 36.

Figure 7: As the playing field gets more populated, some lines may overlap. Fixing this is not required for the project.

Figure 6: Player 0’s next green piece does not form multiple squares, so the multiplier is reset to 1.

Figure 8: Play continues until all 64 spaces are occupied. In this case, player 0 wins!

SUBMISSION EXPECTATIONS

930xxxxxxx.pdf: A brief writeup describing the difficulties you encountered in this project and how you resolved them. Your writeup should also include a justification for dazzle points, if you attempt any, and a description of how to play your game. Use your W&M ID number for the name of the file.

TribeSquares.py: The skeleton file attached to this project, but with your implementation of the game. To build this file, you will need to consult PyQt’s documentation to locate methods of QPainter and other classes that would be helpful in your implementation. As a reminder, documentation is still only available for PyQt4, and we are using PyQt5. The only difference you should encounter for this project is the location of some modules to be imported. If you encounter trouble importing a particular module, post the problem on Piazza, and we will direct you to the correct import line.