5. End Game

The game ends when the ball is completely inside the target.

You win the game by moving your ball completely inside the white part of the target.

This game is not won yet.

This game is not won yet.

Winning position.

Winning position.

5a. Win-help?

Signature: win-help? : posn(ball-pos) posn(target-pos) -> boolean

This function is testable. Ideally you would write tests for it… but here are some.

;; ball radius 5, target inner radius 15
(check-expect (win-help? (make-posn 15 0) (make-posn 0 0)) false)
(check-expect (win-help? (make-posn 0 9) (make-posn 0 0)) true)
(check-expect (win-help? (make-posn 103 129) (make-posn 100 124)) true)

5b. Win?

Signature: win? : posn(ball-pos) -> boolean

The work for the win? function is already done, you just need to put it together.

5c. Win Screen

Signature: win-screen: posn(ball-posn) -> image

Adding a win screen is optional. You would only do this after you finished the draw handler.

Last modified August 18, 2023: 2022-2023 End State (7352e87)