|
|
|
@ -134,7 +134,9 @@
|
|
|
|
|
'((pro . 0)
|
|
|
|
|
(back . 0)
|
|
|
|
|
(tax-person . 0)
|
|
|
|
|
(emergency . 0))
|
|
|
|
|
(emergency . 0)
|
|
|
|
|
(num-harvests . 0)
|
|
|
|
|
(harvest-rolls . 0))
|
|
|
|
|
accessor: player-stats)))
|
|
|
|
|
|
|
|
|
|
(define-class <ai> (<player>)
|
|
|
|
@ -914,39 +916,59 @@
|
|
|
|
|
(* (player-debt player) -1)))
|
|
|
|
|
|
|
|
|
|
(define (do-end-of-game game)
|
|
|
|
|
(message-players!
|
|
|
|
|
game
|
|
|
|
|
#f
|
|
|
|
|
`((results
|
|
|
|
|
. ,(list->vector
|
|
|
|
|
(map (lambda (p i)
|
|
|
|
|
(conc i ". " (player-name p) " with $" (player-net-worth p)))
|
|
|
|
|
(sort (game-players game)
|
|
|
|
|
(lambda (p1 p2)
|
|
|
|
|
(> (player-net-worth p1)
|
|
|
|
|
(player-net-worth p2))))
|
|
|
|
|
(iota (length (game-players game)) 1))))
|
|
|
|
|
(stats . ((pro . ,(let ((p (car (sort (game-players game)
|
|
|
|
|
(lambda (p1 p2)
|
|
|
|
|
(> (alist-ref 'pro (player-stats p1))
|
|
|
|
|
(alist-ref 'pro (player-stats p2))))))))
|
|
|
|
|
(conc "Most suns aligned: " (player-name p) " (" (alist-ref 'pro (player-stats p)) ")")))
|
|
|
|
|
(back . ,(let ((p (car (sort (game-players game)
|
|
|
|
|
(lambda (p1 p2)
|
|
|
|
|
(> (alist-ref 'back (player-stats p1))
|
|
|
|
|
(alist-ref 'back (player-stats p2))))))))
|
|
|
|
|
(conc "Most licences expired: " (player-name p) " (" (alist-ref 'back (player-stats p)) ")")))
|
|
|
|
|
(taxPerson . ,(let ((p (car (sort (game-players game)
|
|
|
|
|
(lambda (p1 p2)
|
|
|
|
|
(> (alist-ref 'tax-person (player-stats p1))
|
|
|
|
|
(alist-ref 'tax-person (player-stats p2))))))))
|
|
|
|
|
(conc "Needs a tax person: " (player-name p) " (" (alist-ref 'tax-person (player-stats p)) ")")))
|
|
|
|
|
(emergency . ,(let ((p (car (sort (game-players game)
|
|
|
|
|
(lambda (p1 p2)
|
|
|
|
|
(> (alist-ref 'emergency (player-stats p1))
|
|
|
|
|
(alist-ref 'emergency (player-stats p2))))))))
|
|
|
|
|
(conc "Living on the edge: " (player-name p) " ($" (alist-ref 'emergency (player-stats p)) ")"))))))
|
|
|
|
|
type: "end-of-game"))
|
|
|
|
|
(let ((rollers (sort (game-players game)
|
|
|
|
|
(lambda (p1 p2)
|
|
|
|
|
(> (/ (alist-ref 'harvest-rolls (player-stats p1))
|
|
|
|
|
(max (alist-ref 'num-harvests (player-stats p1)) 1))
|
|
|
|
|
(/ (alist-ref 'harvest-rolls (player-stats p2))
|
|
|
|
|
(max (alist-ref 'num-harvests (player-stats p2)) 1)))))))
|
|
|
|
|
(message-players!
|
|
|
|
|
game
|
|
|
|
|
#f
|
|
|
|
|
`((results
|
|
|
|
|
. ,(list->vector
|
|
|
|
|
(map (lambda (p i)
|
|
|
|
|
(conc i ". " (player-name p) " with $" (player-net-worth p)))
|
|
|
|
|
(sort (game-players game)
|
|
|
|
|
(lambda (p1 p2)
|
|
|
|
|
(> (player-net-worth p1)
|
|
|
|
|
(player-net-worth p2))))
|
|
|
|
|
(iota (length (game-players game)) 1))))
|
|
|
|
|
(stats . ((pro . ,(let ((p (car (sort (game-players game)
|
|
|
|
|
(lambda (p1 p2)
|
|
|
|
|
(> (alist-ref 'pro (player-stats p1))
|
|
|
|
|
(alist-ref 'pro (player-stats p2))))))))
|
|
|
|
|
(conc "Most suns aligned: " (player-name p) " (" (alist-ref 'pro (player-stats p)) ")")))
|
|
|
|
|
(back . ,(let ((p (car (sort (game-players game)
|
|
|
|
|
(lambda (p1 p2)
|
|
|
|
|
(> (alist-ref 'back (player-stats p1))
|
|
|
|
|
(alist-ref 'back (player-stats p2))))))))
|
|
|
|
|
(conc "Most licences expired: " (player-name p) " (" (alist-ref 'back (player-stats p)) ")")))
|
|
|
|
|
(taxPerson . ,(let ((p (car (sort (game-players game)
|
|
|
|
|
(lambda (p1 p2)
|
|
|
|
|
(> (alist-ref 'tax-person (player-stats p1))
|
|
|
|
|
(alist-ref 'tax-person (player-stats p2))))))))
|
|
|
|
|
(conc "Needs a tax person: " (player-name p) " (" (alist-ref 'tax-person (player-stats p)) ")")))
|
|
|
|
|
(emergency . ,(let ((p (car (sort (game-players game)
|
|
|
|
|
(lambda (p1 p2)
|
|
|
|
|
(> (alist-ref 'emergency (player-stats p1))
|
|
|
|
|
(alist-ref 'emergency (player-stats p2))))))))
|
|
|
|
|
(conc "Living on the edge: " (player-name p) " ($" (alist-ref 'emergency (player-stats p)) ")")))
|
|
|
|
|
(highRoller . ,(let ((p (car rollers)))
|
|
|
|
|
(conc "High Roller: " (player-name p) " (" (exact->inexact
|
|
|
|
|
(/ (round
|
|
|
|
|
(* (/ (alist-ref 'harvest-rolls (player-stats p))
|
|
|
|
|
(max (alist-ref 'num-harvests (player-stats p)) 1))
|
|
|
|
|
10))
|
|
|
|
|
10)) ")")))
|
|
|
|
|
(lowRoller . ,(let ((p (last rollers)))
|
|
|
|
|
(conc "Low Roller: " (player-name p) " (" (exact->inexact
|
|
|
|
|
(/ (round
|
|
|
|
|
(* (/ (alist-ref 'harvest-rolls (player-stats p))
|
|
|
|
|
(max (alist-ref 'num-harvests (player-stats p)) 1))
|
|
|
|
|
10))
|
|
|
|
|
10)) ")"))))))
|
|
|
|
|
type: "end-of-game")))
|
|
|
|
|
|
|
|
|
|
(define (create-ws-response player event misc)
|
|
|
|
|
(append `((event . ,event) ,@misc)
|
|
|
|
@ -2333,6 +2355,8 @@
|
|
|
|
|
(player-harvest-mult player)))))
|
|
|
|
|
(if (not (already-harvested? (alist-ref '?value action) player))
|
|
|
|
|
(begin
|
|
|
|
|
((make-player-stat 'num-harvests 1) player)
|
|
|
|
|
((make-player-stat 'harvest-rolls rolled) player)
|
|
|
|
|
(safe-set! (player-cash player)
|
|
|
|
|
(+ (player-cash player) income))
|
|
|
|
|
(safe-set! (player-harvest-mult player) 1)
|
|
|
|
|