Frame 1
total_bytesstart = _root.getBytesTotal();
loaded_bytesstart = _root.getBytesLoaded();
percent_doneone = int((loaded_bytesstart / total_bytesstart) * 100);
bartwo.innerbar._xscale = percent_doneone;
if (_framesloaded == _totalframes) {
_root.gotoAndPlay("start");
}
Frame 2
gotoAndPlay (1);
Frame 4
loadMovieNum ("gs_song.swf", 88);
Frame 166
stop();
Frame 182
stop();
Frame 183
Frame 199
stop();
var chosenPlayer1 = 0;
var chosenPlayer2 = 0;
chosenPlayer2 = 2;
Frame 219
if (typeof(_global.AsSetupPackage) == "undefined") {
_global.AsSetupPackage = function (path) {
var a = path.split(".");
var o = _global;
var i = 0;
while (i < a.length) {
var name = a[i];
if (o[name] == undefined) {
o[name] = new Object();
}
o = o[name];
i++;
}
};
}
if (typeof(_global.AsDependencyCheck) == "undefined") {
_global.AsDependencyCheck = function (path, caller) {
if (typeof(eval ("_global." + path)) == "undefined") {
trace((((" " + caller) + ": WARNING! '") + path) + "' has not been previously defined");
} else {
trace((((" " + caller) + ": OK! '") + path) + "' has been defined");
}
};
} else {
trace("AsDependencyCheck been previously defined");
}
AsSetupPackage("org.hsieh.lang");
AsDependencyCheck("AsSetupPackage", "org.hsieh.lang.Assertion");
org.hsieh.lang.Assertion = function () {
};
org.hsieh.lang.Assertion.Assert = function (args) {
if (arguments.length == 2) {
org.hsieh.lang.Assertion.AssertTrue(arguments[0], arguments[1]);
} else {
org.hsieh.lang.Assertion.AssertTrue(arguments[0]);
}
};
org.hsieh.lang.Assertion.AssertTrue = function (args) {
if (arguments.length == 2) {
var message = arguments[0];
var condition = arguments[1];
} else {
var message = "";
var condition = arguments[0];
}
if (condition == false) {
org.hsieh.lang.Assertion.Fail("Expected True " + message);
}
};
org.hsieh.lang.Assertion.AssertNull = function (args) {
if (arguments.length == 2) {
var message = arguments[0];
var condition = arguments[1];
} else {
var message = "";
var condition = arguments[0];
}
if (condition != null) {
org.hsieh.lang.Assertion.Fail("Expected Null " + message);
}
};
org.hsieh.lang.Assertion.AssertNotNull = function (args) {
if (arguments.length == 2) {
var message = arguments[0];
var condition = arguments[1];
} else {
var message = "";
var condition = arguments[0];
}
if (condition == null) {
org.hsieh.lang.Assertion.Fail("Expected Not Null " + message);
}
};
org.hsieh.lang.Assertion.AssertEquals = function (args) {
if (arguments.length == 3) {
var message = arguments[0];
var expected = arguments[1];
var actual = arguments[2];
} else {
var message = "";
var expected = arguments[0];
var actual = arguments[1];
}
var condition = false;
if (expected.Equals != null) {
condition = expected.Equals(actual);
} else {
condition = expected == actual;
}
if (condition == false) {
org.hsieh.lang.Assertion.FailNotEquals(message, expected, actual);
}
};
org.hsieh.lang.Assertion.AssertSame = function (args) {
if (arguments.length == 3) {
var message = arguments[0];
var expected = arguments[1];
var actual = arguments[2];
} else {
var message = "";
var expected = arguments[0];
var actual = arguments[1];
}
if (((typeof(expected) == "number") || (typeof(expected) == "string")) || (typeof(expected) == "boolean")) {
org.hsieh.lang.Assertion.FailNotSame(message + " <not reference objects>", expected, actual);
} else if (expected != actual) {
org.hsieh.lang.Assertion.FailNotSame(message, expected, actual);
}
};
org.hsieh.lang.Assertion.Fail = function (message) {
trace(message);
};
org.hsieh.lang.Assertion.FailNotEquals = function (message, expected, actual) {
org.hsieh.lang.Assertion.Fail(((((message + "\n -expected:\t<") + expected) + "> \n -actual:\t<") + actual) + ">");
};
org.hsieh.lang.Assertion.FailNotSame = function (message, expected, actual) {
org.hsieh.lang.Assertion.Fail(message + " expected same");
};
_global.Assert = org.hsieh.lang.Assertion.Assert;
_global.AssertSame = org.hsieh.lang.Assertion.AssertSame;
_global.AssertEquals = org.hsieh.lang.Assertion.AssertEquals;
_global.AssertNotNull = org.hsieh.lang.Assertion.AssertNotNull;
_global.AssertNull = org.hsieh.lang.Assertion.AssertNull;
_global.AssertTrue = org.hsieh.lang.Assertion.AssertTrue;
AsSetupPackage("org.hsieh.util");
AsDependencyCheck("AsSetupPackage", "org.hsieh.util.Collection");
org.hsieh.util.Collection = function () {
this.aCollection = new Array();
this.iteratorIndex = 0;
};
org.hsieh.util.Collection.prototype.append = function (value) {
this.aCollection.push(value);
};
org.hsieh.util.Collection.prototype.remove = function (whichOne) {
if ((whichOne <= 0) && (whichOne < this.aCollection.length)) {
}
return(this.aCollection.splice(whichOne, 1));
};
org.hsieh.util.Collection.prototype.empty = function () {
aOther = this.aCollection.slice(0, aCollection.length);
this.aCollection.length = 0;
return(aOther);
};
org.hsieh.util.Collection.prototype.iteratorReset = function () {
this.iteratorIndex = 0;
};
org.hsieh.util.Collection.prototype.iteratorNext = function () {
var returnValue = null;
if (this.iteratorIndex < this.aCollection.length) {
}
returnValue = this.aCollection[this.iteratorIndex];
this.iteratorIndex++;
return(returnValue);
};
org.hsieh.util.Collection.prototype.shuffle = function () {
var index = (this.aCollection.length - 1);
var temp = 0;
var randomSwap = 0;
while (index >= 0) {
randomSwap = Math.floor(Math.random() * this.aCollection.length);
temp = this.aCollection[index];
this.aCollection[index] = this.aCollection[randomSwap];
this.aCollection[randomSwap] = temp;
index--;
}
};
org.hsieh.util.Collection.prototype.merge = function (aMerge) {
var mergeIndex = aMerge.length;
while (mergeIndex > 0) {
this.aCollection.push(aMerge.shift());
mergeIndex--;
}
};
trace("Done with Collection.as");
AsSetupPackage("org.hsieh.blackjack");
AsDependencyCheck("AsSetupPackage", "org.hsieh.blackjack.BlackJack");
AsDependencyCheck("org.hsieh.util.Collection", "org.hsieh.blackjack.BlackJack");
org.hsieh.blackJack.BlackJack = function (aPlayerChoice, dealer_mc, aCurtain_mc, indicator_mc, aFloorWin_mc, deckCount) {
this.playerCount = aPlayerChoice.length;
this.dealer_mc = dealer_mc;
this.aCurtain_mc = aCurtain_mc;
this.indicator_mc = indicator_mc;
this.aFloorWin_mc = aFloorWin_mc;
this.deckCount = deckCount;
aComputerSelectPool = new Array(1, 2, 3);
aComputerSelectPool.splice(aPlayerChoice[0] - 1, 1);
this.aPlayer = new Array();
var counter = 1;
while (counter <= this.PlayerCount) {
if (counter != this.PlayerCount) {
this.aPlayer[counter] = new org.hsieh.blackjack.Player(counter, aPlayerChoice.shift(), false);
} else {
this.aPlayer[counter] = new org.hsieh.blackjack.Player(counter, aComputerSelectPool[Math.floor(Math.random() * 2)], true);
}
counter++;
}
this.shoe = new org.hsieh.util.Collection();
var deckCounter = 0;
while (deckCounter < deckCount) {
var counter = 1;
while (counter <= 52) {
this.shoe.append(counter);
counter++;
}
deckCounter++;
}
this.shoe.shuffle();
this.discardPile = new org.hsieh.util.Collection();
this.currentPlayerIndex = 0;
this.currentPlayerAction = 0;
this.dealerState = this.STATE_OPENING_DEAL;
this.currentState = this.preMainLoop;
};
org.hsieh.blackjack.Blackjack.CARD_BACKFACE_FRAME = 53;
org.hsieh.blackjack.Blackjack.CARD_LAYOUT_MAX_COUNT = 11;
org.hsieh.blackjack.Blackjack.STATE_OPENING_DEAL = 1;
org.hsieh.blackjack.Blackjack.STATE_WAITING = 2;
org.hsieh.blackjack.Blackjack.STATE_DEALING = 3;
org.hsieh.blackjack.Blackjack.STATE_WAITING = 4;
org.hsieh.blackjack.Blackjack.STATE_WAITING = 5;
org.hsieh.blackjack.Blackjack.STATE_WAITING = 6;
org.hsieh.blackjack.Blackjack.ACTION_HIT = 1;
org.hsieh.blackjack.Blackjack.ACTION_STAND = 2;
org.hsieh.blackJack.BlackJack.getCardValue = function (card) {
if (card < 0) {
card = card * -1;
}
var value = (card % 13);
if ((value == 0) or (value >= 11)) {
value = 10;
} else if (value == 1) {
value = 11;
}
return(value);
};
org.hsieh.blackJack.BlackJack.getHandValue = function (hand) {
var currentCard = 0;
var currentCardValue = 0;
var currentHandValue = 0;
var currentAceCount = 0;
if (hand instanceof org.hsieh.util.Collection) {
hand.iteratorReset();
while (((currentCard = hand.iteratorNext())) != null) {
currentCardValue = org.hsieh.blackJack.BlackJack.getCardValue(currentCard);
if (currentCardValue == 11) {
currentAceCount++;
}
currentHandValue = currentHandValue + currentCardValue;
}
while ((currentHandValue > 21) && (currentAceCount > 0)) {
currentHandValue = currentHandValue - 10;
currentAceCount--;
}
return(currentHandValue);
}
return(null);
};
org.hsieh.blackJack.BlackJack.prototype.playerHit = function () {
if (!this.dealer_mc.isAnimating) {
if (this.shoe.aCollection.length == 0) {
this.shoe.merge(this.discardPile.empty());
this.shoe.shuffle();
}
this.dealer_mc.dealCardCounter = 1;
this.dealer_mc.gotoAndPlay("deal");
this.currentPlayerAction = org.hsieh.blackjack.Blackjack.ACTION_HIT;
}
};
org.hsieh.blackJack.BlackJack.prototype.playerStand = function () {
this.currentPlayerAction = org.hsieh.blackjack.Blackjack.ACTION_STAND;
if ((++this.currentPlayerIndex) < this.playerCount) {
this.currentState = this.preMainloop;
} else {
this.currentState = this.preEndRoundLoop;
}
};
org.hsieh.blackJack.BlackJack.prototype.checkCurtain = function () {
var tempMC = null;
var i = 0;
while (i < this.playerCount) {
if (this.aCurtain_mc[i].isAnimating && (this.aCurtain_mc[i].isCovered)) {
tempMC = this.aPlayer[i + 1];
if (tempMC.testGameState(org.hsieh.blackjack.Player.GAMESTATE_WIN)) {
tempMC.dress();
tempMC.setGameState(org.hsieh.blackjack.Player.GAMESTATE_PAID);
} else if (tempMC.testGameState(org.hsieh.blackjack.Player.GAMESTATE_LOSE)) {
tempMC.undress();
tempMC.setGameState(org.hsieh.blackjack.Player.GAMESTATE_PAID);
}
this.aCurtain_mc[i].isCovered = false;
}
i++;
}
};
org.hsieh.blackJack.BlackJack.prototype.preDealOpenLoop = function () {
this.currentPlayerIndex = 0;
var i = 0;
while (i < this.playerCount) {
this.discardPile.merge(this.aPlayer[i + 1].hand.empty());
this.aPlayer[i + 1].resetRound();
i++;
}
this.dealer_mc.dealCardCounter = this.playerCount * 2;
if (this.shoe.aCollection.length < this.dealer_mc.dealCardCounter) {
this.shoe.merge(this.discardPile.empty());
this.shoe.shuffle();
}
};
org.hsieh.blackJack.BlackJack.prototype.dealOpenLoop = function () {
if (this.dealer_mc.isCardArrived) {
var tempIndex = ((this.dealer_mc.dealCardCounter % this.playerCount) + 1);
var aTempCard = this.shoe.remove(0);
var tempCard = aTempCard[0];
if (tempCard < 0) {
tempCard = tempCard * -1;
}
if (this.dealer_mc.dealCardCounter == (((this.playerCount * 2) - this.playerCount) - 1)) {
tempCard = tempCard * -1;
}
this.aPlayer[tempIndex].acceptCard(tempCard);
}
};
org.hsieh.blackJack.BlackJack.prototype.preMainLoop = function () {
this.dealer_mc.isCardArrived = false;
var i = 0;
while (i < this.aFloorWin_mc.length) {
this.aFloorWin_mc[i].gotoAndStop("idle");
i++;
}
this.aFloorWin_mc[this.currentPlayerIndex].gotoAndPlay("flash");
this.indicator_mc.gotoAndPlay("animate" + (this.currentPlayerIndex + 1));
this.aPlayer[this.currentPlayerIndex + 1].faceupAllCards();
this.currentState = this.mainloop;
};
org.hsieh.blackJack.BlackJack.prototype.mainLoop = function () {
var tempMC = this.aPlayer[this.currentPlayerIndex + 1];
if (this.dealer_mc.isCardArrived) {
var aTempCard = this.shoe.remove(0);
var tempCard = aTempCard[0];
if (tempCard < 0) {
tempCard = tempCard * -1;
}
this.dealer_mc.isCardArrived = false;
var tempValue = tempMC.acceptCard(tempCard);
if (tempValue > 21) {
tempMC.gameState = org.hsieh.blackjack.Player.GAMESTATE_BUST + org.hsieh.blackjack.Player.GAMESTATE_LOSE;
this.aCurtain_mc[this.currentPlayerIndex].gotoAndPlay("animate");
this.playerStand();
}
}
if (((!this.dealer_mc.isAnimating) && (!this.aCurtain_mc[this.currentPlayerIndex].isAnimating)) && (tempMC.isComputer)) {
var isHit = true;
var inPlayCount = 0;
var i = 0;
while (i < this.playerCount) {
if (this.aPlayer[i + 1].testGameState(org.hsieh.blackjack.Player.GAMESTATE_INPLAY) && (!this.aPlayer[i + 1].isComputer)) {
inPlayCount++;
}
i++;
}
if (inPlayCount > 0) {
isHit = tempMC.ai_hitOrStay();
if (isHit) {
this.playerHit();
} else {
this.playerStand();
}
} else {
this.playerStand();
}
}
this.checkCurtain();
};
org.hsieh.blackJack.BlackJack.prototype.preEndRoundLoop = function () {
var tempArray = new Array();
var i = 0;
while (i < this.playerCount) {
tempArray[i] = {handValue:org.hsieh.blackJack.BlackJack.getHandValue(this.aPlayer[i + 1].hand), player_id:i + 1, player_mc:this.aPlayer[i + 1]};
i++;
}
tempArray.sortOn("handValue");
tempArray.reverse();
var winnerId = -1;
var winnerValue = -1;
var i = 0;
while (i < this.playerCount) {
if ((winnerId == -1) && (tempArray[i].handValue <= 21)) {
winnerId = i;
winnerValue = tempArray[i].handValue;
tempArray[i].player_mc.setGameState(org.hsieh.blackjack.Player.GAMESTATE_WIN);
} else if (tempArray[i].handValue == winnerValue) {
tempArray[i].player_mc.setGameState(org.hsieh.blackjack.Player.GAMESTATE_PUSH);
tempArray[winnerId].player_mc.setGameState(org.hsieh.blackjack.Player.GAMESTATE_PUSH);
} else {
tempArray[i].player_mc.setGameState(org.hsieh.blackjack.Player.GAMESTATE_LOSE);
}
i++;
}
var i = 0;
while (i < this.playerCount) {
var temp_mc = this.aPlayer[i + 1];
var isAnimateCurtain = false;
if (!temp_mc.testGameState(org.hsieh.blackjack.Player.GAMESTATE_PAID)) {
if (temp_mc.testGameState(org.hsieh.blackjack.Player.GAMESTATE_PUSH)) {
temp_mc.setGameState(org.hsieh.blackjack.Player.GAMESTATE_PAID);
} else if (temp_mc.testGameState(org.hsieh.blackjack.Player.GAMESTATE_WIN) && (!temp_mc.isFullyDressed())) {
isAnimateCurtain = true;
} else if (temp_mc.testGameState(org.hsieh.blackjack.Player.GAMESTATE_WIN) && (temp_mc.isFullyDressed())) {
temp_mc.setGameState(org.hsieh.blackjack.Player.GAMESTATE_PAID);
} else if (temp_mc.testGameState(org.hsieh.blackjack.Player.GAMESTATE_LOSE)) {
isAnimateCurtain = true;
}
if (isAnimateCurtain && (!this.aCurtain_mc[i].isAnimating)) {
this.aCurtain_mc[i].gotoAndPlay("animate");
}
}
i++;
}
this.currentState = this.endRoundLoop;
};
org.hsieh.blackJack.BlackJack.prototype.endRoundLoop = function () {
this.checkCurtain();
var checker = true;
var i = 0;
while (i < this.playerCount) {
if (!this.aPlayer[i + 1].testGameState(org.hsieh.blackjack.Player.GAMESTATE_PAID)) {
checker = false;
}
if (this.aCurtain_mc[i].isAnimating) {
checker = false;
}
i++;
}
if (checker) {
if (this.aPlayer[1].isNaked()) {
this.dealer_mc.gotoAndPlay("lose");
gotoAndPlay (250);
} else if (this.aPlayer[2].isNaked()) {
this.dealer_mc.gotoAndPlay("win");
gotoAndPlay (250);
} else {
this.currentState = this.preMainLoop;
gotoAndPlay (223);
}
}
};
AsSetupPackage("org.hsieh.blackjack");
AsDependencyCheck("AsSetupPackage", "org.hsieh.blackjack.TestBlackJack");
AsDependencyCheck("org.hsieh.lang.Assertion", "org.hsieh.blackjack.TestBlackJack");
AsDependencyCheck("org.hsieh.util.Collection", "org.hsieh.blackjack.TestBlackJack");
AsDependencyCheck("org.hsieh.blackjack.BlackJack", "org.hsieh.blackjack.TestBlackJack");
org.hsieh.blackjack.TestBlackJack = function () {
};
org.hsieh.blackJack.TestBlackJack.executeTest = function () {
org.hsieh.blackJack.TestBlackJack.testGetCardValue();
org.hsieh.blackJack.TestBlackJack.testGetHandValue();
};
org.hsieh.blackJack.TestBlackJack.testGetCardValue = function () {
trace("** Testing getCardValue");
AssertTrue("Ace equals 11", org.hsieh.blackJack.BlackJack.getCardValue(1) == 11);
AssertTrue("2 equals 2", org.hsieh.blackJack.BlackJack.getCardValue(2) == 2);
AssertTrue("3 equals 3", org.hsieh.blackJack.BlackJack.getCardValue(3) == 3);
AssertTrue("4 equals 4", org.hsieh.blackJack.BlackJack.getCardValue(4) == 4);
AssertTrue("5 equals 5", org.hsieh.blackJack.BlackJack.getCardValue(5) == 5);
AssertTrue("6 equals 6", org.hsieh.blackJack.BlackJack.getCardValue(6) == 6);
AssertTrue("7 equals 7", org.hsieh.blackJack.BlackJack.getCardValue(7) == 7);
AssertTrue("8 equals 8", org.hsieh.blackJack.BlackJack.getCardValue(8) == 8);
AssertTrue("9 equals 9", org.hsieh.blackJack.BlackJack.getCardValue(9) == 9);
AssertTrue("10 equals 10", org.hsieh.blackJack.BlackJack.getCardValue(10) == 10);
AssertTrue("J equals 10", org.hsieh.blackJack.BlackJack.getCardValue(11) == 10);
AssertTrue("Q equals 10", org.hsieh.blackJack.BlackJack.getCardValue(12) == 10);
AssertTrue("K equals 10", org.hsieh.blackJack.BlackJack.getCardValue(13) == 10);
AssertTrue("Ace equals 11", org.hsieh.blackJack.BlackJack.getCardValue(14) == 11);
trace("** End Testing getCardValue");
};
org.hsieh.blackJack.TestBlackJack.testGetHandValue = function () {
trace("** Testing getHandValue");
var testCollection = (new org.hsieh.util.Collection());
testCollection.append(1);
testCollection.append(13);
AssertTrue("Ace + King = 21", org.hsieh.blackJack.BlackJack.getHandValue(testCollection) == 21);
testCollection.empty();
testCollection.append(1);
AssertTrue("Ace = 11", org.hsieh.blackJack.BlackJack.getHandValue(testCollection) == 11);
testCollection.append(2);
AssertTrue("Ace + 2 = 13", org.hsieh.blackJack.BlackJack.getHandValue(testCollection) == 13);
testCollection.append(6);
AssertTrue("Ace + 2 + 6 = 19", org.hsieh.blackJack.BlackJack.getHandValue(testCollection) == 19);
testCollection.append(5);
AssertTrue("Ace + 2 + 6 + 5 = 24 - 10 = 14", org.hsieh.blackJack.BlackJack.getHandValue(testCollection) == 14);
testCollection.append(14);
AssertTrue("Ace + 2 + 6 + 5 + Ace = 14 + 11 - 10 = 15", org.hsieh.blackJack.BlackJack.getHandValue(testCollection) == 15);
testCollection.append(12);
AssertTrue("Ace + 2 + 6 + 5 + Ace + Q = 25", org.hsieh.blackJack.BlackJack.getHandValue(testCollection) == 25);
trace("** End Testing getHandValue");
};
AsSetupPackage("org.hsieh.blackjack");
AsDependencyCheck("AsSetupPackage", "org.hsieh.blackjack.Player");
AsDependencyCheck("org.hsieh.util.Collection", "org.hsieh.blackjack.Player");
AsDependencyCheck("org.hsieh.blackjack.BlackJack", "org.hsieh.blackjack.Player");
org.hsieh.blackJack.Player = function (id, playerChoice, isComputer) {
this.id = id;
this.isComputer = isComputer;
this.playerChoice = playerChoice;
this.hand = new org.hsieh.util.Collection();
this.gameState = 0;
var temp_mc = null;
this.playerStripperView_mc = eval (((("_root.player" + this.id) + "chick") + this.playerChoice) + "_mc");
this.playerStripperView_mc._visible = true;
this.playerStripperView_mc.gotoAndStop("idle1");
this.aPlayerCardView_mc = new Array();
this.index_playerCardView_mc = 0;
var counter = 1;
while (counter <= org.hsieh.blackjack.Blackjack.CARD_LAYOUT_MAX_COUNT) {
temp_mc = eval (((("_root.player" + id) + "Card") + counter) + "_mc");
this.aPlayerCardView_mc.push(temp_mc);
counter++;
}
this.resetRound();
};
org.hsieh.blackjack.Player.GAMESTATE_INPLAY = 1;
org.hsieh.blackjack.Player.GAMESTATE_BUST = 2;
org.hsieh.blackjack.Player.GAMESTATE_UNUSED = 4;
org.hsieh.blackjack.Player.GAMESTATE_UNUSED = 8;
org.hsieh.blackjack.Player.GAMESTATE_UNUSED = 16;
org.hsieh.blackjack.Player.GAMESTATE_UNUSED = 32;
org.hsieh.blackjack.Player.GAMESTATE_UNUSED = 64;
org.hsieh.blackjack.Player.GAMESTATE_UNUSED = 128;
org.hsieh.blackjack.Player.GAMESTATE_UNUSED = 256;
org.hsieh.blackjack.Player.GAMESTATE_PUSH = 512;
org.hsieh.blackjack.Player.GAMESTATE_LOSE = 1024;
org.hsieh.blackjack.Player.GAMESTATE_WIN = 2048;
org.hsieh.blackjack.Player.GAMESTATE_PAID = 4096;
org.hsieh.blackjack.Player.GAMESTATE_OVER = 8196;
org.hsieh.blackjack.Player.AI_STAY_THRESHOLD = 17;
org.hsieh.blackJack.Player.prototype.resetRound = function () {
var i = 0;
while (i < this.aPlayerCardView_mc.length) {
this.aPlayerCardView_mc[i]._visible = false;
this.aPlayerCardView_mc[i].gotoAndStop(org.hsieh.blackjack.Blackjack.CARD_BACKFACE_FRAME);
i++;
}
this.gameState = org.hsieh.blackjack.Player.GAMESTATE_INPLAY;
this.index_playerCardView_mc = 0;
return(this.hand.empty());
};
org.hsieh.blackJack.Player.prototype.getCurrentCardMC = function () {
return(this.aPlayerCardView_mc[this.index_playerCardView_mc]);
};
org.hsieh.blackJack.Player.prototype.nextCurrentCardMC = function () {
this.index_playerCardView_mc++;
return(this.getCurrentCardMC());
};
org.hsieh.blackJack.Player.prototype.acceptCard = function (cardValue) {
var currentCard_mc = null;
this.hand.append(cardValue);
currentCard_mc = this.getCurrentCardMC();
if (cardValue > 0) {
currentCard_mc.gotoAndStop(cardValue);
} else {
currentCard_mc.gotoAndStop(org.hsieh.blackjack.Blackjack.CARD_BACKFACE_FRAME);
}
currentCard_mc._visible = true;
this.nextCurrentCardMC();
return(org.hsieh.blackJack.BlackJack.getHandValue(this.hand));
};
org.hsieh.blackJack.Player.prototype.faceupAllCards = function () {
var currentCard_mc = null;
var currentCard_value = null;
var index = 0;
this.hand.iteratorReset();
while ((currentCard_value = this.hand.iteratorNext())) {
if (currentCard_value < 0) {
currentCard_value = currentCard_value * -1;
}
this.aPlayerCardView_mc[index++].gotoAndStop(currentCard_value);
}
return(org.hsieh.blackJack.BlackJack.getHandValue(this.hand));
};
org.hsieh.blackJack.Player.prototype.isFullyDressed = function () {
return(1 == this.playerStripperView_mc._currentframe);
};
org.hsieh.blackJack.Player.prototype.isNaked = function () {
return(this.playerStripperView_mc._totalframes == this.playerStripperView_mc._currentframe);
};
org.hsieh.blackJack.Player.prototype.dress = function () {
var isFirstFrame = false;
this.playerStripperView_mc.prevFrame();
if (1 == this.playerStripperView_mc._currentframe) {
isFirstFrame = true;
}
return(isFirstFrame);
};
org.hsieh.blackJack.Player.prototype.undress = function () {
var isLastFrame = false;
this.playerStripperView_mc.nextFrame();
if (this.playerStripperView_mc._totalframe == this.playerStripperView_mc._currentframe) {
isLastFrame = true;
}
return(isLastFrame);
};
org.hsieh.blackJack.Player.prototype.ai_hitOrStay = function () {
var isHit = false;
var handValue = org.hsieh.blackJack.BlackJack.getHandValue(this.hand);
if (handValue < org.hsieh.blackjack.Player.AI_STAY_THRESHOLD) {
isHit = true;
}
return(isHit);
};
org.hsieh.blackJack.Player.prototype.setGameState = function (bits) {
return((this.gameState = this.gameState | bits));
};
org.hsieh.blackJack.Player.prototype.testGameState = function (bits) {
return(this.gameState & bits);
};
AsSetupPackage("org.hsieh.blackjack");
AsDependencyCheck("AsSetupPackage", "org.hsieh.blackjack.TestPlayer");
AsDependencyCheck("org.hsieh.lang.Assertion", "org.hsieh.blackjack.TestPlayer");
AsDependencyCheck("org.hsieh.util.Collection", "org.hsieh.blackjack.TestPlayer");
AsDependencyCheck("org.hsieh.blackjack.Player", "org.hsieh.blackjack.TestPlayer");
org.hsieh.blackjack.TestPlayer = function () {
};
org.hsieh.blackJack.TestPlayer.executeTest = function () {
_global.tempPlayer = null;
org.hsieh.blackJack.TestPlayer.testGetCurrentCardMC();
org.hsieh.blackJack.TestPlayer.testNextCurrentCardMC();
org.hsieh.blackJack.TestPlayer.testAcceptCard();
org.hsieh.blackJack.TestPlayer.testIsFullyDressed();
org.hsieh.blackJack.TestPlayer.testUndress();
org.hsieh.blackJack.TestPlayer.testDress();
org.hsieh.blackJack.TestPlayer.testai_HitOrStay();
};
org.hsieh.blackJack.TestPlayer.setup = function () {
_global.tempPlayer = new org.hsieh.blackjack.Player(1, 2, false);
};
org.hsieh.blackJack.TestPlayer.teardown = function () {
_global.tempPlayer = null;
};
org.hsieh.blackJack.TestPlayer.testGetCurrentCardMC = function () {
trace("** Testing GetCurrentCardMC");
org.hsieh.blackJack.TestPlayer.setup();
AssertTrue("Expected Player1card1_mc", _global.tempPlayer.getCurrentCardMC()._name == "player1card1_mc");
org.hsieh.blackjack.testplayer.teardown();
trace("** End Testing GetCurrentCardMC");
};
org.hsieh.blackJack.TestPlayer.testNextCurrentCardMC = function () {
trace("** Testing NextCurrentCardMC");
org.hsieh.blackjack.testplayer.setup();
AssertTrue("Expected Player1card2_mc", _global.tempPlayer.nextCurrentCardMC()._name == "player1card2_mc");
AssertTrue("Expected Player1card3_mc", _global.tempPlayer.nextCurrentCardMC()._name == "player1card3_mc");
AssertTrue("Expected Player1card4_mc", _global.tempPlayer.nextCurrentCardMC()._name == "player1card4_mc");
AssertTrue("Expected Player1card5_mc", _global.tempPlayer.nextCurrentCardMC()._name == "player1card5_mc");
AssertTrue("Expected Player1card6_mc", _global.tempPlayer.nextCurrentCardMC()._name == "player1card6_mc");
AssertTrue("Expected Player1card7_mc", _global.tempPlayer.nextCurrentCardMC()._name == "player1card7_mc");
AssertTrue("Expected Player1card8_mc", _global.tempPlayer.nextCurrentCardMC()._name == "player1card8_mc");
org.hsieh.blackjack.testplayer.teardown();
trace("** End Testing NextCurrentCardMC");
};
org.hsieh.blackJack.TestPlayer.testAcceptCard = function () {
trace("** Testing testAcceptCard");
org.hsieh.blackjack.testplayer.setup();
AssertTrue("step: 01 Expected 11", _global.tempPlayer.acceptCard(1) == 11);
AssertTrue("step: 02 Expected 12", _global.tempPlayer.acceptCard(-14) == 12);
AssertTrue("step: 03 Expected 13", _global.tempPlayer.acceptCard(27) == 13);
AssertTrue("step: 04 Expected 14", _global.tempPlayer.acceptCard(40) == 14);
AssertTrue("step: 05 Expected 16", _global.tempPlayer.acceptCard(2) == 16);
AssertTrue("step: 06 Expected 18", _global.tempPlayer.acceptCard(15) == 18);
AssertTrue("step: 07 Expected 20", _global.tempPlayer.acceptCard(28) == 20);
AssertTrue("step: 08 Expected 12", _global.tempPlayer.acceptCard(41) == 12);
AssertTrue("step: 09 Expected 15", _global.tempPlayer.acceptCard(-3) == 15);
AssertTrue("step: 10 Expected 18", _global.tempPlayer.acceptCard(16) == 18);
AssertTrue("step: 11 Expected 21", _global.tempPlayer.acceptCard(-29) == 21);
AssertTrue("step: 12 Expected 24", _global.tempPlayer.acceptCard(42) == 24);
org.hsieh.blackjack.testplayer.teardown();
trace("** End Testing testAcceptCard");
};
org.hsieh.blackJack.TestPlayer.testIsFullyDressed = function () {
trace("** Testing testIsFullyDressed");
org.hsieh.blackjack.testplayer.setup();
AssertTrue("Expected True from IsFullyDressed", _global.tempPlayer.isFullyDressed());
_global.tempPlayer.undress();
AssertFalse("After undress one layer, expected False from IsFullyDressed", _global.tempPlayer.isFullyDressed());
_global.tempPlayer.dress();
AssertTrue("After dress one layer, expected True from IsFullyDressed", _global.tempPlayer.isFullyDressed());
org.hsieh.blackjack.testplayer.teardown();
trace("** End Testing testIsFullyDressed");
};
org.hsieh.blackJack.TestPlayer.testUndress = function () {
trace("** Testing testUndress");
org.hsieh.blackjack.testplayer.setup();
AssertTrue("Expected result frame 1", _global.tempPlayer.playerStripperView_mc._currentframe == 1);
_global.tempPlayer.undress();
AssertTrue("After undress one layer, expected result frame 2", _global.tempPlayer.playerStripperView_mc._currentframe == 2);
_global.tempPlayer.undress();
AssertTrue("After undress one layer, expected result frame 3", _global.tempPlayer.playerStripperView_mc._currentframe == 3);
_global.tempPlayer.undress();
AssertTrue("After undress one layer, expected result frame 4", _global.tempPlayer.playerStripperView_mc._currentframe == 4);
_global.tempPlayer.undress();
AssertTrue("After undress one layer, expected result frame 5", _global.tempPlayer.playerStripperView_mc._currentframe == 5);
org.hsieh.blackjack.testplayer.teardown();
trace("** End Testing testUndress");
};
org.hsieh.blackJack.TestPlayer.testDress = function () {
trace("** Testing testUndress");
org.hsieh.blackjack.testplayer.setup();
AssertTrue("Expected result frame 1", _global.tempPlayer.playerStripperView_mc._currentframe == 1);
_global.tempPlayer.dress();
AssertTrue("After dress, Expected result frame 1", _global.tempPlayer.playerStripperView_mc._currentframe == 1);
_global.tempPlayer.undress();
AssertTrue("After undress one layer, expected result frame 2", _global.tempPlayer.playerStripperView_mc._currentframe == 2);
_global.tempPlayer.undress();
AssertTrue("After undress one layer, expected result frame 3", _global.tempPlayer.playerStripperView_mc._currentframe == 3);
_global.tempPlayer.undress();
AssertTrue("After undress one layer, expected result frame 4", _global.tempPlayer.playerStripperView_mc._currentframe == 4);
_global.tempPlayer.undress();
AssertTrue("After undress one layer, expected result frame 5", _global.tempPlayer.playerStripperView_mc._currentframe == 5);
_global.tempPlayer.dress();
AssertTrue("After dress one layer, expected result frame 4", _global.tempPlayer.playerStripperView_mc._currentframe == 4);
_global.tempPlayer.dress();
AssertTrue("After dress one layer, expected result frame 3", _global.tempPlayer.playerStripperView_mc._currentframe == 3);
_global.tempPlayer.dress();
AssertTrue("After dress one layer, expected result frame 2", _global.tempPlayer.playerStripperView_mc._currentframe == 2);
_global.tempPlayer.dress();
AssertTrue("After dress one layer, expected result frame 1", _global.tempPlayer.playerStripperView_mc._currentframe == 1);
org.hsieh.blackjack.testplayer.teardown();
trace("** End Testing testDress");
};
org.hsieh.blackJack.TestPlayer.testai_HitOrStay = function () {
var tempVal = 0;
trace("** Testing testai_HitOrStay");
org.hsieh.blackjack.testplayer.setup();
AssertTrue("step: 01 Expected 11", ((tempval = _global.tempPlayer.acceptCard(1))) == 11);
AssertTrue((("step: 02 Should be Hitting because" + tempval) + " < ") + org.hsieh.util.blackjack.Player.AI_STAY_THRESHOLD, this.ai_hitOrStay);
AssertTrue("step: 03 Expected 12", ((tempval = _global.tempPlayer.acceptCard(14))) == 12);
AssertTrue((("step: 04 Should be Hitting because" + tempval) + " < ") + org.hsieh.util.blackjack.Player.AI_STAY_THRESHOLD, this.ai_hitOrStay);
AssertTrue("step: 05 Expected 13", ((tempval = _global.tempPlayer.acceptCard(27))) == 13);
AssertTrue((("step: 06 Should be Hitting because" + tempval) + " < ") + org.hsieh.util.blackjack.Player.AI_STAY_THRESHOLD, this.ai_hitOrStay);
AssertTrue("step: 07 Expected 14", ((tempval = _global.tempPlayer.acceptCard(40))) == 14);
AssertTrue((("step: 08 Should be Hitting because" + tempval) + " < ") + org.hsieh.util.blackjack.Player.AI_STAY_THRESHOLD, this.ai_hitOrStay);
AssertTrue("step: 09 Expected 16", ((tempval = _global.tempPlayer.acceptCard(2))) == 16);
AssertTrue((("step: 10 Should be Hitting because" + tempval) + " < ") + org.hsieh.util.blackjack.Player.AI_STAY_THRESHOLD, this.ai_hitOrStay);
AssertTrue("step: 11 Expected 18", ((tempval = _global.tempPlayer.acceptCard(15))) == 18);
AssertFalse((("step: 12 Should NOT be Hitting because" + tempval) + " > ") + org.hsieh.util.blackjack.Player.AI_STAY_THRESHOLD, this.ai_hitOrStay);
AssertTrue("step: 13 Expected 20", ((tempval = _global.tempPlayer.acceptCard(28))) == 20);
AssertFalse((("step: 14 Should NOT be Hitting because" + tempval) + " > ") + org.hsieh.util.blackjack.Player.AI_STAY_THRESHOLD, this.ai_hitOrStay);
AssertTrue("step: 15 Expected 12", ((tempval = _global.tempPlayer.acceptCard(41))) == 12);
AssertTrue((("step: 16 Should be Hitting because" + tempval) + " < ") + org.hsieh.util.blackjack.Player.AI_STAY_THRESHOLD, this.ai_hitOrStay);
AssertTrue("step: 17 Expected 15", ((tempval = _global.tempPlayer.acceptCard(3))) == 15);
AssertTrue((("step: 18 Should be Hitting because" + tempval) + " < ") + org.hsieh.util.blackjack.Player.AI_STAY_THRESHOLD, this.ai_hitOrStay);
AssertTrue("step: 19 Expected 18", ((tempval = _global.tempPlayer.acceptCard(16))) == 18);
AssertFalse((("step: 20 Should NOT be Hitting because" + tempval) + " > ") + org.hsieh.util.blackjack.Player.AI_STAY_THRESHOLD, this.ai_hitOrStay);
AssertTrue("step: 21 Expected 21", ((tempval = _global.tempPlayer.acceptCard(29))) == 21);
AssertFalse((("step: 22 Should NOT be Hitting because" + tempval) + " > ") + org.hsieh.util.blackjack.Player.AI_STAY_THRESHOLD, this.ai_hitOrStay);
AssertTrue("step: 23 Expected 24", _global.tempPlayer.acceptCard(42) == 24);
AssertFalse((("step: 24 Should NOT be Hitting because" + tempval) + " > ") + org.hsieh.util.blackjack.Player.AI_STAY_THRESHOLD, this.ai_hitOrStay);
org.hsieh.blackjack.testplayer.teardown();
trace("** End Testing testai_HitOrStay");
};
org.hsieh.blackJack.TestBlackJack.executeTest();
org.hsieh.blackjack.TestPlayer.executeTest();
player1chick1_mc._visible = false;
player1chick2_mc._visible = false;
player1chick3_mc._visible = false;
player2chick1_mc._visible = false;
player2chick2_mc._visible = false;
player2chick3_mc._visible = false;
var aPlayerSelection = new Array(chosenPlayer1, chosenPlayer2);
blackjack = new org.hsieh.blackjack.Blackjack(aPlayerSelection, sully_dealer_mc, [curtain1_mc, curtain2_mc], indicator_mc, [floor1_mc, floor2_mc], 1);
Frame 223
blackJack.preDealOpenLoop();
Frame 224
if (!sully_dealer_mc.isAnimating) {
sully_dealer_mc.gotoAndPlay("shuffle");
}
Frame 234
if (sully_dealer_mc.isAnimating) {
gotoAndPlay (230);
}
Frame 235
blackjack.preDealOpenLoop();
sully_dealer_mc.gotoAndPlay("deal");
Frame 239
blackjack.dealOpenLoop();
Frame 242
if (sully_dealer_mc.dealCardCounter > 0) {
gotoAndPlay (239);
}
Frame 243
blackjack.currentState();
Frame 249
gotoAndPlay (243);
Frame 256
if (sully_dealer_mc.isPlayAgain) {
gotoAndPlay (199);
} else {
gotoAndPlay (250);
}
Symbol 9 MovieClip Frame 1
stop();
Symbol 27 Button
on (release) {
loadMovieNum ("gs_song.swf", 88);
}
Symbol 28 Button
on (release) {
unloadMovieNum (88);
}
Symbol 48 Button
on (press) {
gotoAndPlay (167);
}
Symbol 57 Button
on (press) {
gotoAndPlay (199);
}
Symbol 59 Button
on (press) {
gotoAndStop (167);
}
Symbol 62 Button
on (press) {
gotoAndPlay (183);
}
Symbol 65 Button
on (release) {
chosenPlayer1 = 3;
gotoAndPlay (219);
}
Symbol 67 Button
on (release) {
chosenPlayer1 = 2;
gotoAndPlay (219);
}
Symbol 69 Button
on (release) {
chosenPlayer1 = 1;
gotoAndPlay (219);
}
Symbol 153 Button
on (release) {
isPlayAgain = true;
}
Symbol 181 MovieClip Frame 1
stop();
var isCardArrived = false;
var isAnimating = false;
var isPlayAgain = false;
Symbol 181 MovieClip Frame 5
isCardArrived = false;
isAnimating = true;
Symbol 181 MovieClip Frame 9
isCardArrived = false;
Symbol 181 MovieClip Frame 16
isCardArrived = true;
Symbol 181 MovieClip Frame 19
if ((--dealCardCounter) > 0) {
gotoAndPlay (9);
}
Symbol 181 MovieClip Frame 43
gotoAndStop (1);
Symbol 181 MovieClip Frame 44
isAnimating = true;
Symbol 181 MovieClip Frame 87
gotoAndStop (1);
Symbol 181 MovieClip Frame 91
isAnimating = true;
Symbol 181 MovieClip Frame 118
Symbol 181 MovieClip Frame 129
isAnimating = false;
stop();
Symbol 181 MovieClip Frame 132
isAnimating = true;
Symbol 181 MovieClip Frame 202
isAnimating = false;
stop();
Symbol 207 MovieClip Frame 1
var isAnimating = false;
var isDone = false;
var isCovered = false;
stop();
Symbol 207 MovieClip Frame 2
isAnimating = true;
isDone = false;
isCovered = false;
Symbol 207 MovieClip Frame 14
isCovered = true;
Symbol 207 MovieClip Frame 92
isCovered = false;
isDone = true;
Symbol 207 MovieClip Frame 110
gotoAndStop (1);
Symbol 214 MovieClip Frame 1
stop();
Symbol 214 MovieClip Frame 7
gotoAndPlay (2);
Symbol 214 MovieClip Frame 16
gotoAndPlay (11);
Symbol 216 Button
on (release) {
blackjack.playerStand();
}
Symbol 217 Button
on (release) {
blackjack.playerHit();
}
Symbol 231 MovieClip Frame 1
stop();
Symbol 231 MovieClip Frame 2
stop();
Symbol 231 MovieClip Frame 3
stop();
Symbol 231 MovieClip Frame 4
stop();
Symbol 231 MovieClip Frame 5
stop();
Symbol 231 MovieClip Frame 6
stop();
Symbol 241 MovieClip Frame 1
stop();
Symbol 241 MovieClip Frame 2
stop();
Symbol 241 MovieClip Frame 3
stop();
Symbol 241 MovieClip Frame 4
stop();
Symbol 241 MovieClip Frame 5
stop();
Symbol 241 MovieClip Frame 6
stop();
Symbol 249 MovieClip Frame 1
stop();
Symbol 249 MovieClip Frame 2
stop();
Symbol 249 MovieClip Frame 3
stop();
Symbol 249 MovieClip Frame 4
stop();
Symbol 249 MovieClip Frame 5
stop();
Symbol 249 MovieClip Frame 6
stop();
Symbol 251 MovieClip Frame 1
stop();
Symbol 251 MovieClip Frame 2
stop();
Symbol 251 MovieClip Frame 3
stop();
Symbol 251 MovieClip Frame 4
stop();
Symbol 251 MovieClip Frame 5
stop();
Symbol 251 MovieClip Frame 6
stop();
Symbol 253 MovieClip Frame 1
stop();
Symbol 253 MovieClip Frame 2
stop();
Symbol 253 MovieClip Frame 3
stop();
Symbol 253 MovieClip Frame 4
stop();
Symbol 253 MovieClip Frame 5
stop();
Symbol 253 MovieClip Frame 6
stop();
Symbol 256 MovieClip Frame 1
stop();
Symbol 256 MovieClip Frame 2
stop();
Symbol 256 MovieClip Frame 3
stop();
Symbol 256 MovieClip Frame 4
stop();
Symbol 256 MovieClip Frame 5
stop();
Symbol 256 MovieClip Frame 6
stop();
Symbol 296 MovieClip Frame 1
stop();
Symbol 296 MovieClip Frame 2
stop();
Symbol 296 MovieClip Frame 3
stop();
Symbol 296 MovieClip Frame 4
stop();
Symbol 296 MovieClip Frame 5
stop();
Symbol 296 MovieClip Frame 6
stop();
Symbol 296 MovieClip Frame 7
stop();
Symbol 296 MovieClip Frame 8
stop();
Symbol 296 MovieClip Frame 9
stop();
Symbol 296 MovieClip Frame 10
stop();
Symbol 296 MovieClip Frame 11
stop();
Symbol 296 MovieClip Frame 12
stop();
Symbol 296 MovieClip Frame 13
stop();
Symbol 296 MovieClip Frame 14
stop();
Symbol 296 MovieClip Frame 15
stop();
Symbol 296 MovieClip Frame 16
stop();
Symbol 296 MovieClip Frame 17
stop();
Symbol 296 MovieClip Frame 18
stop();
Symbol 296 MovieClip Frame 19
stop();
Symbol 296 MovieClip Frame 20
stop();
Symbol 296 MovieClip Frame 21
stop();
Symbol 296 MovieClip Frame 22
stop();
Symbol 296 MovieClip Frame 23
stop();
Symbol 296 MovieClip Frame 24
stop();
Symbol 296 MovieClip Frame 25
stop();
Symbol 296 MovieClip Frame 26
stop();
Symbol 296 MovieClip Frame 27
stop();
Symbol 296 MovieClip Frame 28
stop();
Symbol 296 MovieClip Frame 29
stop();
Symbol 296 MovieClip Frame 30
stop();
Symbol 296 MovieClip Frame 31
stop();
Symbol 296 MovieClip Frame 32
stop();
Symbol 296 MovieClip Frame 33
stop();
Symbol 296 MovieClip Frame 34
stop();
Symbol 296 MovieClip Frame 35
stop();
Symbol 296 MovieClip Frame 36
stop();
Symbol 296 MovieClip Frame 37
stop();
Symbol 296 MovieClip Frame 38
stop();
Symbol 296 MovieClip Frame 39
stop();
Symbol 296 MovieClip Frame 40
stop();
Symbol 296 MovieClip Frame 41
stop();
Symbol 296 MovieClip Frame 42
stop();
Symbol 296 MovieClip Frame 43
stop();
Symbol 296 MovieClip Frame 44
stop();
Symbol 296 MovieClip Frame 45
stop();
Symbol 296 MovieClip Frame 46
stop();
Symbol 296 MovieClip Frame 47
stop();
Symbol 296 MovieClip Frame 48
stop();
Symbol 296 MovieClip Frame 49
stop();
Symbol 296 MovieClip Frame 50
stop();
Symbol 296 MovieClip Frame 51
stop();
Symbol 296 MovieClip Frame 52
stop();
Symbol 296 MovieClip Frame 53
stop();
Symbol 296 MovieClip Frame 54
stop();
Symbol 298 MovieClip Frame 1
stop();
Symbol 298 MovieClip Frame 9
gotoAndPlay (2);
Symbol 304 MovieClip Frame 1
stop();
Symbol 304 MovieClip Frame 2
stop();
Symbol 304 MovieClip Frame 3
stop();
Symbol 309 Button
on (rollOver) {
gotoAndPlay (2);
}
Symbol 312 Button
on (rollOver) {
gotoAndStop (1);
}
Symbol 315 Button
on (press) {
getURL ("http://www.pileatedpictures.com");
}
Symbol 316 MovieClip Frame 1
stop();
Symbol 316 MovieClip Frame 8
stop();
Symbol 317 Button
on (release) {
getURL ("http://www.pileated.com", "_blank");
}