6.6

Homework 8

home work!

Programming Language ISL+Lambda

Due Date: Thursday June 4, 10pm EDT

Purpose To revise and expand a program, using list abstractions.

In this homework you are expected to use list abstractions for all list manipulations where it is possible to do so, whether it is mapping, filtering, folding, ormapping, or andmapping over a list. When you need a short and simple helper for a list abstraction, use lambda. If the helper you need is not very simple, you should not define it locally so that it can be tested thoroughly.

Exercise 1 Review your code from Assignment 6. Rewrite the project according to the graders’ mark ups (available in handins). Be sure to fix any and all problems that your graders have discovered in your tests/functions.

Next, you are to use local or lambda and list abstractions such as map, foldr, filter, etc, wherever your functions may benefit from them, especially for the lists of objects in your project.

You should notice that the length of your program will decrease.

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. 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.