Re: [stella] Poker solitaire source, versions 012 & 014

Subject: Re: [stella] Poker solitaire source, versions 012 & 014
From: "B. Watson" <urchlay@xxxxxxxxxxxxxxxx>
Date: Wed, 28 Nov 2001 03:28:20 -0500 (EST)
On Tue, 27 Nov 2001, Jake Patterson wrote:

> On Mon, 26 Nov 2001, B. Watson wrote:
> >
> > Also attached is the .bin built from the 014 source, for those
> > who just wanna play the game :)
> >
> I don't know if it is intentional or not, but it is possible to get a very
> weekly shuffled hand at will by hitting reset, then the joystick button
> immediately.  The first hand I played with that technique I got 105 (it
> still is a little shuffled) with two straight flushes and a bunch of other
> stuff.  Also, when the tens place in the score is zero, it is not
> displayed even when it is significant.  It does display a zero in the ones
> place if thats what you get.  Took me four tries to get an actual zero :-)
> My best score with a normal shuffle is 91.

The shuffling problem isn't exactly intentional, but it's a known problem.
The trouble is that I store the cards as a byte each, 0-12 being ace thru
king of spades, 13-25 is ace-king of clubs, etc... and I'm initializing the
cards in a simple loop that stores 0 to 52 sequentially in the deck locations.
So the deck is in order before the shuffle..

Then on each frame of the shuffle, I do this (in pseudocode):

for i = 0 to 50
  if random_bit() == 1
    swap deck[i], deck[i+1]
   (don't swap)
  end if
next i

...the net result is that the deck gets decently shuffled after a few seconds
of watching it shuffle, but it starts out with each card being pretty close
to where it started and slowly they move around.

I considered forcing the player to sit through at least 200 frames of shuffle,
but (a) that's a fairly long wait, and (b) the random number generator isnt
really all that random, and it gets seeded to the same value on every boot.
So if you were forced to wait 200 frames, you could just hold down the fire
button and wait 200 frames, and you'd get the same hand every time!

Possible solutions to this:

Use the random garbage that's in the RAM and TIA
	registers at power-up to generate the initial seed... this won't
	help on an emulator.

Require the player to press and release the button *twice* before starting
the first game, then use the time between the two as part of the random
number seed... Could add a title screen that appears at bootup, and have
the player press the button to get to the shuffling screen (and this would
look more professional too?)

...The tens digit not being displayed, is a 100% Genuine Bug. I have yet to
score above 100, so I havent seen it yet.

I'm attaching the latest .bin to this message. The main difference in gameplay
between this build (017) and the last one I posted (014) is that the right
difficulty now controls whether or not diagonals will be scored. If they
will, an X appears below the 2nd digit of your score. The diff. switches
are only checked during the shuffle, so you can't change your mind about
this halfway through the game :)

So here's what the controls do:

Reset - Start a new shuffle (abort current game if playing)
Select - Show `crib sheet' of score values
Color/BW - What it's supposed to do :)
Left Difficulty - B = normal game, A = Handicap game (deals 1st 5 cards
	to center & corners)
Right Difficulty - B = Score diagonals (easy),
	A = Don't score diagonals (hard) (this is another form of
Fire button - Start game during shuffle, place card during game
Directions - The obvious.

For a proper `classic' feel, Select should be `select game variation', but
I can't think of any more variations besides the 2 difficulty setting I have
now... Suggestions?

I *still* haven't started on the centered kernel, that's next on the
agenda... well, fixing the 10's digit bug is next, but won't take long.


Attachment: pokersol_017.bin
Description: Binary data

Current Thread