I'd love to gloat about all the parts I like now, but I think it would be better to go back and look at the steps it took to get here. Here's some screenshots from development, notes I recorded, and comparisons between this release (Xmas 2013) and the original late 2007 demo that was shown to a few people.
Comments from a defunct .hss, late 2007. Probably the first notes I took. Notice how I don't understand how ties are broken in Poker. Notice too that I'm using 3 global variables (Value (0-51),Suit (0-3),FaceValue (0-12?) for each of the ten cards in the Player/AI's hands.
Slices made Value obsolete, Suit is determined by SpriteFrame and Face Value by Spriteset Number in the modern version.
Code: Select all
#Suits: Clubs, Diamonds, Spades, Hearts
#Suits: 0, 1, 2, 3
#Suits: Divide by 13 to find suit and value.
#Suits: x/13 = suit
#Suits: The remainder (x,mod,13) is the value of the card.
#Test: For the test, you need to have buttons for increasing and
#Test: decreasing card value. Another button will select which
#Test: card you're modifying, another will sort the cards by value
#Test: then suit. A final button, will ask the computer to take
#Test: appraisal of the current hand, and estimate it's value.
#Hands: Royal Flush 9
#Hands: Straight Flush 8
#Hands: Four of a Kind 7
#Hands: Full House 6
#Hands: Flush 5
#Hands: Straight 4
#Hands: Three of A Kind 3
#Hands: Two Pair 2
#Hands: One Pair 1
#Hands: High Card
#Hands: If the hands are of equal value, check either the suit or
#Hands: or highest relative card.
Make note, that at this point in time graphical effects were still done with NPCs.
Again, slices simplify the modern version. This whole thing could be replaced with like two lines, simply changing a card sprite's parent.
Code: Select all
script,CompDrawFive,begin
setvariable (CCardFive,random (0,51))
if (CCardFive==CardOne,or,CCardFive==CardTwo,or,CCardFive==CardThree,or,CCardFive==CardFour,or,CCardFive==CardFive,or,
CCardFive==CCardOne,or,CCardFive==CCardTwo,or,CCardFive==CCardThree,or,CCardFive==CCardFour)
then (CompDrawFive)
else (CompSortFive)
#setvariable (CCardFiveFace,CCardFive,mod,13)
#setvariable (CCardFiveSuit,CCardFive/13)
#alternpc (14,npcstat:picture,CCardFiveSuit)
#alternpc (19,npcstat:picture,CCardFiveFace+4))
endIn 2007, it looked like this to sort for one particular instance:
Code: Select all
script,CompSortFive,begin
if (CCardFive,mod,13>=CCardFour,mod,13)
then (
setvariable (CCardFiveFace,CCardFive,mod,13)
setvariable (CCardFiveSuit,CCardFive/13)
alternpc (14,npcstat:picture,CCardFiveSuit)
alternpc (19,npcstat:picture,CCardFiveFace+4))
else (
if (CCardFive,mod,13>=CCardThree,mod,13)
then (
setvariable (VCSort5,CCardFour)
setvariable (VCSort4,CCardFive)
setvariable (VCSort3,CCardThree)
setvariable (VCSort2,CCardTwo)
setvariable (VCSort1,CCardOne))
else (
if (CCardFive,mod,13>=CCardTwo,mod,13)
then (
setvariable (VCSort5,CCardFour)
setvariable (VCSort4,CCardThree)
setvariable (VCSort3,CCardFive)
setvariable (VCSort2,CCardTwo)
setvariable (VCSort1,CCardOne))
else (
if (CCardFive,mod,13>=CCardOne,mod,13)
then (
setvariable (VCSort5,CCardFour)
setvariable (VCSort4,CCardThree)
setvariable (VCSort3,CCardTwo)
setvariable (VCSort2,CCardFive)
setvariable (VCSort1,CCardOne))
else (
setvariable (VCSort5,CCardFour)
setvariable (VCSort4,CCardThree)
setvariable (VCSort3,CCardTwo)
setvariable (VCSort2,CCardOne)
setvariable (VCSort1,CCardFive))
)
)
setvariable (CCardOne,VCSort1)
setvariable (CCardTwo,VCSort2)
setvariable (CCardThree,VCSort3)
setvariable (CCardFour,VCSort4)
setvariable (CCardFive,VCSort5)
setvariable (CCardOneFace,CCardOne,mod,13)
setvariable (CCardOneSuit,CCardOne/13)
setvariable (CCardTwoFace,CCardTwo,mod,13)
setvariable (CCardTwoSuit,CCardTwo/13)
setvariable (CCardThreeFace,CCardThree,mod,13)
setvariable (CCardThreeSuit,CCardThree/13)
setvariable (CCardFourFace,CCardFour,mod,13)
setvariable (CCardFourSuit,CCardFour/13)
setvariable (CCardFiveFace,CCardFive,mod,13)
setvariable (CCardFiveSuit,CCardFive/13)
alternpc (10,npcstat:picture,CCardOneSuit)
alternpc (11,npcstat:picture,CCardTwoSuit)
alternpc (12,npcstat:picture,CCardThreeSuit)
alternpc (13,npcstat:picture,CCardFourSuit)
alternpc (14,npcstat:picture,CCardFiveSuit)
alternpc (15,npcstat:picture,CCardOneFace+4)
alternpc (16,npcstat:picture,CCardTwoFace+4)
alternpc (17,npcstat:picture,CCardThreeFace+4)
alternpc (18,npcstat:picture,CCardFourFace+4)
alternpc (19,npcstat:picture,CCardFiveFace+4))
end
Code: Select all
script,SortHand,WhatHand,CalcValue=0,begin
settag (tag:Working,on)
variable (TempSort)
TempSort := firstchild (WhatHand)
while (TempSort) do (
setsortorder (TempSort,getspritesetnumber (TempSort))
TempSort := NextSibling (TempSort)
)
sortchildren (WhatHand)
settag (tag:Working,off)
end