Organization: Arizona State University
Date: Monday, 11 Jan 1993 18:37:06 MST
From: <AZAXV@ASUACAD.BITNET>
Newsgroups: comp.ai.genetic
Subject: Black Jack - a first pass

Hi,

I've been thinking about the black jack problem and I'd like to
offer a starting point, if not a solution...

OBJECTIVE: to develop a population of very good (to be defined in
terms of %wins) black jack players, genetically, through some
evolutionary process, using what I understand to be a genetic
algorithm.

At the start, some number of players will be given a genetic code
(see below) and paired with an honest dealer, with an honest deck,
that gets reshuffled after each hand. Each player is associated
with a running %win value; when a player wins 5 (or?) hands in a
row, it gets to mate with another player with the highest %win
value that is still alive. (Mating is described below.) E.g., as
your simulator cycles through each living player, making a single
decision/play each time one is selected, it gets to mate with the
first other player that has the highest %win value. When a player
loses 5 (or?) hands in a row, it dies. Mating results in a newly
created player with a %win=0 and a combination of the genetic codes
from the two mating players. (Still with me?)

The genetic code is exactly two integers, between zero and 11. The
first integer is the highest value that the player may hold, and
still take another card from the dealer (zero is a special case,
described below). UNLESS, the dealer is SHOWING an amount that is
greater than the second integer in the genetic code array. A zero
in either of the two integer values means that the value is really
calculated each time a decision is needed, as the average value of
the UNSEEN cards; i.e., the number/values (ace=1|11?) of cards that
the player cannot know about: dealer's down cards and those in the
deck. Note that the player makes a decision to request another card
based on the value of the first integer in its genetic code, but a
decision to draw might be blocked by the value (or calculated value,
remember) of the second integer. I leave the dealer's algorithm up
to the reader; perhaps this may be a variable that one might wish
to examine and optimize in order to produce (evolve) better players.

Mating produces a genetic code that is an arithmetic average of the
values from each of the mating players; when one (or both) player
is a "calculator" (a zero value causes it to dynamically evaluate
the value from the card values it can "see"), the offspring (as a
first pass anyway) might take on that trait. (I fear that the en-
tire population might become calculators very quickly if this is a
rule, but I have not yet tried to code this.)

Finally, I remember something about "splits/doubles", "dealer wins"
in a tie, and other such rules that I will leave to those who better
understand the game.

Your original population might be normally distributed about reasonable
values for first and second integer codes, reserving say 2% for some
initial calculators.

An example player might be created with an array containing /17,8/ with
an initial %wins=0.0. The first number in its genetic code (17) says it
will decide to draw another card if it holds (down + shown card values)
at most 17 points, but it will NOT draw in that case if the dealer has
cards totaling 9 or better showing (tens and face cards are 10 points,
and aces are 1 or 11; I'm not sure yet how to handle ace values).

I am suited up, but I hope I'll get at least partial credit for taking
a crack at this. I plan to try this in C, probably under DOS.

                   ./alex

azaxv@asuvm.inre.asu.edu
CS graduate student