Improving AI buying algorithm.

master
Thomas Hintz 5 years ago
parent 99b60b5aba
commit cb983ae1c9

@ -1640,7 +1640,7 @@
(print "ai attempting to buy")
(let* ((net-worth (player-net-worth player))
(pct-complete (pct-complete net-worth game))
(room (if (< pct-complete 0.7)
(room (if (< pct-complete 0.55)
1000000 ;; basically infinite
(+ (- (game-setting 'max-debt game) (player-debt player)) (round-down-1000 (player-cash player)))))
(crops (map (lambda (card)
@ -1648,8 +1648,12 @@
(player-otbs player))))
(print (conc "room: " room))
(print (conc "crops: " crops))
(print (conc "pct complete: " pct-complete))
(let ((to-buy
(cond ((and (member 'cows crops) (>= room 5000))
(cond ((and (member 'cows crops) (>= room 5000)
(< (- (player-asset 'cows player)
(fold + 0 (map cdr (player-ridges player))))
20))
'(cows 10 5000))
((and (member 'fruit crops) (>= room 25000))
'(fruit 5 25000))
@ -1724,7 +1728,8 @@
(not (player-processing-turn player)))
(begin (set! (player-processing-turn player) #t)
;; time to buy
(when (and (>= (player-space player) 9) (<= (player-space player) 14))
(when (and (>= (player-space player) 9) (<= (player-space player) 14)
(< (player-debt player) 125000))
(let loop ((cont (ai-buy player game)))
(when cont (loop (ai-buy player game)))))
(let ((res (process-message player game "roll" '((type . "roll")))))

Loading…
Cancel
Save