AI buying improvements.

master
Thomas Hintz 5 years ago
parent 4cbfe0b394
commit dd644387f1

@ -1640,9 +1640,14 @@
(print "ai attempting to buy") (print "ai attempting to buy")
(let* ((net-worth (player-net-worth player)) (let* ((net-worth (player-net-worth player))
(pct-complete (pct-complete net-worth game)) (pct-complete (pct-complete net-worth game))
(room (if (< pct-complete 0.55) (max-normal-room (+ (- (game-setting 'max-debt game) (player-debt player)) (round-down-1000 (player-cash player))))
1000000 ;; basically infinite (room (cond ((< pct-complete 0.55)
(+ (- (game-setting 'max-debt game) (player-debt player)) (round-down-1000 (player-cash player))))) 1000000) ;; basically infinite
((and (> (player-cash player) 30000)
(> (player-debt player) (game-setting 'max-debt game)))
(round-down-1000 (player-cash player)))
(else
max-normal-room)))
(crops (map (lambda (card) (crops (map (lambda (card)
(string->symbol (alist-ref 'crop card))) (string->symbol (alist-ref 'crop card)))
(player-otbs player)))) (player-otbs player))))
@ -1669,21 +1674,29 @@
(<= (player-asset 'cows player) 40)) (<= (player-asset 'cows player) 40))
'(tractor 1 10000)) '(tractor 1 10000))
((and (member 'ridge4 crops) (>= room 50000) ((and (member 'ridge4 crops) (>= room 50000)
(< pct-complete 0.55)
(>= max-normal-room 40000)
(not (find (lambda (p) (not (find (lambda (p)
(> (player-asset 'ridge4 p) 0)) (> (player-asset 'ridge4 p) 0))
(game-players game)))) (game-players game))))
'(ridge4 50 50000)) '(ridge4 50 50000))
((and (member 'ridge3 crops) (>= room 40000) ((and (member 'ridge3 crops) (>= room 40000)
(< pct-complete 0.55)
(>= max-normal-room 30000)
(not (find (lambda (p) (not (find (lambda (p)
(> (player-asset 'ridge3 p) 0)) (> (player-asset 'ridge3 p) 0))
(game-players game)))) (game-players game))))
'(ridge3 40 40000)) '(ridge3 40 40000))
((and (member 'ridge2 crops) (>= room 30000) ((and (member 'ridge2 crops) (>= room 30000)
(< pct-complete 0.55)
(>= max-normal-room 20000)
(not (find (lambda (p) (not (find (lambda (p)
(> (player-asset 'ridge2 p) 0)) (> (player-asset 'ridge2 p) 0))
(game-players game)))) (game-players game))))
'(ridge2 30 30000)) '(ridge2 30 30000))
((and (member 'ridge1 crops) (>= room 20000) ((and (member 'ridge1 crops) (>= room 20000)
(< pct-complete 0.55)
(>= max-normal-room 10000)
(not (find (lambda (p) (not (find (lambda (p)
(> (player-asset 'ridge1 p) 0)) (> (player-asset 'ridge1 p) 0))
(game-players game)))) (game-players game))))
@ -1747,7 +1760,8 @@
(begin (set! (player-processing-turn player) #t) (begin (set! (player-processing-turn player) #t)
;; time to buy ;; 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)) ;; (< (player-debt player) 125000)
)
(let loop ((cont (ai-buy player game))) (let loop ((cont (ai-buy player game)))
(when cont (loop (ai-buy player game))))) (when cont (loop (ai-buy player game)))))
(let ((res (process-message player game "roll" '((type . "roll"))))) (let ((res (process-message player game "roll" '((type . "roll")))))

Loading…
Cancel
Save