Category Archives: python

Systematically Visit [python]

 

Parameters

  • 1 while loop
  • visit all cells that you can
  • pick up all flowers
  • your loop must terminate (ie your Jeroo cannot keep going around the field forever)

Map #1

Grade : 2/10

  • start in (0,0) with 625 flowers!
  • row by row, plant flowers until you to position (23,0) as shown in animation below.


 

Grade : 3/10

 

Download all the island files

The Maps


 Grade : 5/10

Grade : 8/10 

Note: Do not be fooled by how similar the next map is. You will probably have to rewrite some code to complete the next one.


 Grade : 9/10  (THE FIRST MAP THAT *MUST* BE SHOWN)

Grade : 10/10 
Want an “A”, you must do the following map

Extra credit:

climb-the-stairs-[python]

Climb The Stairs

For all these maps:

  • Start your jeroo in the bottom left , at 23,0
  • use 1 and only 1 while loop
  • you may only hop() 1 space at a time
  • pick the flower at the end.

 

Download Island Files

climb-the-stairs__1.jev

 

 

climb-the-stairs__2.jev

  

climb-the-stairs__3.jev

   

 

climb-the-stairs__4.jev

 

 

climb-the-stairs__5.jev

climb_the_stairs_7

 

climb-the-stairs__6.jev

climb_the_stairs_8

 

climb-the-stairs__7.jev  (GRADE BOOK)

climb_the_stairs_7

 

climb-the-stairs__8.jev (GRADE BOOK)

 

climb_the_stairs_8

 

climb-the-stairs__9.jev

**( Only if you want to get that ‘A’)

 

 

 

Cross The bridge Custom Method 1

Objective: Your goal is get your jeroo onto the right side of the island. Note that the red areas are nets. You must toss() a flower onto the net before you can go on the net.. You will need the following island file .

 

The first time that we did this our code looked like this .

jeroo pickall1

#1)However, we want to create the following custom method custom_method .

 

jeroo pickall2

 

#2) Then our “main Section” code should be changed to:

 

jeroo pickall4

While Loops #2

#2 A

Create the map below

  • with a flower in 0,0
  • Jeroo to its right (0,1)
  • using while loop(s) traverse around the border of the island
  • at the end pick the flower
  • you can only use hop() (ie you can’t hop more than 1 space)

 

jeroo_walk_exterior1 jeroo_walk_exterior2 jeroo_walk_exterior3 jeroo_walk_exterior4 jeroo_walk_exterior5 jeroo_walk_exterior6 jeroo_walk_exterior7jeroo_walk_exterior8

 


#2 B

Create the map below

  • Jeroo to its right (6,6)
  • use multiple while loops
  • at the end pick the flower
  • you can only use hop() (ie you can’t hop more than 1 space)


Download Island Files

rectangular-lake.jev

1) Starting
<

2) Go around lake, until you are in front of the flower

3) Then pick the flower

finished program state1

The Betrothal

The Betrothal

Tom and Tammy are in love, and today’s the day that Tom is going to propose. According to custom, Tom must present Tammy with a flower as an official sign of his intentions. Tom lives in the extreme northwest corner of the island, and Tammy lives in the extreme northeast corner. The dividing river runs north and south, dividing the island roughly in the middle; the river is at least 5 cells away from the western and eastern edges of the island. The river, itself, is exactly two cells wide. Fortunately, for the lovers, there is a bridge somewhere to the south of their homes. Tom has asked Tammy to meet him at the middle of the bridge. While she suspects his motives, she doesn’t want to appear too anxious. The purpose of this program is to have Tom and Tammy find the bridge and meet in the middle where Tom will give an engagement flower to Tammy. After he has given her the flower, each returns to its home and faces the home of its betrothed. Each Jeroo starts at its home, Tom at (0,0) and Tammy at (0,23). Each can start facing any direction. Tom starts with one special flower in his pouch. A representative starting layout is shown in figure 1
Download the Island Files

Walk-the-lake

Monsoon rains have created a lake in the middle of Santong Island.  Furthermore, that lake contains an island. Two Jeroos were separated by the rains.  One is on the main part of Santong Island, but the other is on the island in the middle of the lake.  The goal of this program is to have each Jeroo explore the shoreline of the lake.

  • Each Jeroo starts with one flower and the lake immediately to its right.
  • Each Jeroo starts by planting a flower then traveling, keeping the lake on its right, until it returns to the flower. The Jeroo then picks the flower.
  • (only plant 1 flower, at starting point…and make 1 lap until you are back at that flower)
  • Have the Jeroo on the main part of Santong Island walk the shore first.
  • then have the one on the lake’s island walk the shore

Download Walk the Lake  (This has several maps, choose any 1)

walk-the-lake1

 

 

Acknowledgement

 

This problem is adapted from one that was created originally by Erica Eddy of The University of Wisconsin – Parkside.

 

Or you can try walk the lake using loops using this map and Jeroo assignment

 

Scavenger Hunt and relay race

Relay Race


Download both island files.

Objective: Three Jeroos (you give them names) are practicing for the Santong Relays. Figure 5 shows the course at the start of the race. The first Jeroo begins at (4,9) facing EAST. It must pick the flower and give it to the second Jeroo who begins at (7,13) facing NORTH. The second gives the flower to the third Jeroo who begins at (4,15) facing WEST. The third Jeroo must plant the flower at (3,16), run to (3,21) and stop


Scavenger Hunt


Objective: 

      Two Jeroos start at opposite ends of Long Island, one at (3,5) facing EAST, and one at (5,18) facing WEST. Each Jeroo is supposed to pick two flowers. The first one can be from anywhere along the edge of the island, and the second must be the one in the center. The first one to pick the center flower is declared the winner. There are a few rules to this scavenger hunt.

    • The Jeroos can only turn LEFT
    • The Jeroos must take turns, each doing only thing in each turn: hop(), turn(LEFT), or pick()
    • A Jeroo can only hop forward one space in its turn.


Download both island files.

Jeroo Spelling Letters (python)

I.  Copy and paste this code below in the Jeroo “IDE”. Run the code several times unti you understand what is going on, then try experimenting with the code, changing it around until you are comfortable with the basic methods of a Jeroo.

 

spell_T_in_python1

II.

Objective: Have a Jeroo spell out the lettter “Z ” in the same fashion as Part I

Picture of the finished project

spell_Z_in_python1

 

III.

Objective: Have a Jeroo spell out the letter “O ” in the same fashion as Part I