Problem Set 9

home work!

Programming Language ISL+

Due: Tuesday, March 24 at 7pm

Review your code from the Frogger HW7 project. Rewrite the project according to the graders’ mark ups. Be sure to fix any and all problems that your graders have discovered in your tests/functions.

Next, you are to use local and "loops" (abstractions such as map, foldr, filter, etc.) wherever your functions may benefit from them, especially for the lists of objects in your project. You may also use lambda terms in place of locally-named helper functions, if you wish.

You should notice that the length of your program decreases considerably.

Finally, upgrade your Frogger program to full Frogger. This means that in addition to five rows of traffic, there are five rows of the river. In the river rows, the player must ride (collide with) a turtle or a plank at all times. All planks move right, and all turtles move left. When the player collides with a plank or turtle, they don’t move relative to the entity. Turtles will always be above the water level. If the player hits a vehicle or is in the river but not on a plank or a turtle, the game ends with the player’s loss. In addition, the player loses if he/she leaves the bounds of the screen. When any other entity (vehicle, plank or turtles) passes off the edge of the screen, a new entity of the same type is created on the opposite edge, so that there are always the same number of vehicles, planks, and turtles and they are all evenly spaced. Planks and Turtles will always have the same length and speed.

The player can move his character in four ways: up, down, left and right. When the player moves, the frog turns to match the direction that he just moved in. Develop your own data definitions and structures for Frogs, Vehicles, Planks, and Turtles (and any auxiliary ones you might need, like Worlds).

You may implement other features, if you like (e.g., multiple lives, planks and turtles of variable speed and length, or appearing and disappearing turtles). However, extra features won’t save you from points taken off if your code has bugs or isn’t well written. You will not receive 100% credit simply for having code that works. For full credit, your code must work and be well written. So you should put your effort into writing clean, readable, bug-free code.

Of course, the use of helper functions is suggested, and testing is not only helpful, but required.