Frogs and Toads 4 FrogApp and FrogApplet - PowerPoint PPT Presentation

xiang
frogs and toads 4 frogapp and frogapplet n.
Skip this Video
Loading SlideShow in 5 Seconds..
Frogs and Toads 4 FrogApp and FrogApplet PowerPoint Presentation
Download Presentation
Frogs and Toads 4 FrogApp and FrogApplet

play fullscreen
1 / 7
Download Presentation
Frogs and Toads 4 FrogApp and FrogApplet
138 Views
Download Presentation

Frogs and Toads 4 FrogApp and FrogApplet

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Frogs and Toads 4FrogApp 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