|
home—lectures—recipe—exams—hws—D2L—breeze (snow day; distance)
Extra credit; due Oct.27 15:00Nov.06 23:59.
For hw06, you will be writing some list-processing functions for the Kong game. I will provide code that does most of the non-list processing (including most of the program-design). However, if you want to have the pride of writing the entire game yourself, you may do this extra-credit homework.
All problems require following the design recipe.
(When making examples-of-the-data for each struct, you might want to think about examples which will also be useful for writing test cases below.)
(Even if some of these have fields in common,
we will not use inheritance to factor that out.
If you want to though, you can
For those struct-types that will be updated during the game
(T = player, barrel),
write a function
Of course, these functions will return new objects (no changing/mutating fields). Happily, test-cases are made easier by copy/pasting your existing examples-of-data, and code made easier by copy/pasting your template. You might realize you need additional examples-of-data to test certain circumstances.
For those struct-types that care about key-presses
(T = player),
write a function
Library:To get access to functions likekey=? , you need to(require 2htdp/universe) .
Keypresses do not correspond to any time passing, so a keypress will (presumably) not move the T in any way.
For example
Library:I recommend usingplace-image ; this function crops the result to the background.
hw06 will take my solution to (most of) these tasks, and have you provide versions which work for lists of platforms, ladders, and barrels.
All the above should have their tests, as well as signatures and (brief) purpose statements. Only after all tests pass, the following should work (in racket):
(require 2htdp/universe) (big-bang some-initial-world [on-key world-handle-key] [on-tick update-world] [to-draw draw-world]) |
home—lectures—recipe—exams—hws—D2L—breeze (snow day; distance)
©2016, Ian Barland, Radford University Last modified 2016.Oct.27 (Thu) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |