Frame 1
function OnKeyUp() {
if (Key.getCode() == 80) {
pause_mc.pause_btn.onRelease();
} else if (Key.getCode() == 37) {
Selection_card.Selection_mc.close();
var i = 1;
var Left_card = ((Direction != 1) ? (Selection_card.prev()) : (Selection_card.next()));
while ((Left_card.isUsed || (Left_card == null)) && (Selection_card.index - i)) {
Left_card = eval ((("card" + turn.current) + "_") + (Selection_card.index - i));
i++;
}
if (Left_card.isUsed || (Left_card == null)) {
i = 13;
while ((Left_card.isUsed || (Left_card == null)) && (i)) {
Left_card = eval ((("card" + turn.current) + "_") + i);
i--;
}
}
Selection_card = Left_card;
Selection_card.Selection_mc.open();
} else if (Key.getCode() == 39) {
Selection_card.Selection_mc.close();
var i = 1;
var Right_card = ((Direction == 1) ? (Selection_card.prev()) : (Selection_card.next()));
while ((Right_card.isUsed || (Right_card == null)) && ((Selection_card.index + i) <= 13)) {
Right_card = eval ((("card" + turn.current) + "_") + (Selection_card.index + i));
i++;
}
if (Right_card.isUsed || (Right_card == null)) {
i = 1;
while ((Right_card.isUsed || (Right_card == null)) && (i <= 13)) {
Right_card = eval ((("card" + turn.current) + "_") + i);
i++;
}
}
Selection_card = Right_card;
Selection_card.Selection_mc.open();
} else if ((Key.getCode() == 13) || (Key.getCode() == 32)) {
Selection_card.onRollOver();
Selection_card.onPress();
Selection_card.onRelease();
Selection_card.onRollOut();
} else if (Key.isDown(17) && (Key.getCode() == 8)) {
HighScore1.New();
}
}
duplicateMovieClip (Debugger, "Debugger0", 1000);
Debugger._visible = false;
Stage.scaleMode = "showAll";
fscommand ("fullScreen", true);
fscommand ("showmenu", "false");
_quality = "High";
var myListener = new Object();
myListener.onKeyUp = OnKeyUp;
Key.addListener(myListener);
Instance of Symbol 47 MovieClip "Speed_chk" in Frame 1
//component parameters
onClipEvent (construct) {
label = "Speedy Mode (2x)";
group = "";
var_str = "_root.speedy_mode";
Default = true;
Enable = true;
}
Instance of Symbol 123 MovieClip "HighScore1" in Frame 1
//component parameters
onClipEvent (construct) {
Preview = 0;
}
Instance of Symbol 47 MovieClip "auto_chk" in Frame 1
//component parameters
onClipEvent (construct) {
label = "Auto Play";
group = "";
var_str = "_root.AutoPlay";
Default = true;
Enable = true;
}
Frame 2
this.HighScore1.load(9);
this.HighScore1.findBestScore();
Frame 9
function clear() {
_root.Status = "Welcome .. Again";
Stop_game = (Pause_game = (Stop_game_Score = (Stop_game_Preview = false)));
history.reset();
clearInterval(interval_AI);
interval_AI = 0;
clearInterval(interval_Empty);
interval_Empty = 0;
clearInterval(interval_Wait);
interval_Wait = 0;
var i = 1;
while (i <= 13) {
var j = 1;
while (j <= 4) {
removeMovieClip(eval ((("card" + j) + "_") + i));
j++;
}
i++;
}
var winner_number = 1;
while (winner_number <= 30) {
removeMovieClip(eval ("winner_mc" + winner_number));
winner_number++;
}
removeMovieClip(HighScoreTable);
var j = 1;
while (j <= 4) {
eval ("king" + j)._visible = false;
j++;
}
}
function win() {
_root.turn.current = null;
start_btn._visible = false;
pointer._visible = false;
var best = Winner_Id();
isWin = true;
interval_WINNER = setInterval(_root, "addWinner_card", 50);
winner = history.names[best].name;
score = history.names[best].player_score;
if (!history.names[best].human) {
SoundLoader1.url = ("sound\\Bad\\laugh" + random(7)) + ".swf";
} else {
HighScore1.set(winner, score);
SoundLoader1.url = ("sound\\Good\\win" + random(3)) + ".swf";
}
SoundLoader1.start();
_root.Status = (" <FONT Color='#FF0430'>The WINNER is <B>" + winner) + "</B></FONT>";
var i = 1;
while (i <= 13) {
var j = 1;
while (j <= 4) {
removeMovieClip(eval ((("card" + j) + "_") + i));
j++;
}
i++;
}
var j = 1;
while (j <= 4) {
eval ("king" + j)._visible = false;
j++;
}
}
function addWinner_card() {
if (winner_number < 30) {
duplicateMovieClip ("winner_mc", "winner_mc" + winner_number, winner_number);
}
mc = eval ("winner_mc" + winner_number);
mc._x = 10 + random(Stage.width - 140);
mc._y = 10 + random(Stage.height - 210);
mc.winner = winner;
if (winner_number < 30) {
winner_number++;
} else {
winner_number = 1;
}
}
function Winner_Id() {
var _local2 = 1;
var _local1 = 2;
while (_local1 <= 4) {
if (history.names[_local2].player_score > history.names[_local1].player_score) {
_local2 = _local1;
}
_local1++;
}
return(_local2);
}
clear();
HighScoreTable.KeepOpen = false;
_root.games = "";
Player.Used_names = new Array();
Options_mc.OpenOptions();
clearInterval(interval_WINNER);
interval_WINNER = 0;
stop();
Frame 25
duplicateMovieClip (HighScoreTable0, "HighScoreTable", 999);
HighScoreTable0._visible = false;
winner_mc._visible = false;
score_card._visible = false;
start_btn.onRelease = function () {
if (king.current != null) {
BadSound2_mc.start();
var _games_played = 0;
var i = 1;
while (i <= 5) {
if (currentGames[i] && (eval ("game" + i).enabled)) {
_games_played++;
}
i++;
}
if (_games_played) {
if (currentGames[1] == true) {
Areas.Areas2();
} else {
Areas.Areas1();
}
Stats_BG.light = false;
games = "<Font color='#00FFFF'>Games :</Font> ";
var First = true;
var j = 1;
while (j <= 5) {
if (eval ("game" + j).enabled && (currentGames[j])) {
history.AddGame(eval ("game" + j).label.charAt(0));
history.addScore_cards(j);
if (!First) {
games = games + " , ";
}
First = false;
games = games + eval ("game" + j).label.charAt(0);
}
j++;
}
_root.update_score_card_preview();
start_btn._visible = false;
_root.turn.setTurn(_root.king.current);
HighScoreTable.KeepOpen = false;
HighScoreTable.btn.onRollOut();
turn.start_PlayerAI();
var j = 1;
while (j <= 6) {
eval ("game" + j).enabled = false;
j++;
}
}
}
};
depth = 0;
card_type._visible = false;
var i = 1;
while (i <= 13) {
duplicateMovieClip (card1_, "card1_" + i, depth++);
duplicateMovieClip (card2_, "card2_" + i, depth++);
duplicateMovieClip (card3_, "card3_" + i, depth++);
duplicateMovieClip (card4_, "card4_" + i, depth++);
i++;
}
var i = depth;
while (i <= (depth + 52)) {
this.createEmptyMovieClip("empty_slot" + (i - 51), i);
i++;
}
p1_x = card1_._x;
p1_y = card1_._y;
p2_x = card2_._x;
p2_y = card2_._y;
p3_x = card3_._x;
p3_y = card3_._y;
p4_x = card4_._x;
p4_y = card4_._y;
Instance of Symbol 219 MovieClip "card1_" in Frame 25
//component parameters
onClipEvent (construct) {
type = 1;
num = 1;
isUsed = false;
}
Instance of Symbol 219 MovieClip "card2_" in Frame 25
//component parameters
onClipEvent (construct) {
type = 1;
num = 1;
isUsed = false;
}
Instance of Symbol 219 MovieClip "card3_" in Frame 25
//component parameters
onClipEvent (construct) {
type = 1;
num = 1;
isUsed = false;
}
Instance of Symbol 219 MovieClip "card4_" in Frame 25
//component parameters
onClipEvent (construct) {
type = 1;
num = 1;
isUsed = false;
}
Instance of Symbol 47 MovieClip "game2" in Frame 25
//component parameters
onClipEvent (construct) {
label = "King (K)";
group = "";
var_str = "";
Default = false;
Enable = true;
}
Instance of Symbol 47 MovieClip "game3" in Frame 25
//component parameters
onClipEvent (construct) {
label = "Queen (Q)";
group = "";
var_str = "";
Default = false;
Enable = true;
}
Instance of Symbol 47 MovieClip "game1" in Frame 25
//component parameters
onClipEvent (construct) {
label = "Trex (T)";
group = "";
var_str = "";
Default = false;
Enable = true;
}
Instance of Symbol 47 MovieClip "game4" in Frame 25
//component parameters
onClipEvent (construct) {
label = "Diamond (D)";
group = "";
var_str = "";
Default = false;
Enable = true;
}
Instance of Symbol 47 MovieClip "game5" in Frame 25
//component parameters
onClipEvent (construct) {
label = "Ltooch (L)";
group = "";
var_str = "";
Default = false;
Enable = true;
}
Instance of Symbol 47 MovieClip "game6" in Frame 25
//component parameters
onClipEvent (construct) {
label = "Complex";
group = "";
var_str = "";
Default = false;
Enable = true;
}
Instance of Symbol 282 MovieClip "pause_mc" in Frame 25
onClipEvent (load) {
labels = new Array("Pause", "Continue");
index = 0;
label = labels[index];
pause_btn.onRelease = function () {
_root.ReleaseSound_mc2.start();
index++;
_root.Pause_game = !_root.Pause_game;
if (index == labels.length) {
index = 0;
}
label = labels[index];
};
}
Instance of Symbol 282 MovieClip "New_mc" in Frame 25
onClipEvent (load) {
labels = new Array("New Game");
index = 0;
label = labels[index];
pause_btn.onRelease = function () {
_root.ReleaseSound_mc2.start();
index++;
if (index == labels.length) {
index = 0;
}
if (_root.history.names[_root.turn.current].human || (_root.Pause_game)) {
_root.gotoAndStop("newGame");
} else if (_root.turn.current == null) {
_root.gotoAndStop("newGame");
} else {
_root.NewGame = true;
}
label = labels[index];
};
}
Frame 27
function start_new_game() {
HighScore1.load((_root.comp1AI + _root.comp2AI) + _root.comp3AI);
GamesPlayed = "0/20";
delete history;
history = new History();
var j = 1;
while (j <= 6) {
var game_mc = eval ("game" + j);
var king_mc = eval ("king" + j);
king_mc._visible = false;
game_mc.checked = false;
game_mc.enabled = false;
j++;
}
while (history.names.length) {
history.names.pop();
}
clearInterval(_root.interval_AI);
_root.interval_AI = 0;
history.names.push(null);
if (testMode) {
history.names.push(new Player(player1, 3));
} else {
history.names.push(new Player(player1, 0));
}
history.names.push(new Player(player2, _root.comp1AI));
history.names.push(new Player(player3, _root.comp2AI));
history.names.push(new Player(player4, _root.comp3AI));
var i = 1;
while (i <= 4) {
var info_mc = eval (("info" + i) + ".info");
info_mc.name = history.names[i].name;
info_mc.score = history.names[i].score;
i++;
}
start_sub_game();
}
function wait() {
if (NoMoveCards()) {
clearInterval(_root.interval_AI);
interval_AI = 0;
continue_sub_game();
}
}
function start_sub_game() {
history.reset();
var i = 1;
while (i <= 4) {
var info_mc = eval (("info" + i) + ".info");
info_mc.cards = new Array(0, 0, 0, 0, 0);
i++;
}
card_type._visible = false;
start_btn._visible = true;
if ((history.__get__games_played() == 5) && (history.__get__kings_played() == 3)) {
HighScoreTable.btn.onRollOver();
win();
} else {
reset_cards();
var delay = Turn.ENDTURN_SPEED;
if (_root.speedy_mode) {
delay = int(delay / 2);
} else if (_root.NO_Time_Mode) {
delay = 0;
}
_root.interval_AI = setInterval(_root, "wait", delay);
}
}
function continue_sub_game() {
var j = 1;
while (j <= 6) {
if (!eval ("game" + j).checked) {
eval ("game" + j).enabled = true;
}
j++;
}
if (history.king_cards.length == 0) {
king.__set__current(seven_owner);
history.AddKing();
} else if (((history.__get__games_played() % 5) == 0) && (history.__get__games_played())) {
king.next();
history.AddKing();
var j = 1;
while (j <= 6) {
var game_mc = eval ("game" + j);
game_mc.checked = false;
j++;
}
}
if (history.names[king.__get__current()].human) {
HighScoreTable.KeepOpen = true;
HighScoreTable.btn.onRollOver();
}
var j = 1;
while (j <= 6) {
var game_mc = eval ("game" + j);
game_mc.enabled = !game_mc.checked;
game_mc._alpha = ((!game_mc.enabled) ? 50 : 100);
currentGames[j] = false;
j++;
}
turn.setTurn(null);
if (start_btn._visible) {
turn.ChooseGame();
Status = ("<FONT Color='#FF0000'><B> " + history.names[king.__get__current()].name) + "</B></FONT>, Choose Game ,please ! ";
}
}
function NoMoveCards() {
var j = 1;
while (j <= 4) {
var i = 1;
while (i <= 13) {
var card_mc = eval ((("card" + j) + "_") + i);
if (card_mc.move.Moving) {
return(false);
}
i++;
}
j++;
}
return(true);
}
function reset_cards() {
var j = 1;
while (j <= 4) {
var i = 1;
while (i <= 13) {
var card_mc = eval ((("card" + j) + "_") + i);
card_mc.taken = false;
i++;
}
j++;
}
var j = 1;
while (j <= 4) {
var i = 1;
while (i <= 13) {
var card_mc = eval ((("card" + j) + "_") + i);
card_mc.init();
card_mc.swapDepths(this.getInstanceAtDepth((((j - 1) * 13) + i) - 1));
card_mc.owner = j;
card_mc._rotation = 90 - (90 * j);
shuffle(card_mc, i, j);
i++;
}
j++;
}
var j = 1;
while (j <= 4) {
QuickSort.sort(j, 1, 13, true, _root.Direction != 1);
j++;
}
var j = 1;
while (j <= 4) {
var i = 1;
while (i <= 13) {
var card_mc = eval ((("card" + j) + "_") + i);
put(card_mc, i, j);
card_mc.index = i;
i++;
}
j++;
}
}
function shuffle(card_mc, i, j) {
var temp_card_mc = eval ((("card" + j) + "_") + i);
do {
card_mc.num = random(13) + 1;
card_mc.type = random(4) + 1;
temp_card_mc = eval ((("card" + card_mc.type) + "_") + card_mc.num);
} while (temp_card_mc.taken);
if ((card_mc.type == 4) && (card_mc.num == 7)) {
seven_owner = j;
}
var info_mc = eval (("info" + j) + ".info");
info_mc.cards[card_mc.type]++;
info_mc.cards_str = info_mc.cards;
temp_card_mc.taken = true;
}
function put(card_mc, i, j) {
card_mc._x = card_type._x;
card_mc._y = card_type._y;
var _local5 = Turn.ENDTURN_SPEED;
if (_root.speedy_mode) {
_local5 = int(_local5 / 2);
} else if (_root.NO_Time_Mode) {
_local5 = 0;
}
var _local4 = 40;
if (_root.speedy_mode) {
_local4 = int(_local4 / 2);
} else if (_root.NO_Time_Mode) {
_local4 = 0;
}
if (j % 2) {
card_mc.move.to(this[("p" + j) + "_x"] + (20 * i), this[("p" + j) + "_y"], int(_local5 / 48), 100 + (card_mc.getDepth() * _local4));
} else {
card_mc.move.to(this[("p" + j) + "_x"], this[("p" + j) + "_y"] - (20 * i), int(_local5 / 48), 100 + (card_mc.getDepth() * _local4));
}
card_mc._alpha = 100;
card_mc.move.start();
if (history.names[card_mc.owner].AI == 0) {
card_mc.open();
} else if (testMode) {
card_mc.open();
} else {
card_mc.close();
}
}
function check_games(game_mc) {
release_game = false;
var gameId = game_mc._target;
var i = parseInt(gameId.charAt(5));
var j = 1;
while (j <= 6) {
if (((i == 1) && (j > 1)) || ((i != 1) && (j == 1))) {
if (eval ("game" + j).enabled) {
currentGames[j] = false;
}
}
j++;
}
currentGames[i] = !game_mc.checked;
var j = 2;
while (j <= 5) {
if (i == 6) {
if (eval ("game" + j).enabled) {
currentGames[j] = currentGames[6];
}
}
j++;
}
var j = 1;
while (j <= 6) {
var game_mc = eval ("game" + j);
if (game_mc.enabled) {
game_mc.checked = currentGames[j];
}
j++;
}
}
function play_card(card_mc) {
if ((((!interval_AI) && (!IsGameStop())) && (check_card(card_mc))) && (((!card_mc.isMove) || (card_mc.Area.isOpen)) || (card_mc.timer.duration < 500))) {
ReleaseSound_mc.start();
if (hasScore(card_mc)) {
BadSound2_mc.start();
}
var info_mc = eval (("info" + card_mc.owner) + ".info");
info_mc.cards[card_mc.type]--;
info_mc.cards_str = info_mc.cards;
history.addCard(card_mc);
card_mc._rotation = (currentGames[1] ? 0 : (card_mc._rotation));
if (currentGames[1]) {
info_mc.pass_mc.close();
last_card.RollOver_mc.gotoAndStop(1);
card_mc.open();
card_mc.RollOver_mc.gotoAndStop(2);
last_card = card_mc;
if (card_mc.Id == 11) {
history.possibleTrexCards[card_mc.type][0]++;
history.possibleTrexCards[card_mc.type][1]--;
} else if (history.possibleTrexCards[card_mc.type][0] == card_mc.Id) {
history.possibleTrexCards[card_mc.type][0]++;
} else if (history.possibleTrexCards[card_mc.type][1] == card_mc.Id) {
history.possibleTrexCards[card_mc.type][1]--;
}
if (noCards(info_mc.cards)) {
update_scores();
history.trex_score = history.trex_score - 50;
}
card_mc.Area._parent.seq = card_mc.Id;
card_mc.Area._parent.seq = card_mc.Area._parent.seq - 12;
card_mc.new_y = card_mc.new_y - (card_mc.Area._parent.seq * 20);
card_mc.swapDepths(this.getInstanceAtDepth((54 + ((card_mc.type - 1) * 13)) - card_mc.Area._parent.seq));
}
card_mc.open();
card_mc.isUsed = true;
card_mc.Area.isUsed = true;
card_mc.Area.card = card_mc;
card_mc.useHandCursor = false;
card_mc.Area.close();
turn.next();
history.__set__used_cards((history.__get__used_cards()+1));
turn.check_End_game_Round();
var delay = Turn.ENDTURN_SPEED;
if (_root.speedy_mode) {
delay = int(delay / 2);
} else if (_root.NO_Time_Mode) {
delay = 0;
}
card_mc.move.to(card_mc.new_x, card_mc.new_y, int(delay / 48));
card_mc.move.start();
} else {
if (!card_mc.isUsed) {
card_mc._x = card_mc.old_x;
card_mc._y = card_mc.old_y;
}
if (!card_mc.isUsed) {
if (IsGameStop()) {
ErrorSound_mc.start();
_root.Status = "<FONT Color='#FF0000'><B> Wait .. Please!";
} else if (interval_AI) {
_root.Status = "<FONT Color='#FF0000'><B>Error : Computer Still Thinking !!";
} else if ((_root.turn.current != card_mc.owner) && (_root.turn.current != null)) {
_root.Status = ("<FONT Color='#FF0000'><B>Wait .... </B>Turn to : </FONT><B>" + _root.history.names[_root.turn.current].name) + "</B>";
_root.ErrorSound_mc.start();
} else if (start_btn._visible) {
_root.Status = "<FONT Color='#FF0000'><B>Please , Choose game(s) .... </B></FONT>";
_root.ErrorSound_mc.start();
} else if (!check_card(card_mc)) {
ErrorSound_mc.start();
_root.Status = "<FONT Color='#FF0000'><B>Not Valid Card!";
}
} else if (card_mc.sender) {
throw new Error(("Error : AI " + _root.history.names[card_mc.sender].name) + " Trying to Use Used Card!!! ");
}
}
}
function hasScore(card_mc) {
var _local4 = false;
var _local2 = false;
var _local3 = false;
var _local5 = false;
if ((card_mc.type == 2) && (currentGames[4])) {
_local4 = true;
history.removeScoreCard(card_mc);
}
if ((card_mc.num == 12) && (currentGames[3])) {
_local2 = true;
history.removeScoreCard(card_mc);
}
if (((card_mc.type == 4) && (card_mc.num == 13)) && (currentGames[2])) {
_local3 = true;
history.removeScoreCard(card_mc);
}
return((_local3 || (_local2)) || (_local4));
}
function check_card(card_mc) {
var _local2 = false;
if (currentGames[1]) {
if (card_mc.Id == 11) {
_local2 = true;
} else if (history.possibleTrexCards[card_mc.type][0] == card_mc.Id) {
_local2 = true;
} else if (history.possibleTrexCards[card_mc.type][1] == card_mc.Id) {
_local2 = true;
}
} else {
_local2 = true;
var _local3 = new Array();
FindType_Cards(_local3);
if ((_local3.length > 0) && ((history.__get__used_cards() % 4) != 0)) {
if (card_mc.type != history.play_type) {
_local2 = false;
}
}
}
return(((turn.current == card_mc.owner) && (!card_mc.isUsed)) && (_local2));
}
function FindType_Cards(possible_cards) {
var card_mc;
var i = 1;
while (i <= 13) {
card_mc = eval ((("card" + turn.current) + "_") + i);
if ((card_mc.type == history.play_type) && (!card_mc.isUsed)) {
possible_cards.push(card_mc);
}
i++;
}
}
function FindTrex_Cards(possible_cards) {
var card_mc;
var i = 1;
while (i <= 13) {
card_mc = eval ((("card" + turn.current) + "_") + i);
if (!card_mc.isUsed) {
if (card_mc.Id == history.possibleTrexCards[card_mc.type][0]) {
possible_cards.push(card_mc);
} else if (card_mc.Id == history.possibleTrexCards[card_mc.type][1]) {
possible_cards.push(card_mc);
}
}
i++;
}
}
function update_scores() {
var player_id = (currentGames[1] ? (turn.current) : (history.Bigger));
if (currentGames[1]) {
history.names[player_id].player_score = history.names[player_id].player_score - history.trex_score;
var rank = (5 - (history.trex_score / 50));
if ((rank >= 1) && (rank <= 4)) {
eval ("info" + player_id).info.pos_mc.open(rank);
}
if (history.names[player_id].human) {
var sound = eval (("GoodSound" + rank) + "_mc");
sound.start();
}
} else {
var score = _root.history.Turn_score;
score = score + (currentGames[5] ? 15 : 0);
history.names[player_id].player_score = history.names[player_id].player_score + score;
if (history.names[player_id].human && (score)) {
BadSound1_mc.start();
}
}
eval ("info" + player_id).info.score = history.names[player_id].score;
var last_king = (history.king_cards.length - 1);
var last_game = (history.king_cards[last_king].games.length - 1);
var i = 1;
while (i <= 4) {
history.king_cards[last_king].games[last_game].scores[i] = history.names[i].score;
i++;
}
update_ranks();
}
function update_ranks() {
var ranks = new Array(5);
var i = 1;
while (i <= 4) {
ranks[i] = history.names[i].player_score;
i++;
}
QuickSort.sort(ranks, 1, 4);
var i = 1;
while (i <= 4) {
j = 0;
do {
j++;
} while (ranks[j] != history.names[i].player_score);
if (j == 1) {
eval ("info" + i).info.rank_mc.change(j, ranks[j], ranks[j + 1]);
} else {
eval ("info" + i).info.rank_mc.change(j);
}
i++;
}
}
function CalcScore(card_mc) {
var _local5 = 0;
var _local3 = 0;
var _local4 = 0;
var _local1 = 0;
if (card_mc.type == 2) {
_local5++;
}
if (card_mc.Id == 12) {
_local3++;
}
if ((card_mc.type == 4) && (card_mc.Id == 13)) {
_local4++;
}
_local1 = _local1 + (currentGames[2] ? (_local4 * 75) : 0);
_local1 = _local1 + (currentGames[3] ? (_local3 * 25) : 0);
_local1 = _local1 + (currentGames[4] ? (_local5 * 10) : 0);
return(_local1);
}
function AI1() {
if (turn.current != null) {
Random_AI.start();
} else {
Random_AI.choose_game();
}
}
function AI2() {
if (turn.current != null) {
Easy_AI.start();
} else {
Easy_AI.choose_game();
}
}
function AI3() {
if (turn.current != null) {
Normal_AI.start();
} else {
Normal_AI.choose_game();
}
}
function noCards(array_cards) {
var _local1 = 1;
while (_local1 <= 4) {
if (array_cards[_local1]) {
return(false);
}
_local1++;
}
return(true);
}
function IsGameStop() {
return(((Stop_game || (Pause_game)) || (Stop_game_Score)) || (Stop_game_Preview));
}
function update_score_card_preview() {
var i = 0;
while (i < history.Score_cards.length) {
duplicateMovieClip ("score_card", "score_card" + i, 500 + i);
var mc = eval ("_root.score_card" + i);
mc._type = history.Score_cards[i].type;
mc._num = history.Score_cards[i].num;
mc._y = mc._y + (history.Score_cards[i].Position * 30);
i++;
}
}
function remove_score_card_preview(card) {
var i = 0;
while (i < 18) {
var mc = eval ("_root.score_card" + i);
if ((mc.card.num == card.num) && (mc.card.type == card.type)) {
removeMovieClip(mc);
}
i++;
}
}
stop();
var NewGame = false;
var isWin = false;
var winner_number = 1;
var turn = new Turn();
var king = new King();
var history = new History();
var interval_AI = 0;
var interval_Empty = 0;
var interval_Wait = 0;
var Stop_game = false;
var Pause_game = false;
var currentGames = new Array();
var move_cards = new Array();
var SoundLoader1 = new SoundLoader(sound_loader_mc, "");
start_new_game();
Symbol 3 MovieClip [pressing trigger] Frame 1
function pressing() {
if (_press) {
_debug = _debug + "p";
var x = eval ("_parent." + command);
x();
} else {
_debug = _debug + ".";
}
Start = _debug.length - 50;
if (Star < 0) {
Start = 0;
}
_debug = _debug.substr(Start, Start + 50);
}
var _debug;
this.onEnterFrame = pressing;
target_button = eval ("_parent." + target_button);
target_button.onRelease = (target_button.onReleaseOutside = function () {
_press = false;
});
target_button.onPress = function () {
_press = true;
};
Symbol 10 MovieClip Frame 15
stop();
Symbol 17 MovieClip Frame 1
function start() {
play();
}
function stop() {
gotoAndStop (1);
}
stop();
Symbol 19 MovieClip Frame 1
function start() {
play();
}
function stop() {
gotoAndStop (1);
}
stop();
Symbol 21 MovieClip Frame 1
function start() {
play();
}
function stop() {
gotoAndStop (1);
}
stop();
Symbol 23 MovieClip Frame 1
function start() {
play();
}
function stop() {
gotoAndStop (1);
}
stop();
Symbol 25 MovieClip Frame 1
function start() {
play();
}
function stop() {
gotoAndStop (1);
}
stop();
Symbol 27 MovieClip Frame 1
function start() {
play();
}
function stop() {
gotoAndStop (1);
}
stop();
Symbol 47 MovieClip Frame 1
hotArea.onRelease = function () {
isReleased = true;
checked = !checked;
};
hotArea.onRollOver = function () {
_root.RollOverSound_mc.start();
};
label_txt.autoSize = "Left";
function Enable_update(prop, oldVal, newVal) {
if (!newVal) {
HR._width = label_txt._width;
}
HR._visible = !newVal;
enabled = newVal;
return(newVal);
}
var checked;
var enabled;
if (group != "") {
isGroup = true;
} else {
isGroup = false;
}
var check_update = function (prop, oldVal, newVal) {
if (isGroup && (isReleased)) {
isReleased = false;
var i = 1;
while (eval (("_parent." + group) + i)) {
if (eval (("_parent." + group) + i) != this) {
eval (("_parent." + group) + i).checked = false;
} else {
Set("_root." + group, i);
}
i++;
}
if (oldVal) {
newVal = oldVal;
}
}
if (isReleased) {
isReleased = false;
if (!isGroup) {
_root.check_games(this);
}
}
if (newVal) {
Check_box_BG.gotoAndStop(2 + (isGroup * 2));
check_mc.gotoAndStop(2 + (isGroup * 2));
} else {
Check_box_BG.gotoAndStop(1 + (isGroup * 2));
check_mc.gotoAndStop(1 + (isGroup * 2));
}
if (var_str != "") {
Set(var_str, newVal);
}
return(newVal);
};
var enabled_update = function (prop, oldVal, newVal) {
hotArea.enabled = newVal;
return(newVal);
};
this.watch("checked", check_update);
this.watch("enabled", enabled_update);
this.watch("Enable", Enable_update);
enabled = true;
if (!isGroup) {
checked = (((var_str != "") && (eval (var_str))) ? (eval (var_str)) : (Default));
if (var_str != "") {
Set(var_str, checked);
}
} else {
if (eval ("_root." + group) == undefined) {
checked = Default;
if (Default) {
var i = 1;
while (eval (("_parent." + group) + i) != this) {
i++;
}
Set("_root." + group, i);
}
}
checked = this == eval (("_parent." + group) + eval ("_root." + group));
}
Enable = Enable;
Symbol 52 MovieClip Frame 1
stop();
Symbol 53 Button
on (release) {
if (controller_mc._currentframe == 2) {
this.start();
} else {
this.stop();
}
}
Symbol 55 MovieClip Frame 1
function nextRandomSound() {
random_sound = random(17);
start();
}
function start() {
gotoAndStop (3);
if (random_sound == 0) {
gotoAndStop (2);
} else {
my_sound.loadSound(("sound\\Loop\\sound" + random_sound) + ".mp3");
}
controller_mc.gotoAndStop(1);
}
function stop() {
gotoAndStop (3);
my_sound.stop();
controller_mc.gotoAndStop(2);
}
var my_sound = new Sound();
var random_sound;
my_sound.onLoad = function (success) {
if (success) {
my_sound.start(0, 999);
status_txt.text = "Sound loaded";
} else {
status_txt.text = "Sound failed";
}
};
nextRandomSound();
Symbol 62 Button
on (release) {
fscommand ("Quit", "true");
}
Symbol 66 MovieClip Frame 10
stop();
Symbol 78 Button
on (release) {
_root.play();
this.play();
}
Symbol 88 MovieClip Frame 10
stop();
Symbol 89 Button
on (press) {
isPress = true;
}
on (release, releaseOutside) {
status = getLabel(this);
isPress = false;
}
Symbol 92 MovieClip Frame 1
function slide(value) {
value = parseInt(value);
if ((value >= 0) && (value <= 100)) {
btn._x = start_x + value;
percent = value;
} else {
trace(value);
}
status = getStatus(this);
status = getLabel(this);
}
start_x = btn._x;
onEnterFrame = function () {
if (isPress) {
if ((this._xmouse - start_x) > 100) {
btn._x = start_x + 100;
} else if ((this._xmouse - start_x) > 0) {
btn._x = this._xmouse;
} else {
btn._x = start_x;
}
percent = btn._x - start_x;
status = getStatus(this);
}
};
if (eval (Per_var) == undefined) {
slide(DefaultPer);
} else {
slide(eval (Per_var));
}
Symbol 96 MovieClip Frame 1
function OpenOptions() {
gotoAndPlay (2);
}
stop();
Symbol 96 MovieClip Frame 14
function SpeedStatus(mc) {
Turn.ENDTURN_SPEED = ((100 - mc.percent) * 6) + 250;
return(mc.percent + " %");
}
function SpeedStatus1(mc) {
Turn.AI_SPEED = (((100 - mc.percent) * 6) + 150) - mc.percent;
return(mc.percent + " %");
}
function SpeedLabel(mc) {
Set(mc.Per_var, mc.percent);
if (mc.percent > 75) {
return("<font color ='#FF6633'>Fast");
}
if (mc.percent > 50) {
return("<font color ='#0FF000'>Medium");
}
if (mc.percent > 25) {
return("<font color ='#FFFF00'>Normal");
}
if (mc.percent >= 0) {
return("<font color ='#00FFFF'>Slow");
}
}
function AILabel(mc) {
Set(mc.Per_var, mc.percent);
if (mc.percent > 75) {
Set(mc.variable, 3);
return("<font color ='#0FF000'>Normal");
}
if (mc.percent > 50) {
Set(mc.variable, 2);
return("<font color ='#FFFF00'>Easy");
}
if (mc.percent > 25) {
Set(mc.variable, 1);
return("<font color ='#FFFFFF'>Newbie");
}
if (mc.percent >= 0) {
Set(mc.variable, random(2) + 2);
return("<font color ='#FFFFFF'>Ra<font color ='#FFFF00'>nd<font color ='#0FF000'>om");
}
}
function AIStatus(mc) {
return(mc.percent + " %");
}
GAME_SliderPercent.getLabel = SpeedLabel;
GAME_SliderPercent1.getLabel = SpeedLabel;
GAME_SliderPercent.getStatus = SpeedStatus;
GAME_SliderPercent1.getStatus = SpeedStatus1;
if (_root.gameType3 == undefined) {
_root.gameType3 = true;
}
AI1Percent.getLabel = (AI2Percent.getLabel = (AI3Percent.getLabel = AILabel));
AI1Percent.getStatus = (AI2Percent.getStatus = (AI3Percent.getStatus = AIStatus));
Instance of Symbol 47 MovieClip "gameType1" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
label = "Single";
group = "gameType";
var_str = "";
Default = false;
Enable = false;
}
Instance of Symbol 47 MovieClip "gameType2" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
label = "Complex";
group = "gameType";
var_str = "";
Default = false;
Enable = false;
}
Instance of Symbol 47 MovieClip "gameType3" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
label = "Single,Complex";
group = "gameType";
var_str = "";
Default = true;
Enable = true;
}
Instance of Symbol 92 MovieClip "AI1Percent" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
variable = "_root.comp1AI";
Per_var = "_root.AI1Percentper";
DefaultPer = 0;
}
Instance of Symbol 92 MovieClip "AI2Percent" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
variable = "_root.comp2AI";
Per_var = "_root.AI2Percentper";
DefaultPer = 0;
}
Instance of Symbol 92 MovieClip "AI3Percent" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
variable = "_root.comp3AI";
Per_var = "_root.AI3Percentper";
DefaultPer = 0;
}
Instance of Symbol 47 MovieClip "Direction1" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
label = "Right To Left";
group = "Direction";
var_str = "";
Default = false;
Enable = true;
}
Instance of Symbol 47 MovieClip "Direction2" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
label = "Left To Right";
group = "Direction";
var_str = "";
Default = true;
Enable = true;
}
Instance of Symbol 47 MovieClip "Double" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
label = "Double Cards";
group = "";
var_str = "_root.Double_Mode";
Default = false;
Enable = false;
}
Instance of Symbol 47 MovieClip "AI_SliderPercent" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
label = "Pause Mode";
group = "";
var_str = "_root.pause_After_each_play";
Default = false;
Enable = true;
}
Instance of Symbol 47 MovieClip in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
label = "Test Mode";
group = "";
var_str = "_root.testMode";
Default = false;
Enable = true;
}
Instance of Symbol 47 MovieClip "Speed_chk" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
label = "NO Time Mode";
group = "";
var_str = "_root.NO_Time_Mode";
Default = false;
Enable = true;
}
Instance of Symbol 92 MovieClip "GAME_SliderPercent1" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
variable = "";
Per_var = "_root.GAME_SliderPercent1per";
DefaultPer = 70;
}
Instance of Symbol 92 MovieClip "GAME_SliderPercent" in Symbol 96 MovieClip Frame 14
//component parameters
onClipEvent (construct) {
variable = "";
Per_var = "_root.GAME_SliderPercentper";
DefaultPer = 60;
}
Symbol 96 MovieClip Frame 15
stop();
Symbol 96 MovieClip Frame 25
stop();
Symbol 102 Button
on (release) {
Main_controller_mc.nextRandomSound();
}
Symbol 108 MovieClip Frame 3
if (random(100) > 2) {
gotoAndPlay (1);
}
Symbol 123 MovieClip Frame 1
function load(level1) {
level = level1;
HighScoreFile = SharedObject.getLocal("HighScore");
if (HighScoreFile.data.player == undefined) {
New();
} else {
update();
}
}
function set(player, score) {
score = parseInt(score);
if ((score < HighScoreFile.data.score[level]) || (HighScoreFile.data.Empty[level])) {
HighScoreFile.data.player[level] = player;
HighScoreFile.data.score[level] = score;
HighScoreFile.data.Empty[level] = false;
update();
}
}
function New() {
var _local3 = new Array();
var _local2 = new Array();
var _local4 = new Array();
HighScoreFile.data.player = _local3;
HighScoreFile.data.score = _local2;
HighScoreFile.data.Empty = _local4;
var _local1 = 0;
while (_local1 <= 12) {
HighScoreFile.data.Empty[_local1] = true;
_local1++;
}
trace(HighScoreFile.data.Empty);
trace(HighScoreFile.data.score);
trace(HighScoreFile.data.player);
findBestScore();
}
function update() {
if (!HighScoreFile.data.Empty[level]) {
Player_mc.winner._player = HighScoreFile.data.player[level];
_score = HighScoreFile.data.score[level];
} else {
Player_mc.winner._player = "ByQusai...";
_score = "";
}
}
function findBestScore() {
var _local1 = 12;
while (HighScoreFile.data.Empty[_local1] && (_local1)) {
_local1--;
}
if (_local1) {
trace(HighScoreFile.data.Empty);
level = _local1;
}
update();
}
var level = 0;
if (Preview) {
load(Preview);
}
Symbol 127 MovieClip Frame 1
function twoDecimal(str) {
var _local2 = str;
_trace = length(_local2);
if (length(_local2) < 2) {
str = "0" + str;
}
return(str);
}
stop();
var day = new Array("Sun", "Mon", "Tue", "Wen", "Thu", "Fri", "Sat", "Sun");
onEnterFrame = function () {
var _local1 = new Date();
time = (((((day[_local1.getDay()] + "\t") + ((_local1.getHours() != 12) ? (_local1.getHours() % 12) : 12)) + ":") + twoDecimal(_local1.getMinutes())) + ".") + twoDecimal(_local1.getSeconds());
};
Symbol 323 MovieClip [__Packages.Turn] Frame 0
class Turn
{
var current;
function Turn () {
}
function setTurn(param1) {
current = param1;
}
function next() {
set_Roll_card();
current++;
if (current > 4) {
current = 1;
}
}
function pass() {
_root.Status = "<B><FONT Color='#FF0000'>PASS</FONT></B>";
next();
check_End_game_Round();
}
function check_End_game_Round() {
if (((_root.history.used_cards % 4) == 0) && (!_root.currentGames[1])) {
_root.Stop_game = true;
_root.Status = " Wait ";
if (!_root.interval_Empty) {
var _local3 = ENDTURN_SPEED;
if (_root.speedy_mode) {
_local3 = int(_local3 / 2);
} else if (_root.NO_Time_Mode) {
_local3 = 0;
}
_root.interval_Empty = setInterval(this, "MoveAreas", _local3);
} else {
throw new Error((((("Error : AI> " + _root.interval_AI) + " WAIT> ") + _root.interval_Wait) + " EMPTY> ") + _root.interval_Empty);
}
} else if ((_root.history.used_cards == 52) && (_root.currentGames[1])) {
_root.Stop_game = true;
_root.Status = " Wait ";
if (!_root.interval_Wait) {
var _local3 = ENDTURN_SPEED;
if (_root.speedy_mode) {
_local3 = int(_local3 / 2);
} else if (_root.NO_Time_Mode) {
_local3 = 0;
}
_root.interval_Wait = setInterval(this, "Wait", _local3);
} else {
throw new Error((((("Error : AI> " + _root.interval_AI) + " WAIT> ") + _root.interval_Wait) + " EMPTY> ") + _root.interval_Empty);
}
} else if (current) {
if (!_root.NewGame) {
start_PlayerAI();
} else {
_root.gotoAndStop("newGame");
}
}
}
function set_Roll_card() {
var Area_card = eval ("_root.Areas.Area" + current).hotArea.card;
if (!_root.currentGames[1]) {
Area_card.RollOver_mc.gotoAndStop(1);
if ((_root.history.used_cards % 4) == 0) {
_root.history.play_type = Area_card.type;
_root.history.play_Id = Area_card.Id;
_root.history.Bigger = Area_card.owner;
_root.card_type._visible = true;
_root.card_type.gotoAndStop(Area_card.type);
Area_card.RollOver_mc.gotoAndStop(2);
}
var Bigger_card = eval ("_root.Areas.Area" + _root.history.Bigger).hotArea.card;
if (Area_card.type == _root.history.play_type) {
if (_root.history.play_Id < Area_card.Id) {
Bigger_card.RollOver_mc.gotoAndStop(1);
_root.history.Bigger = Area_card.owner;
_root.history.play_Id = Area_card.Id;
Area_card.RollOver_mc.gotoAndStop(2);
}
} else if (!_root.history.possibleRunPlayers[Area_card.owner][_root.history.play_type]) {
_root.history.possibleRunPlayers[Area_card.owner][_root.history.play_type] = true;
}
_root.history.Turn_score = _root.history.Turn_score + _root.CalcScore(Area_card);
}
}
function start_PlayerAI() {
_root.Status = ("Turn to : <B><FONT Color='#FF0000'>" + _root.history.names[current].name) + "</FONT></B>";
set_turn_shape();
if (!_root.interval_AI) {
var level = _root.history.names[current].AI;
if (!_root.history.names[current].human) {
var delay = (AI_SPEED + (50 * level));
delay = delay + ((_root.testMode && (level == 2)) ? 50 : 0);
if (_root.speedy_mode) {
delay = int(delay / 2);
} else if (_root.NO_Time_Mode) {
delay = 0;
}
_root.interval_AI = setInterval(_root, "AI" + level, delay);
} else {
_root.interval_AI = setInterval(_root, "AI3", 10);
}
if (_root.currentGames[1]) {
var possible_cards = new Array();
var info_mc = eval (("info" + current) + ".info");
_root.FindTrex_Cards(possible_cards);
_root._trace1 = (current + "-->") + possible_cards.length;
if ((!_root.noCards(info_mc.cards)) && (possible_cards.length == 0)) {
info_mc.pass_mc.open();
}
if (possible_cards.length == 0) {
clearInterval(_root.interval_AI);
_root.interval_AI = 0;
if (_root.pause_After_each_play) {
_root.Pause_game = true;
}
pass();
} else if ((possible_cards.length == 1) && (_root.AutoPlay)) {
clearInterval(_root.interval_AI);
_root.interval_AI = 0;
var delay = AI_SPEED;
delay = delay + ((_root.testMode && (level == 2)) ? 50 : 0);
if (_root.speedy_mode) {
delay = int(delay / 2);
} else if (_root.NO_Time_Mode) {
delay = 0;
}
_root.interval_AI = setInterval(_root, "AI1", delay);
}
}
} else {
throw new Error((((("Error : AI> " + _root.interval_AI) + " WAIT> ") + _root.interval_Wait) + " EMPTY> ") + _root.interval_Empty);
}
}
function set_turn_shape() {
_root.pointer.light._visible = _root.history.names[current].human;
_root.pointer._visible = current != null;
var info_mc = eval ("info" + current);
_root.pointer._x = ((current != 4) ? (info_mc._x) : (info_mc._x + info_mc._width));
_root.pointer._y = ((current < 3) ? (info_mc._y) : (info_mc._y + info_mc._height));
_root.pointer._rotation = 180 - (90 * current);
switch (current) {
case 1 :
_root.pointer._x = _root.pointer._x + (info_mc._width / 2);
return;
case 2 :
_root.pointer._y = _root.pointer._y + (info_mc._height / 2);
return;
case 3 :
_root.pointer._x = _root.pointer._x + (info_mc._width / 2);
return;
case 4 :
_root.pointer._y = _root.pointer._y - (info_mc._height / 2);
}
}
function MoveAreas() {
if (_root.NoMoveCards()) {
_root.card_type._visible = false;
clearInterval(_root.interval_Empty);
_root.interval_Empty = 0;
var i = 1;
while (i <= 4) {
var Bigger_card = eval (("_root.Areas.Area" + _root.history.Bigger) + ".hotArea.card");
var card_mc = eval (("_root.Areas.Area" + i) + ".hotArea.card");
if (card_mc.getDepth() > Bigger_card.getDepth()) {
card_mc.swapDepths(Bigger_card);
}
var delay = ENDTURN_SPEED;
if (_root.speedy_mode) {
delay = int(delay / 2);
} else if (_root.NO_Time_Mode) {
delay = 0;
}
card_mc.move.to(_root.card_type._x, _root.card_type._y, int(delay / 48));
card_mc.move.start();
i++;
}
var delay = ENDTURN_SPEED;
if (_root.speedy_mode) {
delay = int(delay / 2);
} else if (_root.NO_Time_Mode) {
delay = 0;
}
_root.interval_Empty = setInterval(this, "moveCards_to_Player", delay);
}
}
function moveCards_to_Player() {
clearInterval(_root.interval_Empty);
var i = 1;
while (i <= 4) {
var Bigger_point = eval ("_root.point" + _root.history.Bigger);
var card_mc = eval (("_root.Areas.Area" + i) + ".hotArea.card");
var delay = ENDTURN_SPEED;
if (_root.speedy_mode) {
delay = int(delay / 2);
} else if (_root.NO_Time_Mode) {
delay = 0;
}
card_mc.move.to(Bigger_point._x, Bigger_point._y, int(delay / 48));
card_mc.move.start();
i++;
}
var delay = 100;
if (_root.speedy_mode) {
delay = int(delay / 2);
} else if (_root.NO_Time_Mode) {
delay = 0;
}
_root.interval_Empty = setInterval(this, "EmptyAreas", delay);
}
function EmptyAreas() {
_root.Stop_game = false;
clearInterval(_root.interval_Empty);
_root.interval_Empty = 0;
var i = 1;
while (i <= 4) {
var mc = eval (("_root.Areas.Area" + i) + ".hotArea");
mc.isUsed = false;
mc.card.move.stop();
mc.card._x = mc.card.new_x;
mc.card._y = mc.card.new_y;
mc.card._visible = false;
_root.history.lastFour[i] = mc.card;
mc.card = undefined;
i++;
}
if ((_root.history.used_cards == 52) || (!_root.history.ThereScore_cards())) {
_root.Stop_game = true;
_root.Status = " Wait ";
if (!_root.interval_Wait) {
var delay = ENDTURN_SPEED;
if (_root.speedy_mode) {
delay = int(delay / 2);
} else if (_root.NO_Time_Mode) {
delay = 0;
}
_root.interval_Wait = setInterval(this, "Wait", delay);
} else {
throw new Error((((("Error : AI> " + _root.interval_AI) + " WAIT> ") + _root.interval_Wait) + " EMPTY> ") + _root.interval_Empty);
}
} else {
_root.update_scores();
_root.history.Turn_score = 0;
setTurn(_root.history.Bigger);
start_PlayerAI();
}
}
function Wait() {
if (_root.NoMoveCards()) {
_root.Stop_game = false;
clearInterval(_root.interval_Wait);
_root.interval_Wait = 0;
_root.update_scores();
_root.start_sub_game();
}
}
function ChooseGame() {
if (!_root.history.names[_root.king.current].human) {
var _local2 = _root.history.names[_root.king.current].AI;
_root.interval_AI = setInterval(_root, "AI" + _local2, 10);
} else if ((_root.history.games_played % 5) == 4) {
_root.interval_AI = setInterval(_root, "AI3", 10);
}
}
var move_cards = new Array();
static var AI_SPEED = 50;
static var ENDTURN_SPEED = 30;
}
Symbol 324 MovieClip [__Packages.Player] Frame 0
class Player
{
var name, AI, human, score, _score;
function Player (param1, param2) {
name = param1;
AI = param2;
human = param2 == 0;
name = param1;
if (AI == 1) {
do {
name = "\u00A9" + Random_AI.random_names[random(Random_AI.random_names.length)];
} while (isInUsed_names(name));
Used_names.push(name);
}
if (AI == 2) {
do {
name = "\u00A9" + Easy_AI.random_names[random(Easy_AI.random_names.length)];
} while (isInUsed_names(name));
Used_names.push(name);
}
if (AI == 3) {
do {
name = "\u00A9" + Normal_AI.random_names[random(Normal_AI.random_names.length)];
} while (isInUsed_names(name));
Used_names.push(name);
}
score = "---";
_score = 0;
}
function get player_score() {
return(_score);
}
function set player_score(param_score) {
_score = param_score;
if (_score > 0) {
score = ("<B>+" + param_score) + "</B>";
score = ("<font color='#FF0000'>" + score) + "</font>";
} else if (_score) {
score = ("<B>-" + Math.abs(param_score)) + "</B>";
score = ("<font color='#00FF00'>" + score) + "</font>";
} else {
score = "<B>---</B>";
score = ("<font color='#FFFFFF'>" + score) + "</font>";
}
//return(player_score);
}
static function isInUsed_names(x) {
var _local1 = 0;
while (_local1 < Used_names.length) {
if (Used_names[_local1] == x) {
return(true);
}
_local1++;
}
return(false);
}
static var Used_names = new Array();
}
Symbol 325 MovieClip [__Packages.Random_AI] Frame 0
class Random_AI
{
function Random_AI () {
}
static function start() {
if (!_root.IsGameStop()) {
var _local2;
switch (_root.currentGames[1]) {
case true :
_local2 = game1();
break;
case false :
_local2 = games2To5();
}
if ((!_root.history.names[_root.turn.current].human) || true) {
_local2.onRollOver();
_local2.onPress();
_local2.sender = _root.turn.current;
_local2.onRelease();
_local2.sender = undefined;
_local2.onRollOut();
} else {
_root.Selection_card.Selection_mc.close();
_local2.Selection_mc.open();
}
if (_root.pause_After_each_play) {
_root.Pause_game = true;
}
}
}
static function games2To5() {
clearInterval(_root.interval_AI);
_root.interval_AI = 0;
var _local2;
switch ((_root.history.used_cards % 4) == 0) {
case true :
_local2 = start_newFour();
break;
case false :
_local2 = cont_cards();
}
return(_local2);
}
static function start_newFour() {
var card_mc;
do {
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + (random(13) + 1));
} while (card_mc.isUsed || (!card_mc._visible));
return(card_mc);
}
static function cont_cards() {
var _local3;
var _local2 = new Array();
_root.FindType_Cards(_local2);
if (_local2.length > 0) {
_local3 = _local2[random(_local2.length)];
} else {
_local3 = chooseOtherTypes();
}
return(_local3);
}
static function chooseOtherTypes() {
var card_mc;
do {
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + (random(13) + 1));
} while (card_mc.isUsed || (!card_mc._visible));
return(card_mc);
}
static function game1() {
clearInterval(_root.interval_AI);
_root.interval_AI = 0;
var _local3;
var _local2 = new Array();
_root.FindTrex_Cards(_local2);
if (_local2.length > 0) {
_local3 = _local2[random(_local2.length)];
} else {
throw new Error("Error : No card for game1");
}
return(_local3);
}
static function choose_game() {
if (!_root.IsGameStop()) {
if ((!_root.game6.checked) && (!_root.game1.checked)) {
if (random(2)) {
_root.game6.hotArea.onRelease();
} else {
_root.game1.hotArea.onRelease();
}
} else if (_root.game1.checked) {
_root.game6.hotArea.onRelease();
} else {
_root.game1.hotArea.onRelease();
}
clearInterval(_root.interval_AI);
_root.interval_AI = 0;
_root.start_btn.onRelease();
}
}
static var random_names = new Array("ahmed", "mhmd", "Zed");
}
Symbol 326 MovieClip [__Packages.Easy_AI] Frame 0
class Easy_AI
{
function Easy_AI () {
}
static function start() {
if (!_root.IsGameStop()) {
var _local2;
switch (_root.currentGames[1]) {
case true :
_local2 = game1();
break;
case false :
_local2 = games2To5();
}
if (!_root.history.names[_root.turn.current].human) {
_local2.onRollOver();
_local2.onPress();
_local2.sender = _root.turn.current;
_local2.onRelease();
_local2.sender = undefined;
_local2.onRollOut();
} else {
_root.Selection_card.Selection_mc.close();
_local2.Selection_mc.open();
}
if (_root.pause_After_each_play) {
_root.Pause_game = true;
}
}
}
static function games2To5() {
clearInterval(_root.interval_AI);
_root.interval_AI = 0;
var _local2;
switch ((_root.history.used_cards % 4) == 0) {
case true :
_local2 = start_newFour();
break;
case false :
_local2 = cont_cards();
}
return(_local2);
}
static function start_newFour() {
var card_mc;
var prop = new Array();
FillProp(prop);
var best = 0;
var i = 1;
while (i <= 13) {
if (prop[i]) {
if (best == 0) {
best = i;
} else if (prop[i] < prop[best]) {
best = i;
}
}
i++;
}
var bests = new Array();
var i = 1;
while (i <= 13) {
if (prop[i] == prop[best]) {
bests.push(i);
}
i++;
}
if (bests.length == 0) {
throw new Error("Error : choosing card of any of start_newFour");
}
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + bests[random(bests.length - 1)]);
return(card_mc);
}
static function FillProp(prop) {
var card_mc;
var i = 1;
while (i <= 13) {
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + i);
prop[i] = ((card_mc.isUsed || (!card_mc._visible)) ? 0 : 1);
if (prop[i]) {
var RemainingTypeNum = _root.history.RemainingType(card_mc);
var SmallerTypeNum = _root.history.SmallerType(card_mc);
prop[i] = Card_prop(RemainingTypeNum, SmallerTypeNum, 3) + 1;
prop[i] = prop[i] + _root.CalcScore(card_mc);
prop[i] = prop[i] + ((card_mc.type == 2) ? 50 : 0);
}
i++;
}
}
static function Card_prop(RemainingTypeNum, SmallerTypeNum, players) {
var _local2 = 1;
var _local3 = 1;
if (RemainingTypeNum < players) {
players = RemainingTypeNum;
}
var _local1 = 0;
while (_local1 < players) {
_local2 = _local2 * (SmallerTypeNum - _local1);
_local3 = _local3 * (RemainingTypeNum - _local1);
_local1++;
}
return(int((_local2 / _local3) * 1000));
}
static function cont_cards() {
var _local6;
var _local2 = new Array();
_root.FindType_Cards(_local2);
if (_local2.length > 0) {
var _local7;
var _local5 = false;
var _local3 = 0;
while (_local3 < _local2.length) {
if (_local2[_local3].Id < _root.history.play_Id) {
_local5 = true;
break;
}
_local3++;
}
if (_local5) {
var _local4 = -1;
_local3 = _local2.length - 1;
while (_local3 >= 0) {
if (_local2[_local3].Id < _root.history.play_Id) {
_local4 = _local3;
}
_local3--;
}
_local7 = _local4;
} else {
var _local4 = -1;
_local3 = _local2.length - 1;
while (_local3 >= 0) {
if (_local4 == -1) {
_local4 = _local3;
} else if (_root.CalcScore(_local2[_local3]) < _root.CalcScore(_local2[_local4])) {
_local4 = _local3;
}
_local3--;
}
_local7 = _local4;
}
_local6 = _local2[_local7];
} else {
_local6 = chooseOtherTypes();
}
return(_local6);
}
static function chooseOtherTypes() {
var card_mc;
var prop = new Array();
FillProp(prop);
var best = 0;
var i = 1;
while (i <= 13) {
if (prop[i]) {
if (best == 0) {
best = i;
} else if (prop[i] > prop[best]) {
best = i;
}
}
i++;
}
var bests = new Array();
var i = 1;
while (i <= 13) {
if (prop[i] == prop[best]) {
bests.push(i);
}
i++;
}
if (bests.length == 0) {
throw new Error("Error : choosing card of any of chooseOtherTypes");
}
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + bests[random(bests.length - 1)]);
return(card_mc);
}
static function game1() {
clearInterval(_root.interval_AI);
_root.interval_AI = 0;
var _local3;
var _local2 = new Array();
_root.FindTrex_Cards(_local2);
if (_local2.length > 0) {
_local3 = bestTrexCard(_local2);
} else {
throw new Error("Error : No card for game1");
}
return(_local3);
}
static function bestTrexCard(possible_cards) {
var card_mc;
var prop = new Array();
var j = 0;
while (j < possible_cards.length) {
var i = possible_cards[j].index;
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + i);
prop[i] = MinSpaceCards_num(card_mc);
j++;
}
var best = 0;
var i = 1;
while (i < possible_cards.length) {
if (prop[possible_cards[best].index] <= prop[possible_cards[i].index]) {
if (prop[possible_cards[best].index] == prop[possible_cards[i].index]) {
if (SpaceCards_num(possible_cards[i]) < SpaceCards_num(possible_cards[best])) {
best = i;
}
} else {
best = i;
}
}
i++;
}
return(possible_cards[best]);
}
static function SpaceCards_num(card_mc) {
var _local2 = 0;
var _local1 = card_mc;
if (card_mc.Id >= 11) {
_local1 = _local1.next();
if (_local1 != null) {
_local2 = _local2 + ((_local1.Id - card_mc.Id) - 1);
} else {
_local2 = _local2 + ((15 - card_mc.Id) - 1);
}
}
_local1 = card_mc;
if (card_mc.Id <= 11) {
_local1 = _local1.prev();
if (_local1 != null) {
_local2 = _local2 + ((card_mc.Id - _local1.Id) - 1);
} else {
_local2 = _local2 + ((card_mc.Id - 1) - 1);
}
if ((_local1 == null) && (_local2)) {
_local2 = _local2 + 10;
}
}
return(_local2);
}
static function MinSpaceCards_num(card_mc) {
var _local2 = 0;
var _local1 = card_mc;
if (card_mc.Id <= 11) {
_local1 = _local1.prev();
while (_local1 != null) {
_local2--;
if (_local1.prev() == null) {
_local2 = _local2 + (100 - (_local1.Id * 10));
_local2 = _local2 + ((card_mc.Id - _local1.Id) - 1);
}
_local1 = _local1.prev();
}
}
return(_local2);
}
static function choose_game() {
if (!_root.IsGameStop()) {
var current = _root.king.current;
var Game6points = 0;
var Game1points = 0;
if (!_root.game6.checked) {
var i = 1;
while (i <= 13) {
var card_mc = eval ((("_root.card" + current) + "_") + i);
var info_mc = eval (("info" + current) + ".info");
if ((card_mc.Id > 10) && (info_mc.cards[card_mc.type] < 4)) {
Game6points = Game6points - (CalcScore(card_mc) + 15);
}
i++;
}
}
if (!_root.game1.checked) {
var i = 1;
while (i <= 13) {
var card_mc = eval ((("_root.card" + current) + "_") + i);
if (card_mc.Id < 5) {
Game1points = Game1points - ((5 - card_mc.Id) * 10);
}
i++;
}
}
if ((!_root.game6.checked) && (!_root.game1.checked)) {
if ((Game6points / 2) > Game1points) {
_root.game6.hotArea.onRelease();
} else {
_root.game1.hotArea.onRelease();
}
} else if (_root.game1.checked) {
_root.game6.hotArea.onRelease();
} else {
_root.game1.hotArea.onRelease();
}
clearInterval(_root.interval_AI);
_root.interval_AI = 0;
_root.start_btn.onRelease();
}
}
static function CalcScore(card_mc) {
var _local5 = 0;
var _local3 = 0;
var _local4 = 0;
var _local1 = 0;
if (card_mc.type == 2) {
_local5++;
}
if (card_mc.Id == 12) {
_local3++;
}
if ((card_mc.type == 4) && (card_mc.Id == 13)) {
_local4++;
}
_local1 = _local1 + (true ? (_local4 * 75) : 0);
_local1 = _local1 + (true ? (_local3 * 25) : 0);
_local1 = _local1 + (true ? (_local5 * 40) : 0);
return(_local1);
}
static var random_names = new Array("Osama", "Imran", "Musab", "Haitham", "Shadi", "Lieth", "Sliman", "Ammar", "Sami");
}
Symbol 327 MovieClip [__Packages.Normal_AI] Frame 0
class Normal_AI
{
static var StartNewFour;
function Normal_AI () {
}
static function choose_game() {
if (!_root.IsGameStop()) {
var current = _root.king.current;
var scores = new Array();
if (!_root.game1.checked) {
scores[1] = 20;
var i = 1;
while (i <= 13) {
var card_mc = eval ((("_root.card" + current) + "_") + i);
if (card_mc.Id < 5) {
scores[1] = scores[1] - ((5 - card_mc.Id) * 10);
}
i++;
}
}
if (!_root.game2.checked) {
if (info_mc.cards[4] > 4) {
scores[2] = -25;
} else {
scores[2] = -50;
}
var i = 1;
while (i <= 13) {
var card_mc = eval ((("_root.card" + current) + "_") + i);
var info_mc = eval (("info" + current) + ".info");
if ((card_mc.Id == 13) && (card_mc.type == 4)) {
if (info_mc.cards[4] > 4) {
scores[2] = 0;
} else {
scores[2] = -75;
}
}
i++;
}
}
if (!_root.game3.checked) {
scores[3] = 0;
var i = 1;
while (i <= 13) {
var card_mc = eval ((("_root.card" + current) + "_") + i);
var info_mc = eval (("info" + current) + ".info");
if (card_mc.Id == 12) {
if (info_mc.cards[card_mc.type] <= 4) {
scores[3] = scores[3] - 25;
}
}
i++;
}
}
if (!_root.game4.checked) {
scores[4] = MinEats(2) * -40;
}
if (!_root.game5.checked) {
scores[5] = 15;
var i = 1;
while (i <= 4) {
scores[5] = scores[5] + (MinEats(i) * -15);
i++;
}
}
var bests = new Array();
FindMax(scores, bests);
if (_root.testmode) {
_root.watcher = (scores + newline) + bests;
_root.pause_mc.pause_btn.onRelease();
}
var i = 0;
while (i < bests.length) {
var mc = eval (("_root.game" + bests[i]) + ".hotArea");
mc.onRelease();
i++;
}
clearInterval(_root.interval_AI);
_root.interval_AI = 0;
if (!_root.history.names[_root.king.current].human) {
_root.start_btn.onRelease();
}
}
}
static function MinEats(type) {
var current = _root.king.current;
var i = 1;
while (i <= 13) {
var card_mc = eval ((("_root.card" + current) + "_") + i);
var info_mc = eval (("info" + current) + ".info");
if (card_mc.type == type) {
break;
}
i++;
}
while (card_mc.prev() != null) {
card_mc = card_mc.prev();
}
var eats = 0;
var remainingCards = (13 - info_mc.cards[type]);
var playedCards = 0;
var temp_card;
var num = 0;
while (card_mc != null) {
temp_card = card_mc;
temp_card = temp_card.prev();
if (temp_card != null) {
num = num + ((card_mc.Id - temp_card.Id) - 1);
} else {
num = num + (card_mc.Id - 2);
}
if (num >= (3 + playedCards)) {
eats++;
}
playedCards = playedCards + 3;
remainingCards = remainingCards - 3;
card_mc = card_mc.next();
}
return(eats);
}
static function start() {
if (!_root.IsGameStop()) {
_root.prop_table = "";
var _local2;
switch (_root.currentGames[1]) {
case true :
_local2 = game1();
break;
case false :
_local2 = games2To5();
}
if (!_root.history.names[_root.turn.current].human) {
_local2.onRollOver();
_local2.onPress();
_local2.sender = _root.turn.current;
_local2.onRelease();
_local2.sender = undefined;
_local2.onRollOut();
if (_root.pause_After_each_play || (((!_root.currentGames[1]) && (_root.AutoPlay)) && (_root.testMode))) {
_root.Pause_game = true;
}
} else {
_root.Selection_card.Selection_mc.close();
_local2.Selection_mc.open();
}
_root.watcher = _root.watcher + "\n<<<----------------->>> ";
}
}
static function game1() {
clearInterval(_root.interval_AI);
_root.interval_AI = 0;
var _local3;
var _local2 = new Array();
_root.FindTrex_Cards(_local2);
if (_local2.length > 0) {
_local3 = bestTrexCard(_local2);
} else {
throw new Error("Error : No card for game1");
}
return(_local3);
}
static function games2To5() {
clearInterval(_root.interval_AI);
_root.interval_AI = 0;
var _local2;
switch ((_root.history.used_cards % 4) == 0) {
case true :
_local2 = start_newFour();
break;
case false :
_local2 = cont_cards();
}
return(_local2);
}
static function chooseBestIndex(prop, bests_index) {
_root.bests_index = _root.bests_index + "\n>>>";
_root.bests_index = _root.bests_index + (newline + ("bests_index : " + bests_index));
var best;
var Score_bests = new Array();
best = 0;
var i = 1;
while (i < bests_index.length) {
var card_mc = eval ((("_root.card" + _root.turn.current) + "_") + bests_index[i]);
var best_card_mc = eval ((("_root.card" + _root.turn.current) + "_") + bests_index[best]);
if (expected_score(card_mc, prop) < expected_score(best_card_mc, prop)) {
best = i;
}
i++;
}
var i = 0;
while (i < bests_index.length) {
var card_mc = eval ((("_root.card" + _root.turn.current) + "_") + bests_index[i]);
var best_card_mc = eval ((("_root.card" + _root.turn.current) + "_") + bests_index[best]);
if (expected_score(card_mc, prop) == expected_score(best_card_mc, prop)) {
Score_bests.push(bests_index[i]);
}
i++;
}
var best_card_mc = eval ((("_root.card" + _root.turn.current) + "_") + bests_index[best]);
_root.bests_index = _root.bests_index + (newline + ((("The Best Score is :" + expected_score(best_card_mc, prop)) + " At : ") + Score_bests));
best = Score_bests[FindMinTypeNum(Score_bests, _root.turn.current)];
_root.bests_index = _root.bests_index + (newline + ("The Best is :" + best));
return(best);
}
static function expected_score(card_mc, prop) {
var _local2 = 0;
_local2 = _local2 + CalcScore(card_mc);
_local2 = _local2 + _root.history.Turn_score;
_local2 = _local2 + (_root.currentGames[5] ? 15 : 0);
return((_local2 * prop[card_mc.index]) / 1000);
}
static function start_newFour() {
var card_mc;
var prop = new Array();
var bests_index = new Array();
MakeGame5Prop(prop, false);
if (_root.currentGames[2] && (_root.history.stillKing())) {
game2(prop, bests_index);
}
if (_root.currentGames[3] && (_root.history.stillQueens())) {
game3(prop, bests_index);
}
if (_root.currentGames[4] && (_root.history.stillDiamonds())) {
game4(prop, bests_index);
}
if (!_root.currentGames[5]) {
BestBigCard(prop, bests_index);
}
game5(prop, bests_index);
MakeGame5Prop(prop, false);
var best = chooseBestIndex(prop, bests_index);
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + best);
return(card_mc);
}
static function game2(prop, best_cards) {
_root.watcher = _root.watcher + "\nKing : ...";
var _local2 = new Array();
var _local4 = new Array();
CopyArray(prop, _local2);
var _local3 = null;
RemoveScoreCards(_local2);
RemoveRunCards(_local2);
RemoveTypeCards(_local2, 4);
var _local5 = (_root.history.used_cards % 4) != 0;
FindMaxRange(_local2, _local4, 500);
_local3 = FindMinTypeNum(_local4, _root.turn.current);
if (_local3 != null) {
_root.watcher = _root.watcher + (" NotHearts:" + _local4[_local3]);
best_cards.push(_local4[_local3]);
}
}
static function game3(prop, best_cards) {
_root.watcher = _root.watcher + "\nQueens: ...";
var _local4 = new Array();
var _local6 = new Array();
CopyArray(prop, _local4);
var _local5 = null;
var _local3 = GetQueens();
RemoveScoreCards(_local4);
RemoveRunCards(_local4);
var _local2 = 0;
while (_local2 < _local3.length) {
RemoveTypeCards(_local4, _local3[_local2]);
_local2++;
}
FindMaxRange(_local4, _local6, 500);
_local5 = FindMinTypeNum(_local6, _root.turn.current);
if (_local5 != null) {
_root.watcher = _root.watcher + (" NotQueens :" + _local6[_local5]);
best_cards.push(_local6[_local5]);
}
}
static function game4(prop, best_cards) {
_root.watcher = _root.watcher + "\nDiamod:";
var prop_copy = new Array();
var bests = new Array();
CopyArray(prop, prop_copy);
var best = null;
FindMin(prop_copy, bests);
var i = 0;
while (i < bests.length) {
var card_mc;
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + bests[i]);
if (card_mc.type == 2) {
_root.watcher = _root.watcher + (" Diamond :" + bests[i]);
best_cards.push(bests[i]);
return;
}
i++;
}
}
static function game5(prop, best_cards) {
_root.watcher = _root.watcher + "\nLtooch:";
var _local3 = new Array();
var _local2 = new Array();
CopyArray(prop, _local3);
AddScoreToProp(_local3, true);
var _local4 = null;
var _local5 = null;
var _local7;
var _local6;
FindMin(_local3, _local2);
_local4 = FindMinTypeNum(_local2, _root.turn.current);
_local7 = _local2[_local4];
if ((prop[_local2[_local4]] > 100) && (!StartNewFour)) {
_local2 = new Array();
CopyArray(prop, _local3);
RemoveScoreCards(_local3);
RemoveRunCards(_local3);
FindMax(_local3, _local2);
_local5 = FindMinTypeNum(_local2, _root.turn.current);
_local6 = _local2[_local5];
}
if (_local5 != null) {
_root.watcher = _root.watcher + ("BigCard :" + _local6);
best_cards.push(_local6);
} else if (_local4 != null) {
_root.watcher = _root.watcher + (" LessCard :" + _local7);
best_cards.push(_local7);
} else {
trace("error");
}
}
static function BestBigCard(prop, best_cards) {
_root.watcher = _root.watcher + "\nBestBigCard:---";
var prop_copy = new Array();
var bests = new Array();
CopyArray(prop, prop_copy);
var best = null;
RemoveScoreCards(prop_copy);
RemoveRunCards(prop_copy);
var BadCard = false;
var card_mc;
var counter = 0;
do {
BadCard = false;
counter++;
bests = new Array();
FindMaxRange(prop_copy, bests, 1000);
best = FindMinTypeNum(bests, _root.turn.current);
_root.watcher = _root.watcher + ("\nTest Big Card:" + bests[best]);
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + bests[best]);
prop_copy[bests[best]] = null;
do {
card_mc = card_mc.next();
} while ((card_mc.isUsed && (card_mc != null)) && (best != null));
if (card_mc != null) {
_root.watcher = _root.watcher + (" Next:" + card_mc.index);
if (prop[card_mc.index] > 500) {
_root.watcher = _root.watcher + (" Failed :" + prop[card_mc.index]);
BadCard = true;
}
}
} while (BadCard && (counter < 20));
if (best != null) {
_root.watcher = _root.watcher + (" Big Card:" + bests[best]);
best_cards.push(bests[best]);
}
}
static function cont_cards() {
var _local3;
var _local2 = new Array();
_root.FindType_Cards(_local2);
if (_local2.length > 0) {
return(start_newFour());
}
return(chooseOtherTypes());
}
static function chooseOtherTypes() {
_root.watcher = _root.watcher + "\nChoosing Best Run Card : --> ";
var card_mc;
var prop = new Array();
var bests = new Array();
MakeGame5Prop(prop, true);
var i = 1;
while (i <= 13) {
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + i);
RemoveAllTypeCards(prop, card_mc);
i++;
}
AddScoreToProp(prop, true);
FindMaxRange(prop, bests, 200);
var best = FindMinTypeNum(bests, _root.turn.current);
if (best == null) {
prop = new Array();
bests = new Array();
MakeGame5Prop(prop, true);
FindMaxRange(prop, bests, 200);
best = FindMinTypeNum(bests, _root.turn.current);
}
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + bests[best]);
return(card_mc);
}
static function bestTrexCard(possible_cards) {
var _local5 = -1;
var _local9 = new Array();
MakeGame1Prop(_local9);
var _local6 = new Array();
var _local4 = new Array();
FindMaxRange(_local9, _local6, 10);
var _local3 = 0;
while (_local3 < possible_cards.length) {
var _local2 = 0;
while (_local2 < _local6.length) {
if (cardOpens(possible_cards[_local3], _local6[_local2])) {
_local4.push(_local3);
}
_local2++;
}
_local3++;
}
if (_local4.length != 0) {
_local5 = 0;
var _local7;
var _local8;
var _local2 = 1;
while (_local2 < _local4.length) {
_local8 = possible_cards[_local4[_local5]];
_local7 = possible_cards[_local4[_local2]];
if (TrexAllowedCards_num(_local7) < TrexAllowedCards_num(_local8)) {
_local5 = _local2;
}
_local2++;
}
_local5 = _local4[_local5];
} else {
_local5 = 0;
_local3 = 1;
while (_local3 < possible_cards.length) {
var _local8 = possible_cards[_local5];
var _local7 = possible_cards[_local3];
if (TrexAllowedCards_num(_local7) < TrexAllowedCards_num(_local8)) {
_local5 = _local3;
}
_local3++;
}
}
return(possible_cards[_local5]);
}
static function MakeGame1Prop(prop) {
_root.prop_table = _root.prop_table + "-------------------------\n";
var card_mc;
var i = 1;
while (i <= 13) {
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + i);
prop[i] = ((card_mc.isUsed || (!card_mc._visible)) ? null : 10);
if ((prop[i] != null) && (prop[i] != undefined)) {
prop[i] = prop[i] + (Math.abs(11 - card_mc.Id) * 10);
prop[i] = prop[i] + NeededCards_num(card_mc);
if (NeededCards_num(card_mc) == 0) {
prop[i] = 10;
}
}
if ((prop[i] != null) && (prop[i] != undefined)) {
_root.prop_table = _root.prop_table + (newline + (((((((" Card #" + i) + " -") + card_mc.Id) + "-") + " is ") + prop[i]) + " important"));
}
i++;
}
}
static function NeededCards_num(card_mc) {
var _local3 = 0;
var _local2 = card_mc;
var _local6 = ((card_mc.Id < 11) ? 1 : 0);
var _local4 = _root.history.possibleTrexCards[card_mc.type][_local6];
_local3 = _local3 + Math.abs(_local4 - card_mc.Id);
if (card_mc.Id < 11) {
_local2 = _local2.next();
while ((_local2 != null) && (_local2.Id <= _local4)) {
_local3--;
_local2 = _local2.next();
}
} else if (card_mc.Id > 11) {
_local2 = _local2.prev();
while ((_local2 != null) && (_local2.Id >= _local4)) {
_local3--;
_local2 = _local2.prev();
}
}
return(_local3);
}
static function cardOpens(card_mc, index) {
var _local3 = card_mc;
if (card_mc.Id >= 11) {
while (card_mc != null) {
if (card_mc.index == index) {
return(true);
}
card_mc = card_mc.next();
}
}
card_mc = _local3;
if (card_mc.Id <= 11) {
while (card_mc != null) {
if (card_mc.index == index) {
return(true);
}
card_mc = card_mc.prev();
}
}
return(false);
}
static function TrexAllowedCards_num(card_mc) {
var _local3 = 0;
var _local1 = card_mc;
if (card_mc.Id >= 11) {
_local1 = _local1.next();
if (_local1 != null) {
_local3 = _local3 + ((_local1.Id - card_mc.Id) - 1);
} else {
_local3 = _local3 + ((15 - card_mc.Id) - 1);
}
}
_local1 = card_mc;
if (card_mc.Id <= 11) {
_local1 = _local1.prev();
if (_local1 != null) {
_local3 = _local3 + ((card_mc.Id - _local1.Id) - 1);
} else {
_local3 = _local3 + (card_mc.Id - 2);
}
if (card_mc.prev() == null) {
_local3 = _local3 + (10 + card_mc.Id);
}
}
return(_local3);
}
static function MakeGame5Prop(prop, _StartNewFour) {
_root.prop_table = _root.prop_table + "\n-------------------------";
StartNewFour = _StartNewFour;
var card_mc;
var cont = ((_root.history.used_cards % 4) != 0);
var i = 1;
while (i <= 13) {
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + i);
prop[i] = ((card_mc.isUsed || (!card_mc._visible)) ? null : 1);
if (cont && (!StartNewFour)) {
if (_root.history.play_type != card_mc.type) {
prop[i] = null;
}
}
if ((prop[i] != null) && (prop[i] != undefined)) {
prop[i] = Card_Eaten_Prop(card_mc);
if (Card_Run_Prop(card_mc) >= 250) {
prop[i] = prop[i] + Card_Eaten_Prop(card_mc, true);
prop[i] = prop[i] * 0.5;
}
if (cont && (!StartNewFour)) {
if (card_mc.Id < _root.history.play_Id) {
prop[i] = 0;
}
}
if (StartNewFour) {
var info_mc = eval (("info" + _root.turn.current) + ".info");
prop[i] = prop[i] - (100 * info_mc.cards[card_mc.type]);
if (prop[i] < 0) {
prop[i] = 0;
}
}
}
if ((prop[i] != null) && (prop[i] != undefined)) {
var players_have_type = 3;
if (!StartNewFour) {
players_have_type = players_have_type - (_root.history.used_cards % 4);
}
_root.prop_table = _root.prop_table + (newline + ((((((((((" Card #" + i) + " -") + card_mc.Id) + "-") + " <-> ") + prop[i]) + "<->Run Prop:") + Card_Run_Prop(card_mc)) + " # of Runs ") + Number_of_Runs(card_mc, players_have_type)));
}
i++;
}
}
static function Card_Eaten_Prop(card_mc, RemoveOnePlayer) {
var _local4 = _root.history.RemainingType(card_mc);
var _local7 = _root.history.SmallerType(card_mc);
var _local3 = 3;
if (!StartNewFour) {
_local3 = _local3 - (_root.history.used_cards % 4);
}
_local3 = _local3 - Number_of_Runs(card_mc, _local3);
var _local5 = 1;
var _local6 = 1;
if (_local4 < _local3) {
_local3 = _local4;
}
if (RemoveOnePlayer && (_local3 > 1)) {
_local3--;
}
var _local2 = 0;
while (_local2 < _local3) {
_local5 = _local5 * (_local7 - _local2);
_local6 = _local6 * (_local4 - _local2);
_local2++;
}
return(int((_local5 / _local6) * 1000));
}
static function Card_Run_Prop(card_mc) {
var _local5 = _root.history.RemainingType(card_mc);
var _local3 = 3;
if (!StartNewFour) {
_local3 = _local3 - (_root.history.used_cards % 4);
}
_local3 = _local3 - Number_of_Runs(card_mc, _local3);
var _local7 = Math.pow(_local3, _local5);
var _local4 = 0;
if (_local5 >= _local3) {
_local4 = _local3;
var _local2 = 0;
while (_local2 < _local5) {
_local4 = _local4 * (_local3 - 1);
_local2++;
}
var _local6 = 1;
_local2 = 2;
while (_local2 < _local3) {
_local6 = _local6 * (_local2 + 1);
_local2++;
}
if (_local6 != 1) {
_local4 = _local4 + _local6;
}
}
return(int((_local4 / _local7) * 1000));
}
static function Number_of_Runs(card_mc, players_have_type) {
var _local4 = 0;
var _local2 = 0;
while (_local2 < players_have_type) {
var _local3 = ((_root.turn.current + _local2) % 4) + 1;
if (_root.history.possibleRunPlayers[_local3][card_mc.type]) {
_local4++;
}
_local2++;
}
return(_local4);
}
static function AddScoreToProp(prop, EatenOnly) {
var card_mc;
var i = 1;
while (i <= 13) {
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + i);
if (((prop[i] != null) && (prop[i] != undefined)) && (CalcScore(card_mc))) {
if (prop[i] || (!EatenOnly)) {
prop[i] = prop[i] + (CalcScore(card_mc) * 10);
prop[i] = prop[i] + (_root.history.Turn_score * 10);
}
}
i++;
}
}
static function RemoveScoreCards(prop) {
var card_mc;
var i = 1;
while (i <= 13) {
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + i);
if ((prop[i] != null) && (prop[i] != undefined)) {
if (CalcScore(card_mc) || (StartNewFour && (CalcScore(card_mc.next())))) {
prop[i] = null;
}
}
i++;
}
}
static function RemoveRunCards(prop) {
var card_mc;
var i = 1;
while (i <= 13) {
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + i);
RemoveAllTypeCards(prop, card_mc);
var players_have_type = (3 - (_root.history.used_cards % 4));
if (((Number_of_Runs(players_have_type || (Card_Run_Prop(card_mc) >= 250)) && (prop[i])) && (prop[i] != null)) && (prop[i] != undefined)) {
prop[i] = null;
}
i++;
}
}
static function RemoveTypeCards(prop, type) {
var card_mc;
var i = 1;
while (i <= 13) {
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + i);
if (((card_mc.type == type) && (prop[i] != null)) && (prop[i] != undefined)) {
prop[i] = null;
}
i++;
}
}
static function RemoveAllTypeCards(prop, card_mc) {
var temp_card_mc;
if (haveAllTypeCards(card_mc)) {
var i = 1;
while (i <= 13) {
temp_card_mc = eval ((("_root.card" + _root.turn.current) + "_") + i);
if (((temp_card_mc.type == card_mc.type) && (prop[i] != null)) && (prop[i] != undefined)) {
prop[i] = null;
}
i++;
}
}
}
static function FindMinTypeNum(bests, player_id) {
var best = (bests.length ? 0 : null);
var Newbests = new Array();
var info_mc = eval (("_root.info" + player_id) + ".info");
var card_mc = eval ((("_root.card" + player_id) + "_") + bests[0]);
var i = 1;
while (i < bests.length) {
var card_mc = eval ((("_root.card" + player_id) + "_") + bests[i]);
var best_mc = eval ((("_root.card" + player_id) + "_") + bests[best]);
if (info_mc.cards[card_mc.type] < info_mc.cards[best_mc.type]) {
best = i;
}
i++;
}
var i = 0;
while (i < bests.length) {
var card_mc = eval ((("_root.card" + player_id) + "_") + bests[i]);
var best_mc = eval ((("_root.card" + player_id) + "_") + bests[best]);
if (info_mc.cards[card_mc.type] == info_mc.cards[best_mc.type]) {
var accepted = true;
var j = 0;
while (j < Newbests.length) {
var temp_card_mc = eval ((("_root.card" + player_id) + "_") + bests[Newbests[j]]);
if (card_mc.type == temp_card_mc.type) {
Newbests[j] = ((card_mc.Id > temp_card_mc.Id) ? (i) : (Newbests[j]));
accepted = false;
break;
}
j++;
}
if (accepted) {
Newbests.push(i);
}
}
i++;
}
if (Newbests.length != 0) {
return(Newbests[random(Newbests.length)]);
}
return(best);
}
static function FindMin(prop, bests) {
var _local2 = 0;
var _local3 = 0;
while (_local3 < prop.length) {
if ((prop[_local3] != null) && (prop[_local3] != undefined)) {
if (_local2 == 0) {
_local2 = _local3;
} else if (prop[_local3] < prop[_local2]) {
_local2 = _local3;
}
}
_local3++;
}
_local3 = 0;
while (_local3 < prop.length) {
if ((prop[_local3] == prop[_local2]) && (_local2)) {
bests.push(_local3);
}
_local3++;
}
}
static function FindMax(prop, bests) {
var _local1 = 0;
var _local3 = 1;
while (_local3 <= 13) {
if ((prop[_local3] != null) && (prop[_local3] != undefined)) {
if (_local1 == 0) {
_local1 = _local3;
} else if (prop[_local3] > prop[_local1]) {
_local1 = _local3;
}
}
_local3++;
}
_local3 = 1;
while (_local3 <= 13) {
if ((prop[_local3] == prop[_local1]) && (_local1)) {
bests.push(_local3);
}
_local3++;
}
}
static function FindMaxRange(prop, bests, range) {
var _local3 = 0;
var _local2 = 1;
while (_local2 <= 13) {
if ((prop[_local2] != null) && (prop[_local2] != undefined)) {
if (_local3 == 0) {
_local3 = _local2;
} else if (prop[_local2] > prop[_local3]) {
_local3 = _local2;
}
}
_local2++;
}
_local2 = 1;
while (_local2 <= 13) {
if (((((prop[_local2] + range) >= prop[_local3]) && (prop[_local2] != null)) && (prop[_local2] != undefined)) && (_local3)) {
bests.push(_local2);
}
_local2++;
}
}
static function CalcScore(card_mc) {
var _local6 = 0;
var _local4 = 0;
var _local5 = 0;
var _local3 = 0;
if (((card_mc.type == 2) && (_root.currentGames[4])) && (_root.history.stillDiamonds())) {
_local6++;
}
if (((card_mc.Id >= 12) && (_root.currentGames[3])) && (_root.history.stillQueens())) {
if (card_mc.Id == 12) {
_local4++;
} else if ((_root.history.used_cards % 4) != 3) {
_local4 = _local4 + 0.5;
}
}
if ((((card_mc.type == 4) && (card_mc.Id >= 13)) && (_root.currentGames[2])) && (_root.history.stillKing())) {
if (card_mc.Id == 13) {
_local5++;
} else if ((_root.history.used_cards % 4) != 3) {
_local5 = _local5 + 0.5;
}
}
_local3 = _local3 + (_local5 * 75);
_local3 = _local3 + (_local4 * 25);
_local3 = _local3 + (_local6 * 40);
return(_local3);
}
static function haveKing() {
var card_mc;
var i = 1;
while (i <= 13) {
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + i);
if ((!card_mc.isUsed) && (card_mc._visible)) {
if ((card_mc.type == 4) && (card_mc.Id == 13)) {
return(true);
}
}
i++;
}
return(false);
}
static function GetQueens() {
var card_mc;
var queens = new Array();
var i = 1;
while (i <= 13) {
card_mc = eval ((("_root.card" + _root.turn.current) + "_") + i);
if ((!card_mc.isUsed) && (card_mc._visible)) {
if (card_mc.Id == 12) {
queens.push(card_mc.type);
}
}
i++;
}
return(queens);
}
static function CopyArray(x, y) {
var _local1 = 0;
while (_local1 < x.length) {
y[_local1] = x[_local1];
_local1++;
}
}
static function haveAllTypeCards(card_mc) {
return(_root.history.RemainingType(card_mc) == 0);
}
static var random_names = new Array("Firas", "Abdo", "Boss", "Abdullah", "Soso", "Rami");
}
Symbol 328 MovieClip [__Packages.Move] Frame 0
class Move
{
var move_mc, time, Periodic, Moving, Frames, new_x, new_y, old_x, old_y, Delay, speedx, speedy, interval, passed_Frames, DelayPassed, Delayinterval;
function Move (mc, x, y, _Frames, _delay) {
move_mc = mc;
time = new Timer();
to(x, y, _Frames, _delay);
Periodic = int(10000 / FPS) / 10;
}
function to(x, y, _Frames, _delay) {
Moving = false;
Frames = _Frames;
new_x = x;
new_y = y;
old_x = move_mc._x;
old_y = move_mc._y;
Delay = _delay;
speedx = int(((new_x - old_x) / Frames) * 1000) / 1000;
speedy = int(((new_y - old_y) / Frames) * 1000) / 1000;
}
function start() {
interval = setInterval(this, "moveTo", Periodic);
passed_Frames = 0;
Moving = true;
DelayPassed = (Delay ? false : true);
if (!DelayPassed) {
move_mc._visible = false;
Delayinterval = setInterval(this, "MakeDelay", Delay);
}
time.restart();
}
function MakeDelay() {
clearInterval(Delayinterval);
DelayPassed = true;
itime = time.duration;
move_mc._visible = true;
_root.RollOverSound_mc.start();
}
function stop() {
clearInterval(interval);
Moving = false;
}
function moveTo() {
if (Moving && (DelayPassed)) {
var _local2 = int((100 * (time.__get__duration() - itime)) / Periodic) / 100;
if (passed_Frames) {
passed_Frames = passed_Frames + _local2;
} else {
passed_Frames = 2;
}
if (passed_Frames > Frames) {
clearInterval(interval);
move_mc._x = new_x;
move_mc._y = new_y;
Moving = false;
} else {
move_mc._x = old_x + (speedx * passed_Frames);
move_mc._y = old_y + (speedy * passed_Frames);
itime = time.duration;
}
}
}
static var FPS = 48;
var itime = 0;
}
Symbol 329 MovieClip [__Packages.Timer] Frame 0
class Timer
{
var time;
function Timer () {
time = new Date();
}
function restart() {
time = new Date();
}
function get duration() {
var _local2 = time;
time = new Date();
var _local3 = time.valueOf() - _local2.valueOf();
time = _local2;
return(_local3);
}
}
Symbol 330 MovieClip [__Packages.SoundLoader] Frame 0
class SoundLoader
{
var url, sound_mc;
function SoundLoader (mc, url_dir) {
url = url_dir;
sound_mc = mc;
}
function start() {
loadMovie (url, sound_mc);
}
function stop() {
unloadMovie (sound_mc);
}
}
Symbol 331 MovieClip [__Packages.King] Frame 0
class King
{
var _current;
function King () {
_current = 1;
}
function set current(param_score) {
var king_mc = eval ("_root.king" + _current);
king_mc._visible = false;
_current = param_score;
if (_current > 4) {
_current = 1;
}
var king_mc = eval ("_root.king" + _current);
king_mc._visible = true;
//return(current);
}
function get current() {
return(_current);
}
function next() {
current = ((current+1));
}
}
Symbol 332 MovieClip [__Packages.QuickSort] Frame 0
class QuickSort
{
static var Card, ASC;
function QuickSort () {
}
static function calc(A, i) {
if (Card) {
var mc = eval ((("_root.card" + A) + "_") + i);
if (mc.num == 1) {
return((mc.type * 100) - 14);
}
return((mc.type * 100) - mc.num);
}
return(A[i]);
}
static function exchange(A, x, y) {
if (Card) {
var mc1 = eval ((("_root.card" + A) + "_") + x);
var mc2 = eval ((("_root.card" + A) + "_") + y);
var tempType = mc1.type;
var tempNum = mc1.num;
mc1.type = mc2.type;
mc1.num = mc2.num;
mc2.type = tempType;
mc2.num = tempNum;
} else {
var temp = A[x];
A[x] = A[y];
A[y] = temp;
}
}
static function sort(A, p, r, isCard, _ASC) {
Card = isCard;
ASC = _ASC;
if (p < r) {
var _local1 = Partition(A, p, r);
In_sort(A, p, _local1 - 1);
In_sort(A, _local1 + 1, r);
}
}
static function In_sort(A, p, r) {
if (p < r) {
var _local1 = Partition(A, p, r);
In_sort(A, p, _local1 - 1);
In_sort(A, _local1 + 1, r);
}
}
static function Partition(A, p, r) {
var _local4 = calc(A, r);
var _local2 = p - 1;
var _local1 = p;
while (_local1 <= (r - 1)) {
if (!ASC) {
if (calc(A, _local1) <= _local4) {
_local2++;
exchange(A, _local2, _local1);
}
} else if (calc(A, _local1) >= _local4) {
_local2++;
exchange(A, _local2, _local1);
}
_local1++;
}
exchange(A, _local2 + 1, r);
return(_local2 + 1);
}
}
Symbol 333 MovieClip [__Packages.History] Frame 0
class History
{
var possibleTrexCards, possibleRunPlayers, names, lastFour, king_cards, kings_order, newFour, Score_cards, scores, _used_cards, viewLastFour, play_type, play_Id, Bigger, trex_score, Turn_score;
function History () {
possibleTrexCards = new Array(5);
possibleRunPlayers = new Array(5);
names = new Array();
lastFour = new Array(5);
king_cards = new Array();
kings_order = new Array();
newFour = new Array();
Score_cards = new Array();
scores = new Array(5);
var _local2 = 1;
while (_local2 <= 5) {
scores[_local2] = new Array(20);
_local2++;
}
}
function get games_played() {
var _local2 = 0;
for (var _local3 in king_cards[king_cards.length - 1].games) {
if (_local3) {
_local2++;
}
}
return(_local2);
}
function get kings_played() {
var _local2 = 0;
for (var _local3 in king_cards) {
if (_local3) {
_local2++;
}
}
if (_local2) {
_local2--;
}
return(_local2);
}
function get used_cards() {
return(_used_cards);
}
function set used_cards(param_score) {
_used_cards = param_score;
//return(used_cards);
}
function reset() {
_root.watcher = "";
var _local3 = 1;
while (_local3 <= 4) {
possibleTrexCards[_local3] = new Array(11, 11);
possibleRunPlayers[_local3] = new Array(0, 0, 0, 0, 0);
_local3++;
}
while (lastFour.length) {
lastFour.pop();
}
while (Score_cards.length) {
_root.remove_score_card_preview(Score_cards.pop());
}
viewLastFour = false;
play_type = (play_Id = (Bigger = 0));
used_cards = (0);
trex_score = 200;
Turn_score = 0;
}
function AddKing() {
king_cards.push(new King_cards(names[_root.king.current].name));
kings_order.push(_root.king.current);
}
function AddGame(name) {
king_cards[king_cards.length - 1].games.push(new Game_cards(name));
_root.watcher = _root.watcher + (newline + ((((("games_played: " + games_played) + " ,kings_played: (") + kings_order) + ") ") + kings_played));
_root.GamesPlayed = ((((kings_order.length * 5) - 5) + games_played) + "/") + 20;
}
function addScore_cards(currentGame) {
if (currentGame == 2) {
Score_cards.push(new Card(4, 13, Score_cards.length));
}
if (currentGame == 3) {
var _local3 = 1;
while (_local3 <= 4) {
Score_cards.push(new Card(_local3, 12, Score_cards.length));
_local3++;
}
}
if (currentGame == 4) {
Score_cards.push(new Card(2, 1, Score_cards.length));
var _local3 = 13;
while (_local3 >= 2) {
Score_cards.push(new Card(2, _local3, Score_cards.length));
_local3--;
}
}
_root.score_cards_num = Score_cards.length;
}
function ThereScore_cards() {
if ((_root.currentGames[1] || (_root.currentGames[5])) || (Score_cards.length)) {
return(true);
}
return(false);
}
function removeScoreCard(card_mc) {
var _local5 = -1;
var _local3 = 0;
while (_local3 < Score_cards.length) {
if ((Score_cards[_local3].type == card_mc.type) && (card_mc.num == Score_cards[_local3].num)) {
_root.remove_score_card_preview(Score_cards[_local3]);
_local5 = _local3;
var _local4 = new Array();
_local3 = 0;
while (_local3 < Score_cards.length) {
if (_local3 != _local5) {
_local4.push(Score_cards[_local3]);
}
_local3++;
}
while (Score_cards.length) {
Score_cards.pop();
}
Score_cards = _local4;
_root.score_cards_num = Score_cards.length;
break;
}
_local3++;
}
if (_local5 == -1) {
trace("Error : " + Score_cards);
}
}
function stillKing() {
var _local2 = 0;
while (_local2 < Score_cards.length) {
if ((Score_cards[_local2].type == 4) && (Score_cards[_local2].num == 13)) {
return(true);
}
_local2++;
}
return(false);
}
function stillQueens() {
var _local2 = 0;
while (_local2 < Score_cards.length) {
if (Score_cards[_local2].num == 12) {
return(true);
}
_local2++;
}
return(false);
}
function stillDiamonds() {
var _local2 = 0;
while (_local2 < Score_cards.length) {
if (Score_cards[_local2].type == 2) {
return(true);
}
_local2++;
}
return(false);
}
function RemainingType(card_mc) {
var info_mc = eval (("info" + card_mc.owner) + ".info");
var remaining = ((13 - info_mc.cards[card_mc.type]) - used_cards_Type(card_mc.type));
return(remaining);
}
function used_cards_Type(type) {
var _local4 = 0;
var _local6 = king_cards.length - 1;
var _local7 = king_cards[_local6].games.length - 1;
var _local3 = king_cards[_local6].games[_local7].cards;
var _local2 = 0;
while (_local2 < _local3.length) {
if (_local3[_local2].type == type) {
_local4++;
}
_local2++;
}
return(_local4);
}
function SmallerType(card_mc) {
var Smaller = new Array();
var i = 2;
while (i <= card_mc.Id) {
Smaller[i] = 1;
i++;
}
var last_king = (king_cards.length - 1);
var last_game = (king_cards[last_king].games.length - 1);
var Cards = king_cards[last_king].games[last_game].cards;
var i = 0;
while (i <= Cards.length) {
if ((Cards[i].type == card_mc.type) && (Cards[i].Id < card_mc.Id)) {
Smaller[Cards[i].Id] = 0;
}
i++;
}
var i = 1;
while (i <= 13) {
var temp_card_mc = eval ((("_root.card" + card_mc.owner) + "_") + i);
if (temp_card_mc.type == card_mc.type) {
Smaller[temp_card_mc.Id] = 0;
}
i++;
}
var i = 3;
while (i <= card_mc.Id) {
Smaller[2] = Smaller[2] + Smaller[i];
i++;
}
return(Smaller[2]);
}
function addCard(card_mc) {
var _local2 = king_cards.length - 1;
var _local3 = king_cards[_local2].games.length - 1;
king_cards[_local2].games[_local3].cards.push(card_mc);
}
}
Symbol 334 MovieClip [__Packages.King_cards] Frame 0
class King_cards
{
var name, games;
function King_cards (n) {
name = n;
games = new Array();
}
function toString() {
trace(name);
trace("-------");
}
}
Symbol 335 MovieClip [__Packages.Game_cards] Frame 0
class Game_cards
{
var name, cards, scores;
function Game_cards (n) {
name = n;
cards = new Array();
scores = new Array("-", "-", "-", "-", "-");
}
function toString() {
trace(name);
trace("-------");
trace(scores);
}
}
Symbol 336 MovieClip [__Packages.Card] Frame 0
class Card
{
var Position, type, num, Id;
function Card (x, y, _pos) {
Position = _pos;
type = x;
num = y;
Id = ((num == 1) ? 14 : (num));
}
function toString() {
trace((((((" ( " + type) + " - ") + num) + "<>") + Id) + " ) ");
trace("-------");
}
}
Symbol 133 MovieClip Frame 2
if (random(100) > 2) {
gotoAndPlay (1);
}
Symbol 137 Button
on (rollOver) {
if (!Toggle) {
gotoAndStop (3);
}
}
on (rollOut, releaseOutside) {
gotoAndStop(1 + Toggle);
}
on (release) {
if (!Toggle) {
Toggle = !Toggle;
}
}
on (press) {
if (!Toggle) {
gotoAndStop (4);
}
}
Symbol 147 MovieClip Frame 1
function ToggleEvent(newVal) {
gotoAndStop(1 + newVal);
if (newVal) {
_global.ToggleButtons.Toggle = false;
_global.ToggleButtons = this;
_parent.open(Id);
}
}
stop();
var Toggle_update = function (prop, oldVal, newVal) {
ToggleEvent(newVal);
return(newVal);
};
this.watch("Toggle", Toggle_update);
ToggleEvent(Toggle);
Symbol 154 MovieClip Frame 1
function scrollUp_btn_pressing() {
ReadMe_txt.scroll--;
update_Status();
}
function scrollDown_btn_pressing() {
ReadMe_txt.scroll++;
update_Status();
}
function update(GoMax) {
if (GoMax) {
ReadMe_txt.scroll = ReadMe_txt.maxscroll;
}
update_Status();
}
function update_Status() {
_root.Status = (ReadMe_txt.scroll + " of ") + ReadMe_txt.maxscroll;
}
Instance of Symbol 3 MovieClip [pressing trigger] in Symbol 154 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
command = "scrollUp_btn_pressing";
target_button = "scrollUp_btn";
}
Instance of Symbol 3 MovieClip [pressing trigger] in Symbol 154 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
command = "scrollDown_btn_pressing";
target_button = "scrollDown_btn";
}
Symbol 182 MovieClip Frame 1
function open(Id) {
page = Id;
gotoAndStop(Id);
}
Instance of Symbol 123 MovieClip "HighScore7" in Symbol 182 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
Preview = 7;
}
Instance of Symbol 123 MovieClip "HighScore6" in Symbol 182 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
Preview = 6;
}
Instance of Symbol 123 MovieClip "HighScore5" in Symbol 182 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
Preview = 5;
}
Instance of Symbol 123 MovieClip "HighScore4" in Symbol 182 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
Preview = 4;
}
Instance of Symbol 123 MovieClip "HighScore3" in Symbol 182 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
Preview = 3;
}
Instance of Symbol 123 MovieClip "HighScore8" in Symbol 182 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
Preview = 8;
}
Instance of Symbol 123 MovieClip "HighScore9" in Symbol 182 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
Preview = 9;
}
Instance of Symbol 147 MovieClip in Symbol 182 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
Toggle = true;
label = "HighScores";
Id = 1;
}
Instance of Symbol 147 MovieClip in Symbol 182 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
Toggle = false;
label = "Help";
Id = 2;
}
Instance of Symbol 147 MovieClip in Symbol 182 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
Toggle = false;
label = "AboutMe";
Id = 4;
}
Symbol 182 MovieClip Frame 2
ReadMeText.ReadMe_txt.htmlText = readme_txt.htmlText;
ReadMeText.update();
play();
Symbol 182 MovieClip Frame 3
stop();
Symbol 185 MovieClip Frame 15
stop();
Symbol 202 MovieClip Frame 1
stop();
Symbol 215 MovieClip Frame 1
stop();
Symbol 216 MovieClip Frame 1
function open() {
_root.Selection_card = _parent;
}
function close() {
gotoAndStop (1);
}
stop();
Symbol 219 MovieClip Frame 1
function init() {
move = new Move(this);
isRoll = (Edge = false);
timer = new Timer();
isUsed = false;
_visible = true;
RollOver_mc.gotoAndStop(1);
card.card_type_left.textColor = 0;
card.card_type_right.textColor = 0;
open();
}
function prev() {
var card_mc;
var best = null;
var i = 1;
while (i <= 13) {
card_mc = eval ((("_root.card" + owner) + "_") + i);
if (card_mc.type == type) {
if (card_mc.Id < Id) {
best = card_mc;
if (_root.Direction == 1) {
break;
}
}
}
i++;
}
return(best);
}
function next() {
var card_mc;
var best = null;
var i = 1;
while (i <= 13) {
card_mc = eval ((("_root.card" + owner) + "_") + i);
if (card_mc.type == type) {
if (card_mc.Id > Id) {
best = card_mc;
if (_root.Direction != 1) {
break;
}
}
}
i++;
}
return(best);
}
function open() {
isOpen = true;
gotoAndStop (1);
useHandCursor = true;
Id = ((num == 1) ? 14 : (num));
card._visible = true;
refresh();
}
function close() {
isOpen = false;
useHandCursor = false;
Id = ((num == 1) ? 14 : (num));
gotoAndStop (2);
card._visible = false;
refresh();
}
function refresh() {
_alpha = 100;
enabled = !isUsed;
card.gotoAndStop(num);
var i = 1;
while (i <= 14) {
var mc = eval ("card.card_type" + i);
mc.gotoAndStop(type);
i++;
}
card.Type = type;
if (num == 11) {
card.cf = "J";
} else if (num == 12) {
card.cf = "Q";
} else if (num == 13) {
card.cf = "K";
} else if (num == 1) {
card.cf = "A";
} else {
card.cf = num;
}
if ((type == 2) || (type == 4)) {
card.card_type_left.textColor = 16711680 /* 0xFF0000 */;
card.card_type_right.textColor = 16711680 /* 0xFF0000 */;
} else {
card.card_type_left.textColor = 0;
card.card_type_right.textColor = 0;
}
}
function check_edge() {
if ((isRoll && (_root.turn.current == owner)) && (!isUsed)) {
if ((_ymouse > 40) && (!Edge)) {
Edge = true;
if ((!_rotation) || (_rotation == -180)) {
Sign = ((_y > (Stage.height / 2)) ? 1 : -1);
_y = (_y + (shifting * Sign));
} else {
Sign = ((_x > (Stage.width / 2)) ? 1 : -1);
_x = (_x + (shifting * Sign));
}
}
if ((_ymouse < 20) && (Edge)) {
Edge = false;
if ((!_rotation) || (_rotation == -180)) {
Sign = ((_y > (Stage.height / 2)) ? -1 : 1);
_y = (_y + (shifting * Sign));
} else {
Sign = ((_x > (Stage.width / 2)) ? 1 : -1);
_x = (_x + (shifting * Sign));
}
}
}
}
if (!shifting) {
var Area;
var timer;
var isUsed;
var isOpen;
var Sign;
var taken;
var Id;
var move;
var Edge;
var isRoll;
shifting = 5;
_alpha = 0;
}
onRollOver = function () {
if ((!isUsed) && (!move.Moving)) {
isRoll = true;
check_edge();
if (_root.history.names[_root.turn.current].human) {
_root.RollOverSound_mc.start();
}
if ((!_rotation) || (_rotation == -180)) {
Sign = ((_y > (Stage.height / 2)) ? 1 : -1);
_y = (_y - (shifting * Sign));
} else {
Sign = ((_x > (Stage.width / 2)) ? 1 : -1);
_x = (_x - (shifting * Sign));
}
}
};
onRollOut = function () {
if ((!isUsed) && (isRoll)) {
isRoll = false;
RollOver_mc.gotoAndStop(1);
if (!Edge) {
if ((!_rotation) || (_rotation == -180)) {
Sign = ((_y > (Stage.height / 2)) ? 1 : -1);
_y = (_y + (shifting * Sign));
} else {
Sign = ((_x > (Stage.width / 2)) ? 1 : -1);
_x = (_x + (shifting * Sign));
}
}
Edge = false;
}
};
onPress = function () {
if (_root.currentGames[1]) {
Area = eval (("_root.Areas.Area" + type) + ".hotArea");
} else {
Area = eval (("_root.Areas.Area" + owner) + ".hotArea");
}
var myPoint = {x:Area._parent._x, y:Area._parent._y};
_root.Areas.localToGlobal(myPoint);
new_x = myPoint.x;
new_y = myPoint.y;
if (!_visible) {
throw new Error(((((("Error : AI trying to use used Card! (" + owner) + ":") + type) + ",") + Id) + ")");
} else if ((_root.turn.current == owner) && (!isUsed)) {
timer.restart();
old_x = _x;
old_y = _y;
this.startDrag();
isDrag = true;
isMove = false;
}
};
onReleaseOutside = function () {
if (_root.turn.current == owner) {
onRelease();
}
onRollOut();
};
onRelease = function () {
_root.play_card(this);
stopDrag();
isDrag = false;
};
onMouseMove = function () {
if (RollOver_mc._currentframe == 2) {
check_edge();
}
if (isDrag) {
isMove = true;
if (!Area.isUsed) {
if (eval (_droptarget) == Area) {
Area.open();
} else {
Area.close();
}
}
}
};
Symbol 233 MovieClip Frame 1
stop();
function open() {
gotoAndStop (2);
}
function close() {
gotoAndStop (1);
}
Symbol 233 MovieClip Frame 2
stop();
Symbol 240 MovieClip Frame 1
function open(x) {
pos = x;
gotoAndPlay (2);
}
stop();
Symbol 248 MovieClip Frame 1
stop();
Symbol 249 MovieClip Frame 1
function change(x, PlayerScore, NextScore) {
if (rank != x) {
rank = x;
if ((rank == 1) && (PlayerScore != NextScore)) {
rank_bg.gotoAndStop(2);
} else {
rank_bg.gotoAndStop(1);
}
gotoAndPlay (2);
} else if ((rank == 1) && (PlayerScore != NextScore)) {
rank_bg.gotoAndStop(2);
}
}
Symbol 249 MovieClip Frame 26
stop();
Symbol 250 MovieClip Frame 1
var cards;
cards_str = "";
Symbol 265 MovieClip Frame 1
stop();
Symbol 276 Button
on (press) {
if (history.lastFour.length) {
var i = 1;
while (i <= 4) {
Area = eval ("Areas.Area" + i);
Area.hotArea.card._visible = false;
history.lastFour[i]._visible = true;
history.newFour[i] = history.lastFour[i];
i++;
}
history.viewLastFour = true;
_root.Stop_game_Preview = true;
}
}
on (release, releaseOutside) {
_root.Stop_game_Preview = false;
if (history.viewLastFour && (history.used_cards)) {
var i = 1;
while (i <= 4) {
Area = eval ("Areas.Area" + i);
Area.hotArea.card._visible = true;
history.newFour[i]._visible = false;
i++;
}
}
}
Symbol 287 MovieClip Frame 1
card_type.gotoAndStop(Type);
Symbol 288 MovieClip Frame 1
function open() {
if (_currentframe == 1) {
gotoAndPlay (2);
}
}
function close() {
gotoAndStop (1);
}
function update() {
if (true || (_currentframe == _totalframes)) {
SpadeNum.card_type.Messege = 13 - _root.history.used_cards_Type(1);
ClubNum.card_type.Messege = 13 - _root.history.used_cards_Type(3);
DiamondNum.card_type.Messege = 13 - _root.history.used_cards_Type(2);
HeartsNum.card_type.Messege = 13 - _root.history.used_cards_Type(4);
}
}
close();
Instance of Symbol 287 MovieClip in Symbol 288 MovieClip Frame 9
//component parameters
onClipEvent (construct) {
Type = 1;
Messege = "";
}
Instance of Symbol 287 MovieClip "SpadeNum" in Symbol 288 MovieClip Frame 9
//component parameters
onClipEvent (construct) {
Type = 5;
Messege = "5";
}
Instance of Symbol 287 MovieClip "ClubNum" in Symbol 288 MovieClip Frame 9
//component parameters
onClipEvent (construct) {
Type = 5;
Messege = "3";
}
Instance of Symbol 287 MovieClip in Symbol 288 MovieClip Frame 9
//component parameters
onClipEvent (construct) {
Type = 3;
Messege = "";
}
Instance of Symbol 287 MovieClip in Symbol 288 MovieClip Frame 9
//component parameters
onClipEvent (construct) {
Type = 4;
Messege = "";
}
Instance of Symbol 287 MovieClip "HeartsNum" in Symbol 288 MovieClip Frame 9
//component parameters
onClipEvent (construct) {
Type = 5;
Messege = "1";
}
Instance of Symbol 287 MovieClip in Symbol 288 MovieClip Frame 9
//component parameters
onClipEvent (construct) {
Type = 2;
Messege = "";
}
Instance of Symbol 287 MovieClip "DiamondNum" in Symbol 288 MovieClip Frame 9
//component parameters
onClipEvent (construct) {
Type = 5;
Messege = "6";
}
Symbol 288 MovieClip Frame 10
stop();
update();
Symbol 289 Button
on (press) {
_root.Stop_game_Preview = true;
if (messegeBox._currentframe == 1) {
messegeBox.open();
}
}
on (release, releaseOutside) {
_root.Stop_game_Preview = false;
messegeBox.close();
}
Symbol 292 MovieClip Frame 1
function open() {
isOpen = true;
gotoAndPlay (2);
}
function close() {
isOpen = false;
gotoAndStop (1);
}
close();
Symbol 292 MovieClip Frame 40
gotoAndPlay (2);
Symbol 297 MovieClip Frame 1
function Areas1() {
if ((Areas_id != 1) || (interval)) {
reverse();
}
}
function Areas2() {
if ((Areas_id != 2) || (interval)) {
forward();
}
}
function reverse() {
_root.Stop_game = true;
clearInterval(interval);
var _local3 = 10;
if (_root.speedy_mode) {
_local3 = int(_local3 / 2);
} else if (_root.NO_Time_Mode) {
_local3 = 0;
}
interval = setInterval(this, "prev", _local3);
}
function prev() {
if (_currentframe == 1) {
Areas_id = 1;
clearInterval(interval);
_root.Stop_game = false;
} else {
gotoAndStop(_currentframe - 1);
}
}
function forward() {
_root.Stop_game = true;
clearInterval(interval);
var _local3 = 10;
if (_root.speedy_mode) {
_local3 = int(_local3 / 2);
} else if (_root.NO_Time_Mode) {
_local3 = 0;
}
interval = setInterval(this, "next", _local3);
}
function next() {
if (_currentframe == _totalframes) {
Areas_id = 2;
clearInterval(interval);
_root.Stop_game = false;
} else {
gotoAndStop(_currentframe + 1);
}
}
var Areas_id;
var interval;
var counter = 0;
stop();
Symbol 302 MovieClip Frame 1
winner = _parent.winner;
gotoAndStop(random(4) + 2);
Instance of Symbol 219 MovieClip "winner_card" in Symbol 303 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
type = 4;
num = 13;
isUsed = false;
}
Symbol 303 MovieClip Frame 2
stop();
winner_card.type = random(4) + 1;
winner_card.num = random(13) + 1;
winner_card.isUsed = true;
winner_card.enabled = false;
winner_card.open();
Instance of Symbol 219 MovieClip "card" in Symbol 304 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
type = 4;
num = 13;
isUsed = false;
}
Symbol 304 MovieClip Frame 2
stop();
if (_type) {
card.type = _type;
}
if (_num) {
card.num = _num;
}
card.isUsed = true;
card.open();
Symbol 320 MovieClip Frame 1
stop();
Symbol 322 MovieClip Frame 1
function wait() {
var _local2 = 40;
if (_root.speedy_mode) {
_local2 = int(_local2 / 2);
} else if (_root.NO_Time_Mode) {
_local2 = 0;
}
clearInterval(interval_Timer);
interval_Timer = setInterval(_root.HighScoreTable, "start_playing", _local2);
_root.Stop_game_Score = true;
}
function start_playing() {
if (_currentframe == _totalframes) {
clearInterval(interval_Timer);
interval_Timer = 0;
} else {
gotoAndStop(_currentframe + 1);
}
}
function start_revesing() {
if (_currentframe == 1) {
clearInterval(interval_Timer);
_root.Stop_game_Score = false;
interval_Timer = 0;
}
if (footer.roll) {
clearInterval(interval_Timer);
Glow(true);
isRollOver = true;
} else {
if (line20) {
var i = 0;
while (i <= 20) {
removeMovieClip("line" + i);
i++;
}
}
gotoAndStop(_currentframe - 1);
}
}
function Glow(bool) {
if (bool) {
myFilters.push(GlowColor);
filters = myFilters;
} else {
myFilters.pop();
filters = myFilters;
}
}
stop();
btn.useHandCursor = false;
var interval_Timer;
btn.onRollOver = function () {
if (!isRollOver) {
Glow(true);
}
isRollOver = true;
if (_currentframe != _totalframes) {
clearInterval(interval_Timer);
var _local2 = ((_currentframe == 1) ? 500 : 0);
interval_Timer = setInterval(_root.HighScoreTable, "wait", _local2);
}
};
btn.onReleaseOutside = (btn.onRollOut = function () {
if (isRollOver) {
Glow(false);
}
isRollOver = false;
if ((!KeepOpen) && (!_root.isWin)) {
clearInterval(interval_Timer);
var _local2 = 20;
if (_root.speedy_mode) {
_local2 = int(_local2 / 2);
} else if (_root.NO_Time_Mode) {
_local2 = 0;
}
interval_Timer = setInterval(_root.HighScoreTable, "start_revesing", _local2);
_root.Stop_game_Score = true;
}
});
Symbol 322 MovieClip Frame 9
function clear() {
var _local3 = 1;
while (_local3 <= 20) {
var _local2 = 1;
while (_local2 <= 4) {
this[((("line" + _local3) + ".score") + _local2) + ".label"] = "";
_local2++;
}
this[(("line" + _local3) + ".game") + ".label"] = "";
_local3++;
}
}
function viewScores() {
clear();
var _local6 = 1;
var _local5 = 0;
while (_local5 < _root.history.king_cards.length) {
var _local4 = 0;
while (_local4 < _root.history.king_cards[_local5].games.length) {
var _local3 = 1;
while (_local3 <= 4) {
this[((("line" + _local6) + ".score") + _local3) + ".label"] = _root.history.king_cards[_local5].games[_local4].scores[_local3];
_local3++;
}
this[(("line" + _local6) + ".game") + ".label"] = _root.history.king_cards[_local5].games[_local4].name;
_local6++;
_local4++;
}
_local5++;
}
}
stop();
duplicateMovieClip ("names_line", "line0", _root.depth++);
var i = 0;
while (i < 20) {
duplicateMovieClip ("scores_line", "line" + (i + 1), _root.depth++);
mc = eval ("line" + (i + 1));
mc._y = mc._y + (i * 24.5);
i++;
}
var i = 1;
while (i <= 4) {
this[("line0.name" + i) + ".label"] = eval ("_root.info" + i).info.name;
i++;
}
viewScores();
names_line._visible = (scores_line._visible = false);