








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A programming exercise using spiralworld and spiralbuggle objects. The exercise involves creating two spiralbuggle objects, setting their colors and positions using the spiral method, and then having one object step on the other or change position based on instructions. The exercise is repeated multiple times with different instructions.
Typology: Study notes
1 / 14
This page cannot be seen from the preview
Don't miss anything!
Boilerplate
Filling the void
A fruitful method
A different twist
More to the point
Shall we dance
SpiralWorld SpiralBuggle becky = new SpiralBuggle(); SpiralBuggle bobby = new SpiralBuggle (); bobby.setColor(Color.blue); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); this becky Object Land Execution Land
bobby bobby steps on becky SpiralBuggle position heading
color red brushDown true SpiralBuggle position heading
color red brushDown true
SpiralWorld SpiralBuggle becky = new SpiralBuggle(); SpiralBuggle bobby = new SpiralBuggle (); bobby.setColor(Color.blue); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); this becky Object Land Execution Land
bobby bobby is blue SpiralBuggle position heading
color red brushDown true SpiralBuggle position heading
color blue brushDown true
SpiralWorld SpiralBuggle becky = new SpiralBuggle(); SpiralBuggle bobby = new SpiralBuggle (); bobby.setColor(Color.blue); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); this becky Object Land Execution Land
bobby becky spirals SpiralBuggle position heading
color red brushDown true SpiralBuggle position heading
color blue brushDown true this.forward( 6 ); this.left(); this.forward( 6 ); this.left(); this.forward( 6 ) this.left(); this.forward( 2 ); this.left(); this.forward( 2 ) return this.getPosition(); this
SpiralWorld SpiralBuggle becky = new SpiralBuggle(); SpiralBuggle bobby = new SpiralBuggle (); bobby.setColor(Color.blue); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); this becky Object Land Execution Land
bobby You put your right foot in SpiralBuggle position heading
color red brushDown true SpiralBuggle position heading
color blue brushDown true this.forward( 6 ); this.left(); this.forward( 6 ); this.left(); this.forward( 6 ) this.left(); this.forward( 2 ); this.left(); this.forward( 2 ) return this.getPosition(); this
SpiralWorld SpiralBuggle becky = new SpiralBuggle(); SpiralBuggle bobby = new SpiralBuggle (); bobby.setColor(Color.blue); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); this becky Object Land Execution Land
bobby And you shake it all about SpiralBuggle position heading
color red brushDown true SpiralBuggle position heading
color blue brushDown true this.forward( 6 ); this.left(); this.forward( 6 ); this.left(); this.forward( 6 ) this.left(); this.forward( 2 ); this.left(); this.forward( 2 ) return this.getPosition(); this
SpiralWorld SpiralBuggle becky = new SpiralBuggle(); SpiralBuggle bobby = new SpiralBuggle (); bobby.setColor(Color.blue); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); this becky Object Land Execution Land
bobby You do the the hokie pokie SpiralBuggle position heading
color red brushDown true SpiralBuggle position heading
color blue brushDown true this.forward( 6 ); this.left(); this.forward( 6 ); this.left(); this.forward( 6 ) this.left(); this.forward( 2 ); this.left(); this.forward( 2 ) return this.getPosition(); this
SpiralWorld SpiralBuggle becky = new SpiralBuggle(); SpiralBuggle bobby = new SpiralBuggle (); bobby.setColor(Color.blue); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); this becky Object Land Execution Land
bobby And that’s what its all about SpiralBuggle position heading
SOUTH color red brushDown true SpiralBuggle position heading
color blue brushDown true this.forward( 6 ); this.left(); this.forward( 6 ); this.left(); this.forward( 6 ) this.left(); this.forward( 2 ); this.left(); this.forward( 2 ) return this.getPosition(); this
SpiralWorld SpiralBuggle becky = new SpiralBuggle(); SpiralBuggle bobby = new SpiralBuggle (); bobby.setColor(Color.blue); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); this becky Object Land Execution Land
bobby You put your left foot in SpiralBuggle position heading
SOUTH color red brushDown true SpiralBuggle position heading
color blue brushDown true this.forward( 6 ); this.left(); this.forward( 6 ); this.left(); this.forward( 6 ) this.left(); this.forward( 2 ); this.left(); this.forward( 2 ) return this.getPosition(); this
SpiralWorld SpiralBuggle becky = new SpiralBuggle(); SpiralBuggle bobby = new SpiralBuggle (); bobby.setColor(Color.blue); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); this becky Object Land Execution Land
bobby And you shake it all about SpiralBuggle position heading
color red brushDown true SpiralBuggle position heading
color blue brushDown true this.forward( 6 ); this.left(); this.forward( 6 ); this.left(); this.forward( 6 ) this.left(); this.forward( 2 ); this.left(); this.forward( 2 ) return this.getPosition(); this
y
Point
SpiralWorld SpiralBuggle becky = new SpiralBuggle(); SpiralBuggle bobby = new SpiralBuggle (); bobby.setColor(Color.blue); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); this becky Object Land Execution Land
bobby bobby steps on becky, again SpiralBuggle position heading
color red brushDown true SpiralBuggle position heading
color blue brushDown true x y
Point
SpiralWorld SpiralBuggle becky = new SpiralBuggle(); SpiralBuggle bobby = new SpiralBuggle (); bobby.setColor(Color.blue); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); this becky Object Land Execution Land
bobby bobby turn to dance SpiralBuggle position heading
color red brushDown true SpiralBuggle position heading
color blue brushDown true this.forward( 6 ); this.left(); this.forward( 6 ); this.left(); this.forward( 6 ) this.left(); this.forward( 2 ); this.left(); this.forward( 2 ) return this.getPosition(); this
SpiralWorld SpiralBuggle becky = new SpiralBuggle(); SpiralBuggle bobby = new SpiralBuggle (); bobby.setColor(Color.blue); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); becky.setPosition(bobby.spiral()); bobby.setPosition(becky.spiral()); this becky Object Land Execution Land
bobby You put your left foot in SpiralBuggle position heading
color red brushDown true SpiralBuggle position heading
color blue brushDown true this.forward( 6 ); this.left(); this.forward( 6 ); this.left(); this.forward( 6 ) this.left(); this.forward( 2 ); this.left(); this.forward( 2 ) return this.getPosition(); this