1. Appearance (View Component(s)) - (5pts matching appearance):
Â
Two Panels (either extended or QWidgets base):
– (1pt) Must use QWidget to display user positions (grid 10x10)
– (1pt) Must use QWidget to contain Buttons for guessing enemy location
Â
User Mouse Interaction on Canvas
Â
– (2pt) Click to add grid to user placement (17 spots must be placed)
– BONUS POSSIBLE (5 pts): add ships as denoted by the game in order of their size (5,4,3,3,2). Hint use left/right mouse button for vertical/horizontal placement.
– (1pt) Disable user action, when all 17 spots are placed.
Â
User Interaction on Frame/Buttons
– (1pt) Disallow interaction until all 17 spots are added in above panel.– When button clicked:
Â
∗ (3pt) reference enemy placement loaded from file (see below), if hit/miss note accordingly (via text: for miss, X for hit; or via background color)
∗ (1pt) Nothing happens if pressed from before
∗ (2pt) Check if win, i.e. hit all 17 enemy spots
∗ (2pt) AI player randomly chooses a spot of yours that was not tried before
*Â (2pt) Provide a Label informing the user what they are to do, place ships, take turn,...
Â
Â
2. Game Logic (Model Component(s)) - (5pts matching behavior)
Â
(3pt) Upon initalization load battleship 0.txt into a data structure of some kinds (list/dictionary/etc)...file IO
Â
Adding ships:
Â
– (1pt) Uses virtual functions on placement panel
– (1pt) Changes appearance, but stores placement for AI check (list/dict/etc)
– (1pt) Disallow multiple placement on single spot (or overlap if doing bonus)
– (1pt) Must inform user how many spots are left to place (counts/length of somekind)
Â
User Move (points assigned above):
Â
– Checks stored spots of AI positions, updates accordingly
– Checks for win condition
Â
AI Move:
Â
– (1pt) Triggered immediately after non-winning user move– (2pt) Randomly chooses a spot not yet tried
– (1pt) Displays AI hit miss on canvas
Â
Â
3. Controller and Other requirements
Â
• (1pt) Must use external QtWidgets module
• (1pt) Must extend from at least 1 QtWidget class
• (1pt) Must use either a list or dict to store the player/ai board state
This assignment has been answered 3 times in private sessions.
Or buy a ready solution below.
© 2024 Codify Tutor. All rights reserved