Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java programming languages I'm looking logic help on if/else statement for chooseDirection(final Map theNeighbors) method. I'm good with the light that biycle can pass through

Java programming languages

I'm looking logic help on if/else statement for chooseDirection(final Map theNeighbors) method. I'm good with the light that biycle can pass through but I need help on direction method. The option that I have was Terrain.WALL for wall, Terrain.STREET for street, Terrain.CROSSWALK for cross walk, Terrain.GRASS for grass, Terrain.TRAIL for trail, Terrain.LIGHT for light.

/** * Grass. */ GRASS('-'),

/** * Street. */ STREET('|'),

/** * Light. */ LIGHT('+'),

/** * Wall. */ WALL('X'),

/** * Trail. */ TRAIL('.'), /** * Crosswalk. */ CROSSWALK('#');

image text in transcribed

image text in transcribed

4X1- 7XI -1111lII1111--.--lX 10xI- # Bicycle Comstructor: public Bicycle (int thex, int theY, Direction theDir Images: bicycle.gif (alive), bicycle_dead.gif (dead Movement behavior: Bicycles can travel on streets and through lights and crosswalk lights, but travel on trails f the terrain in front of a bicycle is a trail, the bicycle always goes straight ahead in the direction it is are guaranteed to be straight (horizontal or vertical) lines that end at streets, and you are guaranteed that a bicycle will never start on a trail If a bicycle is not facing a trail, but there is a trail either to the left or direction, then the bicycle turns to face the trail and moves in that direction. You may assume that the map is laid out so that only one trail will neighbor a bicycle at any given time facing terrain it cannot traverse to the right of the bicycle's current . ere is no trail straight ahead, to the left, or to the right, the bicycle prefers to move straight ahead on a street (or li it cannot turn right, it turn not streets or lights or crosswalk lights), the bicycle turns around. ght or crosswalk light) if it can. If it cannot move straight ahead, it turns right if possible; i e s left if possible. As a last resort, if none of these three directions is legal (all and red lights; if a traffic light or crosswalk light is immediately ahead of the is not green, the bicycle stays still and does not move unless a trail is to the left or .Bicycles stop for yellaw bicycle and the right. If a bicycle is facing a red or yellow light and there is a trail to the left or right, the bicycle will urn to face the trail. Collision behavior: A bicvcle dies if it collides with a living truck, car, or ATV. It stays dead for 30 moves

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

8. Measure the effectiveness of the succession planning process.

Answered: 1 week ago