Coke Machine Card Player

December 3, 2009
by Arielle Soutar (as07)

This code is very messy, as I wrote it hastily after my previous card-player failed miserably against mr15.

It takes three inputs and keeps hitting until the stand variable exceeds 1, at which it stands.

Soda machine dispenser circuits take three inputs, which is why it’s called the “Coke Machine”.
This awesome AI’s brains (or hard artificial life) are made solely of soda machine circuits arranged in a neural network: Genghis

(define coke-machine
     (lambda (mine others)
    (let ((stand 0))
      (when (< stand 1)
        (cond
          ((> (best-total mine) 18)
            (set! stand (+ stand 2)))
          ((< (- 21 (best-total mine)) 7)
           (set! stand (+ stand (* .1 (modulo (- 21 (best-total mine)) 7)))))
          ((< (best-total (list-ref others (random (length others)))) 10)
           (set! stand (- stand .2)))
          ))
      (if (>= stand 1) #f #t)
      )))


Leave a Reply

You must be logged in to post a comment.