Dice Black Jack

Problem #231

Tags: special games challenge arena c-0 scheme

This task has a Challenge attached.
You may View Stats or read a Help on Challenges.
Wow! there is also Arena for this challenge!

No translations... yet

This game is described by Jacques Arsac in his "Programming of Games and Puzzles", while he references J-C Baillif as author.

Interactive Dice Black Jack Simulator


We want some simple game yet allowing basic strategy, to introduce and test our new "Arena" feature. Solution should be in Scheme so feel free to try Introducing Scheme if you haven't yet.

Rules

Two players are throwing single die in turns. On every turn player can cast die more than once, summing up the score for this turn - until he/she decides to pass the turn to the opponent - or the value 1 is thrown.

If turn is passed voluntarily, sum score for this turn is added to player's total. However if turn ended with getting 1, score for the turn is nullified (nothing is added to total).

Winner is one who first reaches total of 100.

Game example:

Problem Statement

Write function in Scheme which implements some strategy for playing this game. Function should be named player and have 5 arguments:

(define (player my-total other-total accum current state)
    ...
    )

Function is called after every throw and should return #t or #f depending on whether you want to continue throwing in current turn or not. If you have just thrown 1, then your turn ends anyway (return value is ignored).

Parameters to this function are:

So, for example, second turn by Anna in the example above will call your function with arguments 14, 15, 0, 4 (...) first, then 14, 15, 4, 1 (...) and her turn ends involuntarily.

Input / Output

Your code shouldn't print anything. Your function will be used by checker to conduct match of 49 games against dummy player (quite simpleton strategy). To pass the check you need win 25 or more games.

Trivial "player" function would be like this:

; coward strategy - it never asks to continue
; thus slowly accumulating score with 1-throw turns
; obviously it needs not examine any of its parameters

(define (player my-total other-total accum current state)
    #f)

You can also grab "playable" code with one "interactive" player, to experiment with your solution - here.

Amount of games won determines your challenge score (25 gives score of 0.04 while 49 gives score of 1.00).

Main feature, however, is "Arena" - you can visit it by the link somewhere above and try your strategy against those submitted by other players. In "Arena" you also participate in match of 49 games agains opponent you chose. In both cases your code becomes "second" player in the first game - and then sides swap for every next game (so you play 25 games as "second" and 24 as "first").

You need to login to get test data and submit solution.