Download presentation
Presentation is loading. Please wait.
1
Frogs and Toads 4 FrogApp and FrogApplet
2
Some updates Frogs and Toads 3 (after) has partial functionality
can move an amphibian can determine if frog move (one square) is legal need to check if hops move is legal need to do Toads as well
3
FrogGame class validMove method
checks the status of a pad to see if FROG or TOAD we used gameBoard.getPad(row,column).getStatus() when checking for hops have to check neighbor square is opposite type could go "off the board" – outside legal limits for row/col will cause run time error (red messages!) Instead use gameBoard.statusOfPad(row,column); this method will have protection inside checks for illegal row/column values
4
FrogGame class int StatusOfPad(row,column)
if the row is <0 OR >= size return Pad.INVALID same deal with col otherwise, return gameBoard.getPad(row,column).getStatus();
5
Pond class The toString method provided draws board upside down
low rows on top. Opposite of the example games We can easily flip the board, see method and verify in FrogGameTester
6
FrogApp class comments and pseudocode provided
very easy once you get the FrogGame class working
7
FrogApplet class starter code provided
we'll do the board drawing together and also how to convert mouse clicks to row/col values
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.