Skip to content

Ssunoo2/Fishing-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fishing Game

Grading

  • 100 points for the game code.
    • Due May 11 at 4:30pm
  • 10 points for writing a thorough code review.
    • For code review, each group should have a develop branch that holds a beta version of your game.
    • Code reviews will be done in class Wed May 4th. Attendance (in-person or virtual with cameras) is required. Your game should be somewhat working.
    • Each group will be reviewing another group's project together and combine their feedback in the pull request.
  • 10 points for using code reviewer suggestions and/or responding to your reviews in your pull request.

Group Contributions

  • Each group member should fill out the Group Contribution Google form after the assignment is submitted.
  • If all contributions are roughly equal, each group member will recieve the same grade. If some members have not contributed equally, their grades will be adjusted accordingly.

Instructions

  • Finish implementation of Fishable interface.
  • Build a two player Fishing Tournament game/main method using your I_a object classes.
    • Two players will alternate turns on the same computer.
    • The players will catch fish and put them into a "sack" (an ArrayList, sorted in descending order by length)
    • After 12 turns each, the player with the three largest fish is the winner.

Fishable I_a Implementation

I realized after I gave you the initial I_a assignment that the Fishable interface wouldn't work right if the individual I_a families implemented it separately. All Fishable fish need to be subclasses of a FishableI_a subclass of I_a. See image:

heirarchy

I have made a new FishableI_a.java abstract subclass of the I_a superclass. I have also fully implemented Fishable in the Moi family of fish. These new files are included here in this repository. Use the MoiLi_i.java - Moi.java classes as an example.

  • You will need to go into your Oama, Ohua, and Pua_ama fish families and modify them as follows:
    • Remove implements Fishable from wherever that appears. (Leave implements ColorChangeable and SexChangeable as is)
    • Change extends I_a to extends FishableI_a in the baby fish classes Oama, Ohua, and Pua_ama. The other inheritance remains the same.
    • Add or modify the methods required by Fishable
      • I have made some improvements to the Fishable interface.
        • Added isInSeason and getBagLimit abstract methods.
      • I suggest removing most Fishable methods from all but the baby fish type and have it handle most of the Fishable requirements. See MoiLi_i.java. You will need to add an overloaded getCatchMethods method to the fish that becomes legal size if it isn't the smallest (see MoiMana.java).

Fishable Values for Fish Families

  • Pua_ama mullet family:
    • Legal size is 11 inches and above
    • Season is open April - November, closed December - March
    • IsGameFish if legal size
    • Is not bait
    • No bag limit (number of fish you're allowed to catch). Use Integer.MAX_VALUE as the limit.
    • Valid catch methods for legal size fish are: "net", "pole"
  • Ohua/Uhu fish family:
    • Legal size is 12 inches and above
    • Season is always open
    • IsGameFish if legal size
    • Is not bait
    • No bag limit (number of fish you're allowed to catch). Use Integer.MAX_VALUE as the limit.
    • Valid catch methods for legal size fish are: "throw net", "spear", "pole"
  • Oama/Weke fish family:
    • No minimum legal size
    • Season is always open
    • IsGameFish
    • IsBait
    • Bag limit is 50
    • Valid catch methods for legal size fish are: ""pole", "net"

There are new JUnit test for all of the fish types in this repository.

Fishing Tournament Phase 1 - Loko i'a (Fish Pond) Setup

  • The first thing that should happen in the Fishing Tournament is the Fish Pond (ArrayList) should be filled up with baby fish of all Fishable types, then it should loop for around 2 pretend years (24 months) so the fish can grow to be roughly legal size.
    • I have given you some of the code required for this in FishingDriver.java. After you have your I_a modified for Fishable as above, run the FishingDriver and examine the code.

Fishing Tournament Phase 2 - Lawa i'a (Fishing)

  • In the second (main game play) phase of the game, the fishing tournament should last for a whole "year" (12 months)
  • The two players should alternate turns. Once both players have had a turn, the "month" will be over and change to the next "month".
  • When the "month" changes, the fish in the pond should eat and grow once, like in the FishingDriver.java example.
  • During each player's turn, they will get to attempt to catch a fish three times.
  • Each catch attempt will have three possible outcomes: No fish is hooked (random empty ArrayList location hit) or a fish is hooked (fish randomly picked from ArrayList pond) and is either caught or gets away.
    • If the fish is caught, the player will then need to decide whether or not to keep it.
      • If the fish is kept, the fish should be checked for legal size and legal month.
      • If the kept fish is legal, it should be added to the player's sack and removed from the pond.
      • If the kept fish is not legal, the player will be punished by having all of their fish confiscated (sack of fish emptied)

Example of game play:

Player 1, it is your turn! 
* Choose:
  1. Cast out for a fish
  2. View sack of fish
  3. Throw back a fish in the sack.
  
  Choice: 1
   You have hooked a fish!
   You have caught a fish!
     Name: Uhu
     English name: Parrotfish
     Scientific name: Scarus Psittacus
     Length: 12.487740994862454
     Weight: 24.97548198972491
     Body color: blue-green
     Fin color: blue
     Sex: supermale
     
 * Do you want to keep this fish y/n? y
  You have kept your fish
  Your fish is legal and has been added to your sack

Other outcomes would be:

   You have kept your fish
   You kept an illegal fish!
   You got a ticket and all of your fish were confiscated!

or

  Your fish got away!
  • The other options will list the sack of fish in order by length, longest first (like you did in Assignment 5).
  • The throw back option will list the sack of fish (with the index number too) then ask the player to enter the number of the fish they want to throw back.
    • The throw back option should remove the chosen fish from the player's list and add it back to the fish pond list.
    • The idea behind this is that towards the end of the game, the pond might be getting pretty empty and a player might want to put some fish back in.

Regardless, each player should get to cast out for a fish three times before their turn is over. They can list and release fish as many times as they want in a turn.

Game Phase 3 - Game Over

  • Once 12 "months" of turns have been taken, the two players' lists should be compared. The player with the largest three fish (sum of the three longest lengths) is the winner!
  • You probably will need to adjust how many fish are in the pond and how much they get to grow to make the game more or less challenging.

Assignment 5 Grading


  • 10/10 Code review for Group: .

  • 10/10 Respond to Code review from Group: .

  • 20/20 Fishable interface upgrade to I_a classes.

  • 10/10 Setup of fish pond

  • 10/10 Implementation of players (can be an object or something else)

  • 10/10 Alternating turns, three casts per turn

  • 10/10 Tracking of "months"/ fish eat/grow between.

  • 10/10 Implementation of illegal fish penalty

  • 10/10 Implementation of throwing back functionality

  • 10/10 Correct win/lose calculation.

  • 10/10 Comments, coding style, documentation.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages