Programming  >  SOPHIA Milestone  >  Virginia Tech - CS 1114 MazeRunner.java. (All)

Virginia Tech - CS 1114 MazeRunner.java.

Document Content and Description Below

import sofia.micro.jeroo.*; public class MazeRunner extends Jeroo { //~ Fields ................................................................ //~ Constructor .................................... ... ....................... // ---------------------------------------------------------- /** * This method creats a Jeroo that holds 15 flowers */ public MazeRunner() { super(15); } //~ Methods ............................................................... /** * This method calls upon another method while the * the conditions of the maze are not met */ public void myProgram() { while (!allConditions()) { this.navMaze(); } } /** * This method contains all the conditions of the maze * @return if conditions are all true the maze is complete */ public boolean allConditions() { return (this.getWorld().getObjects(Net.class).size() == 0 && this.getWorld().getObjects(Flower.class).size() == 0 && this.getGridX() == 1 && this.getGridY() == 1); } /** * This method is the main navigation for the Jeroo, * it contains instruction for gathering flowers, disabling * traps and moving in the maze */ public void navMaze() { if (this.seesNet(AHEAD)) { this.toss(); } if (this.seesFlower(HERE)) { this.pick(); } if (!this.turnLeft() && !this.hopIfClear()) { this.turn(RIGHT); } /** * This method tells the Jeroo * to turn left whenever it is possible to turn * @return if conditions are true the Jeroo will turn left and hop */ public boolean turnLeft() { if (!this.seesWater(LEFT) && !this.seesNet(LEFT)) { this.turn(LEFT); this.hop(); return (true); } else { return (false); } } /** * This method tells the Jeroo * to hop forward if it is clear * @return if conditions are true the Jeroo will hop forward */ public boolean hopIfClear() { if (!this.seesWater(AHEAD) && !this.seesNet(AHEAD)) { this.hop(); return (true); } else { return (false); [Show More]

Last updated: 3 years ago

Preview 1 out of 2 pages

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)
Preview image of Virginia Tech - CS 1114 MazeRunner.java. document

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Reviews( 0 )

$8.50

Buy Now

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Instant download

Can't find what you want? Try our AI powered Search

282
0

Document information


Connected school, study & course


About the document


Uploaded On

Mar 20, 2021

Number of pages

2

Written in

All

Seller


Profile illustration for QuizMaster
QuizMaster

Member since 6 years

1194 Documents Sold

Reviews Received
185
56
29
11
17
Additional information

This document has been written for:

Uploaded

Mar 20, 2021

Downloads

 0

Views

 282

Document Keyword Tags


$8.50
What is Scholarfriends

Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·