1 / 7

Frogs and Toads 4 FrogApp and FrogApplet

Frogs and Toads 4 FrogApp and FrogApplet. 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. FrogGame class. validMove method

xiang
Download Presentation

Frogs and Toads 4 FrogApp and FrogApplet

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

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

More Related