[Tutor] Re: How do you define the value of ACE in black jack

Derrick 'dman' Hudson dman@dman.ddts.net
Mon Feb 17 20:09:02 2003


--SLDf9lqlvOQaIe6s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Feb 18, 2003 at 01:43:17AM +0100, Ole Jensen wrote:
|=20
| In Black Jack the value of the ACE depends on the sum of your cards
| if the sum is lower than 21, the value of your ACE is 11 however if
| the sum of your cards increase to more than 21(if ace counts for 11)
| then your ACE drops to the value of one.

This is part of the "business logic" of your program.

| How would you define the value of ACE in python to the rules of Black Jac=
k?

As an instance of a class.  I would make a "Card" class.  Each Card
has a face-value associated with it.  "Ace" is one of those
face-values.  Simply create a constant (integer or string, it doesn't
matter since it will never be seen outside your program) to
differentiate them. =20

In the business logic, as you compute the player's total, you will
assign a numeric "score" for use in computation.

The score is not the same as the identification, so don't intermix the
two.

HTH,
-D

--=20
A perverse man stirs up dissension,
and a gossip separates close friends.
        Proverbs 16:28
=20
http://dman.ddts.net/~dman/

--SLDf9lqlvOQaIe6s
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj5Rh6IACgkQO8l8XBKTpRQZLwCfdrBdedEGKJ1FdoxX2tYgaCJl
wg8AoI+jDTqVfETe9D5lqeRIcch6wlJJ
=5Lez
-----END PGP SIGNATURE-----

--SLDf9lqlvOQaIe6s--