diff --git a/main.rkt b/main.rkt index 7faa188..a2fd5af 100644 --- a/main.rkt +++ b/main.rkt @@ -161,6 +161,7 @@ (define (play-game s players) (let ([g (GameState-grid s)] [p (GameState-player s)]) + (print (render-grid-bitmap g)) (cond [(= (length g) (length ALL-LINES)) s] ; end of the game [else @@ -186,14 +187,15 @@ ; renders grid on the given drawing context. ; TODO color in squares (define (render-grid grid dc) - (for ([l grid]) + (for ([l (reverse grid)]) (cond - [(= (line-player l) 0) (send dc set-pen "red" 4 'solid)] ; player 1 draws in red - [(= (line-player l) 1) (send dc set-pen "blue" 4 'solid)]) ; player 2 draws in blue + [(= (line-player l) 0) (send dc set-pen "red" 4 'solid) (send dc set-brush "red" 'bdiagonal-hatch)] ; player 1 draws in red + [(= (line-player l) 1) (send dc set-pen "blue" 4 'solid) (send dc set-brush "blue" 'fdiagonal-hatch)]) ; player 2 draws in blue (send dc draw-line (+ 4 (* GRID-SCALE (point-x (line-from l)))) (+ 4 (* GRID-SCALE (point-y (line-from l)))) (+ 4 (* GRID-SCALE (point-x (line-to l)))) (+ 4 (* GRID-SCALE (point-y (line-to l)))))) ; draw the line - - (send dc draw-bitmap EMPTY-GRID 0 0)) ; overlay dot grid \ No newline at end of file + (send dc draw-bitmap EMPTY-GRID 0 0)) ; overlay dot grid + +(play-game (GameState '() 0 '(0 0)) (list random-player random-player)) \ No newline at end of file