Adding webpack dev server support.

This commit is contained in:
2020-08-28 09:21:40 -07:00
parent b22aea2507
commit 92eb1d9653
9 changed files with 1429 additions and 33 deletions

View File

@@ -172,7 +172,12 @@
(tax-person . 0)
(emergency . 0)
(num-harvests . 0)
(harvest-rolls . 0)))
(harvest-rolls . 0)
(operating-expenses . 0)
(hay . 0)
(grain . 0)
(fruit . 0)
(cows . 0)))
(alist-ref 'ai? args eqv? #f)
(alist-ref 'processing-turn args eqv? #f))))
@@ -555,7 +560,7 @@
;; (session-set! (sid) 'game *game*)
;; (set-startup-otbs (session-ref (sid) 'player) 2)
)
(send-static-file "main.html")
(send-static-file "index.html")
;; (with-headers `((connection close)
;; (content-type text/html))
;; (lambda ()
@@ -1015,7 +1020,31 @@
(* (/ (alist-ref 'harvest-rolls (player-stats p))
(max (alist-ref 'num-harvests (player-stats p)) 1))
10))
10)) ")"))))))
10)) ")")))
(players . ,(list->vector
(map (lambda (p)
(let ((stats (player-stats p)))
`((name . ,(player-name p))
(numHarvests . ,(alist-ref 'num-harvests stats))
(hay . ,(alist-ref 'hay stats))
(grain . ,(alist-ref 'grain stats))
(fruit . ,(alist-ref 'fruit stats))
(cows . ,(alist-ref 'cows stats))
(harvestAverage . ,(exact->inexact
(round
(/ (fold + 0 (map (lambda (c) (alist-ref c stats))
'(hay grain fruit cows)))
(alist-ref 'num-harvests stats)))))
(harvestTotal . ,(fold + 0 (map (lambda (c) (alist-ref c stats))
'(hay grain fruit cows))))
(operatingExpenses . ,(alist-ref 'operating-expenses stats))
(harvestRoll . ,(exact->inexact
(/ (round
(* (/ (alist-ref 'harvest-rolls stats)
(max (alist-ref 'num-harvests stats) 1))
10))
10))))))
(game-players game)))))))
type: "end-of-game")))
(define (create-ws-response player event misc)
@@ -2299,7 +2328,7 @@
(define (make-player-stat stat amount)
(lambda (p)
(safe-set! (player-stats p)
(alist-update stat (+ (alist-ref stat (player-stats p)) amount)
(alist-update stat (+ (alist-ref stat (player-stats p) eqv? 0) amount)
(player-stats p)))))
(define (get-actions player space)
@@ -2522,6 +2551,7 @@
(begin
((make-player-stat 'num-harvests 1) player)
((make-player-stat 'harvest-rolls rolled) player)
((make-player-stat crop income) player)
(safe-set! (player-cash player)
(+ (player-cash player) income))
(safe-set! (player-harvest-mult player) 1)
@@ -2535,6 +2565,9 @@
(player-name player))))
(game-players game)))))
((alist-ref 'action operating-expense) player)
((make-player-stat 'operating-expenses
(- (player-cash player) previous-cash))
player)
`((rolled . ,rolled)
(rolls . ,(list->vector (make-rolls 22)))
(income . ,income)