Compare commits

...

2 Commits

Author SHA1 Message Date
Nico 37d0a75ea7 make GameStates transparent for easier debugging 2022-04-04 11:10:13 +01:00
Nico a846b01be5 add score view 2022-04-04 11:09:04 +01:00
2 changed files with 5 additions and 2 deletions

View File

@ -42,7 +42,7 @@
(define buttonpanel (new horizontal-panel% (define buttonpanel (new horizontal-panel%
[parent frame] [parent frame]
[alignment '(center center)] ; [alignment '(center center)]
[stretchable-height #f] [stretchable-height #f]
)) ))
(define backbutton (new button% (define backbutton (new button%
@ -61,6 +61,9 @@
(set! t (add1 t)) 0) (set! t (add1 t)) 0)
(send log select (- t 1)) (send log select (- t 1))
(send grid refresh))])) (send grid refresh))]))
(define score (new message%
[parent buttonpanel]
[label (format "Final Score: R: ~a, B: ~a" (first (GameState-scores game)) (last (GameState-scores game)))]))
(send frame show #t)) (send frame show #t))
(define g (play-game (GameState '() 0 '(0 0)) (list random-player random-player))) (define g (play-game (GameState '() 0 '(0 0)) (list random-player random-player)))

View File

@ -16,7 +16,7 @@
; grid is the grid ; grid is the grid
; player is the current player ; player is the current player
; scores is a list of numbers for the score of each player. ; scores is a list of numbers for the score of each player.
(struct GameState (grid player scores)) (struct GameState (grid player scores) #:transparent)
; width and height of the playing grid. ; width and height of the playing grid.
(define GRID-WIDTH 6) (define GRID-WIDTH 6)