Part 20. Domain Analysis For interactive programs such as these, we will use the How to Design Worlds recipe. This is our guide for developing most interactive programs, in big-bang, these are called world programs. There are 2 parts when designing interactive programs, first is that we use pen and paper for the concept and then we then code the whole thing from our analysis. We are going to design the walking cat program using the recipe. The cat would start at the left edge of the display and walks across the screen. When it reaches the right side, it should just continue walking off screen The interactive part is that we can use the spacebar key to bring the cat back to the left side. There are 4 steps in domain analysis Sketch program scenarios Identify constant information Identify Changing information Identify big-bang options First we sketch program scenarios, we would need pen and paper for this one. These 2 or 3 images shows the states of t...
Part 19. big-bang We are using Dr. Racket to design interactive programs, from this day forward, this is going to be very complicated. Imagine we have 2 interactive programs, one that counts down from 10 to 0 and some animation of a cat walking in the screen. These programs are interactive by just pressing the space key, the program restarts. These interactive programs change state and it affects the program behavior. On the countdown program, it generates a number from 10 to 0 every 1 second. It is also the same with the cat program, it just changes the x coordinate of the cat every miliseconds. These are 2 different functions, now how can we combine these 2 functions. We combine them by using Dr. Rackets big-bang primitive. (big-bang 0 (on-tick next-cat) (to-draw render-cat)) We use 0 as the initial world state, then on every tick, we get the next x coordinate, we pass it to the render c...