6.11.0.4

Week 4 Set a

home work!

Programming Language BSL

Due Date Mon at 9:00pm (Week 4)

Purpose This problem set is part 1 of a multi-part series of assignments that introduces the design principle of iterative design. Keep in mind, we may grade any of the three assignments and we may even grade them before you turn in the next part.

The problem set also gets you started on the design of functions that process arbitrarily large pieces of data.

Finger Exercises

Exercise 1 Design the function one-string. It consumes a list of Strings and concatenates those into one String.

Exercise 2 Design the function one-image. It consumes a list of Images and puts all of them besides each other into a single image.

Graded Exercises

Exercise 3 Thanksgiving is coming up. Your employer, a game company called ApperGamer, wants to release a game where competing turkeys gobble up pieces of food. As they eat the food they grow. The game is over when the given time’s up or all food is eaten.

Your chief software architect has decided to prototype a 2-player game where a human player competes against an AI. The first design foresees a playing field of 600 x 600 pixels. The two players as well as the single piece of food are placed at randomly chosen positions on the field.

The turkeys move at a rate of 10 pixels per clock tick toward some goal point. While the AI picks the goal point randomly, the human player chooses it by clicking the mouse (a "button-down" event). A turkey can eat a piece of food when it gets close enough where "close enough" is defined as "a distance of strictly less than 1% of the width of the playing field

Based on this write-up, your company’s chief architect has spelled out a plan. At this point, the plan consists of
  • a data representation,

  • the main function for a "world" program,

  • a function that creates an initial state of the world, and

  • a library for Posns

This last library includes the function move-toward, which your chief geometry officer (the domain specialist) has created in support of moving a turkey toward a goal point.

Your tasks are:
  • choose appropriate names for the handler and renderer functions,

  • make a complete wish list for those, and

  • work through at least two examples per wish and turn them into tests.

As HtDP/2e says, you must be able to apply main and run the program after you’re done with the wish list. Of course, nothing useful should happen.

The word "run" does not mean that the tests pass. It means you can click "run" in DrRacket and call the main function, but nothing good happens because all the handlers produces useless, default answers.