The standings page is initially empty but will grow as you continue to request rounds to be played.
However, there was another problem that I fixed: and and or did not work properly! This is because they are special forms and therefore don't look like functions. Arguments to these predicates were not evaluated by the rule interpreter which generated an error.
Let me clarify exactly what a predicate may be:
The things that you might think are functions but are really special forms (and will be treated by the above rules as though they are some attribute you may have asserted) are: let, define, set!, if, cond, case, begin, do, quote, and others. You can of course use these in your user defined functions, but they cannot appear directly in your rules.
If all but one player passes, the betting interval ends, and the last player is asked for a declaration prior to the showdown.
The main changes are to the a6code.com file, but there are some minor changes to poker.scm and human.scm also.
(define betting-rules
'(((= hand-number 2) (= bet-round 2)
==> (save-state (string-append "sharky-"
(number->string hand-number)
"-"
(number->string bet-round)
".scm")))
...))
If this rule fires, the save-state action will save your
player's state into a file with the given filename. This example also
shows how you can construct a string for a filename. (If the rule
doesn't fire, then no file will be written.)
Once you have this file, you can then run your (possibly modified) player under those same conditions with the function:
(rerun/betting state-fname player-fname)The save-state function can also be called from your learning function and as an action in your declaration rules. You can rerun those portions of your player with the commands:
(rerun/declaration state-fname player-fname) (rerun/learning state-fname player-fname)The state saved will include any assertions that you have made in your rules and also any variables that you have set with the set action. Essentially, the set action simply lets the save-state function know about a variable.
Any variables you define yourself will not be saved. You could use the set action to define and initialize those variables and use set! in your user-defined functions to change them, and the variables will still be saved by save-state.
There were a number of functions implemented in this release as well as several bug fixes. There are a few corrections, additions, and deletions to the support code release notes:
(set-printing '(table-info all-cards betting declarations showdown))
This is a problem in the way that I specified the way rules are executed, i.e. values that actions return are ignored. If I were to do it again, I'd just say that we'd look at the return values until one matches a terminal action. I don't think I should change the support code now since people might be returning anything (and it could therefore "break" their program).
Here's a way around it. It's a little roundabout, but it will work.
(define (yourfunction ...)
...
(set! selected-action '(raise 30)))
(define betting-rules
'(((= bet-round 1) ==> (set selected-action '()))
((> .... 30) ==> (yourfunction ...))
((equal? (car selected-action) 'call) ==> (call))
((equal? (car selected-action) 'pass) ==> (pass))
((equal? (car selected-action) 'raise)
==> (raise (second selected-action)))
...)
It's very important to have the initialization as the first rule, otherwise, the variable may not exist when you try to set it in your function.
Yes. Here's an example:
(define betting-rules
'(((bluffing) ==> (raise max-raise))
(#t ==> (assert bluffing))
((= bet-round 1) ==> (raise min-raise))
((poker:> my/hand three-ofakind) ==> (raise max-raise))
((= (random 4) 1) ==> (pass))
(#t ==> (call))))
From the first betting round with this player
Trying rule #1
Testing the predicate: (bluffing)
Returned value is ()
From the second betting round with this player
Trying rule #1
Testing the predicate: (bluffing)
Returned value is #t
Firing rule #1
There are several ways. Here is one:
(let ((dealt-cards (cons (first (my/cards)) ; your hole card
(apply append
; get public cards for all players
(map (lambda (p) (public-cards p))
all/players)))))
(list-transform-negative (ordered-deck)
(lambda (c)
(member c dealt-cards))))
Here I use the MIT Scheme extension list-transform-negative,
but you could also write your own little function to do this. I've
accessed information on what cards have been dealt through provided
functions. You could also access the public/hand-information
and private/hand-information data structures directly.