Created
November 20, 2012 21:33
-
-
Save hayley/4121320 to your computer and use it in GitHub Desktop.
paranoid much?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function TextObject(name, x, y, w, h) { | |
this.x = x; | |
this.y = y; | |
this.name = name; | |
this.div = document.createElement(name); | |
this.div.style.zIndex = topz++; | |
this.div.style.border = "none"; | |
this.div.style.width = cwidth + "px"; | |
this.div.style.height = cheight + "px"; | |
this.div.style.font = ".75em Arial"; | |
this.div.style.color = "#003300"; | |
this.div.style.position = "absolute"; | |
document.getElementById("gd").appendChild(this.div); | |
texts.push(this); | |
this.setLoc = function () { | |
this.div.style.left = (this.x * swidth + tableLeft) + "px"; | |
this.div.style.top = (this.y * sheight + tableTop) + "px" | |
}; | |
this.setText = function (text) { | |
this.div.innerHTML = text | |
}; | |
this.getText = function () { | |
return this.div.innerHTML | |
}; | |
this.setWidth = function (w) { | |
this.div.style.width = w + "px" | |
}; | |
this.setLoc() | |
}; | |
function StackObject(type, name, x, y, xoff, yoff, bottom, build, linked) { | |
this.cards = new Array(); | |
this.cardOffsetX = xoff; | |
this.cardOffsetY = yoff; | |
this.origX = x; | |
this.origY = y; | |
this.x = x * swidth + tableLeft; | |
this.y = y * sheight + tableTop; | |
this.type = type; | |
this.build = build; | |
this.linked = linked; | |
this.name = name; | |
this.bottom = bottom; | |
this.foundVal = null; | |
this.addCard = function (cardval, facing) { | |
var card = new CardObject(this, cardval, facing); | |
this.cards.push(card); | |
if (!setUpGameFlag) { | |
this.setPos(this.x, this.y, false) | |
} | |
return card | |
}; | |
this.topCard = function () { | |
if (this.cards.length == 0) return null; | |
return this.cards[this.cards.length - 1].cardInfo | |
}; | |
this.bottomCard = function () { | |
if ((this.bottom != "") && (this.cards.length > 1)) { | |
return this.cards[1].cardInfo | |
} else { | |
return this.cards[0].cardInfo | |
} | |
}; | |
this.setPos = function (x, y, animate) { | |
var xx = x; | |
var yy = y; | |
for (var i = 0; i < this.cards.length; i++) { | |
if (this.build == "special") { | |
xx = Math.floor(x + specialPositions[i][0] * cwidth); | |
yy = Math.floor(y + specialPositions[i][1] * cheight) | |
} | |
this.cards[i].animStop(); | |
this.cards[i].setLoc(xx, yy, animate); | |
var xtightness = tightness; | |
if (xtightness > 1) xtightness = 1; | |
if (this.cards[i].val == "blank") {} else if (this.cards[i].val == "turnover") { | |
this.cards[i].showCard() | |
} else if (this.cards[i].facing == 0) { | |
xx += Math.floor(this.cardOffsetX * cwidth * .5 * xtightness); | |
yy += Math.floor(this.cardOffsetY * cheight * .5 * tightness) | |
} else { | |
xx += Math.floor(this.cardOffsetX * cwidth * xtightness); | |
yy += Math.floor(this.cardOffsetY * cheight * tightness) | |
} | |
} | |
}; | |
this.redraw = function (animate) { | |
this.setPos(this.x, this.y, animate) | |
}; | |
this.resetPos = function () { | |
this.x = this.origX * swidth + tableLeft; | |
this.y = this.origY * sheight + tableTop; | |
this.redraw(false); | |
for (var i = 0; i < cards.length; i++) { | |
cards[i].resetSize(); | |
cards[i].showCard() | |
} | |
}; | |
this.highlight = function (onoff) { | |
for (var i = this.cards.length - 1; i >= 0; i--) { | |
this.cards[i].highlight(onoff) | |
} | |
}; | |
this.returnToStack = function (astack) { | |
for (var i = 0; i < astack.cards.length; i++) { | |
astack.cards[i].drag = 0 | |
} | |
this.redraw(false) | |
}; | |
this.getDragStack = function (card) { | |
var newStack = new StackObject(card.stack.type, "drag", 0, 0, this.cardOffsetX, this.cardOffsetY, "", "", null); | |
for (var i = this.cards.length - 1; i >= 0; i--) { | |
var thiscard = this.cards[i]; | |
thiscard.drag = 1; | |
newStack.cards.unshift(thiscard); | |
if (thiscard == card) break | |
} | |
newStack.setPos(card.x, card.y, false); | |
return newStack | |
}; | |
this.removeCard = function (card) { | |
for (var i = 0; i < this.cards.length; i++) { | |
if (this.cards[i].id == card.id) { | |
this.cards.splice(i, 1); | |
break | |
} | |
} | |
}; | |
this.takeStack = function (incomingStack) { | |
var accept = acceptStack(this, incomingStack); | |
return accept | |
}; | |
this.addToStack = function (incomingStack) { | |
for (var i = 0; i < incomingStack.cards.length; i++) { | |
var thiscard = incomingStack.cards[i]; | |
thiscard.stack.removeCard(thiscard); | |
this.cards.push(thiscard); | |
thiscard.stack = this; | |
thiscard.drag = 0 | |
} | |
this.redraw(dragstack == null) | |
}; | |
this.turnOverTop = function () { | |
var card = this.topCard().card; | |
card.facing = 1; | |
card.div.loadingSteps = 0; | |
card.showCard(); | |
doneMove() | |
}; | |
this.dealCards = function (reportDoneMove) { | |
if (this.cards.length == 1) { | |
var discard = this.linked; | |
if (this.linked.linked != null) discard = this.linked.linked; | |
numDeals++; | |
if (numDeals > settings["Number of Deals"]) return; | |
if (this.linked.cards.length == 1) return; | |
while (this.linked.cards.length > 1) { | |
var card = this.linked.cards.pop(); | |
card.facing = 0; | |
this.cards.push(card); | |
card.stack = this; | |
card.showCard() | |
} | |
if (this.linked.linked != null) { | |
while (this.linked.linked.cards.length > 1) { | |
var card = this.linked.linked.cards.pop(); | |
card.facing = 0; | |
this.cards.push(card); | |
card.stack = this; | |
card.showCard() | |
} | |
} | |
if (reportDoneMove) doneMove() | |
} else { | |
var nctd = settings["Number of Cards to Deal"]; | |
if (nctd == undefined) nctd = 1; | |
for (var i = 0; i < nctd; i++) { | |
this.dealCard(); | |
if (this.cards.length <= 1) break | |
} | |
if (reportDoneMove) doneMove() | |
} | |
this.redraw(false); | |
linked.redraw(false); | |
this.raiseToTop(); | |
linked.raiseToTop() | |
}; | |
this.dealCard = function () { | |
if ((linked.cards.length > 1) && (linked.linked != null)) { | |
linked.dealCard() | |
} | |
var card = this.cards.pop(); | |
if (linked.name == "rest") { | |
card.facing = 0 | |
} else { | |
card.facing = 1 | |
} | |
linked.cards.push(card); | |
card.stack = linked; | |
card.animStart(); | |
card.showCard(); | |
linked.redraw(true) | |
}; | |
this.raiseToTop = function () { | |
for (var i = 0; i < this.cards.length; i++) { | |
this.cards[i].div.style.zIndex = String(topz++) | |
} | |
}; | |
this.setPos(this.x, this.y, false); | |
if (bottom == "blank") { | |
this.addCard("blank", 1) | |
} else if (bottom == "turnover") { | |
this.addCard("turnover", 1) | |
} else if (bottom == "foundationA") { | |
this.addCard("foundationA", 1) | |
} else if (bottom == "foundationK") { | |
this.addCard("foundationK", 1) | |
} else if (bottom == "foundation") { | |
this.addCard("foundation", 1) | |
} else if (bottom == "x") { | |
this.addCard("x", 1) | |
} | |
if (name != "drag") { | |
stacks.push(this) | |
} | |
}; | |
function CardObject(stack, cardval, facing) { | |
this.x = 0; | |
this.y = 0; | |
this.val = cardval; | |
this.stack = stack; | |
this.id = cardids; | |
this.facing = facing; | |
this.drag = 0; | |
this.animPos = null; | |
this.animTime = null; | |
this.animSpeed = null; | |
this.highimg = null; | |
this.suit = ""; | |
this.num = 0; | |
this.color = ""; | |
if (this.val == "blank") { | |
this.movable = 0 | |
} else if (this.val == "turnover") { | |
this.movable = 0 | |
} else if (this.val == "foundationA") { | |
this.movable = 0 | |
} else if (this.val == "foundationK") { | |
this.movable = 0 | |
} else if (this.val == "foundation") { | |
this.movable = 0 | |
} else if (this.val == "x") { | |
this.movable = 0 | |
} else { | |
this.movable = 1; | |
this.suit = (this.val).substr(0, 1); | |
this.num = parseInt(this.val.substr(1)); | |
this.color = "red"; | |
if ((this.suit == "s") || (this.suit == "c")) this.color = "black" | |
} | |
this.cardInfo = { | |
card: this, | |
val: this.val, | |
suit: this.suit, | |
num: this.num, | |
color: this.color, | |
facing: this.facing, | |
id: this.id | |
}; | |
this.setLoc = function (x, y, animate) { | |
if (animate) this.animStart(); | |
this.x = x; | |
this.y = y; | |
if (this.animPos == null) { | |
this.div.style.left = x + "px"; | |
this.div.style.top = y + "px" | |
} | |
}; | |
this.resetSize = function () { | |
this.div.style.width = cwidth + "px"; | |
this.div.style.height = cheight + "px" | |
}; | |
this.highlight = function (onoff) { | |
this.high = onoff; | |
if (this.highimg == null) { | |
this.highimg = document.getElementById("high" + this.id) | |
} | |
if (onoff == 1) { | |
this.highimg.style.visibility = "visible"; | |
this.highimg.style.opacity = 1 | |
} else if (onoff == 2) { | |
this.highimg.style.visibility = "visible"; | |
this.highimg.style.opacity = .5 | |
} else { | |
this.highimg.style.visibility = "hidden" | |
} | |
}; | |
this.animStart = function () { | |
if (settings["Animation"] == "On") { | |
this.animPos = { | |
x: this.x, | |
y: this.y | |
}; | |
this.animTime = (new Date()).getTime(); | |
this.animSpeed = 0 | |
} | |
}; | |
this.animCard = function () { | |
if (this.animSpeed == 0) { | |
this.animSpeed = animSpeedMultiplier * Math.floor(Math.sqrt(Math.pow(this.x - this.animPos.x, 2) + Math.pow(this.y - this.animPos.y, 2)) / numColumns) | |
} | |
var t = (new Date()).getTime() - this.animTime; | |
if (t > this.animSpeed) t = this.animSpeed; | |
if (this.animSpeed == 0) { | |
var x = this.x; | |
var y = this.y | |
} else { | |
var x = Math.floor(this.x * (t / this.animSpeed) + this.animPos.x * ((this.animSpeed - t) / this.animSpeed)); | |
var y = Math.floor(this.y * (t / this.animSpeed) + this.animPos.y * ((this.animSpeed - t) / this.animSpeed)) | |
} | |
this.div.style.left = x + "px"; | |
this.div.style.top = y + "px"; | |
if (t == this.animSpeed) this.animPos = null | |
}; | |
this.animStop = function () { | |
if (this.animPos == null) return; | |
this.animTime = 0; | |
this.animCard() | |
}; | |
this.getCardInfo = function () { | |
return this.cardInfo | |
}; | |
this.showCard = function () { | |
var val = this.val; | |
if ((val == "turnover") && (numDeals >= settings["Number of Deals"])) { | |
val = "x" | |
} | |
if ((val == "x") && (numDeals < settings["Number of Deals"])) { | |
val = "turnover" | |
} | |
if ((val == "foundation") && (this.stack.foundVal != null)) { | |
val = "foundation" + this.stack.foundVal | |
} | |
var ct = "png"; | |
if (deckname == "Rectangular") ct = "jpg"; | |
if (this.facing == 1) { | |
ih = "<IMG SRC='http://c.justsolitaire.com/decks/" + deckname + "/" + val + "." + ct + "' width=" + (cwidth) + " height=" + (cheight) + " style='position: absolute;'>" | |
} else { | |
ih = "<IMG SRC='http://c.justsolitaire.com/decks/" + deckname + "/back." + ct + "' width=" + (cwidth) + " height=" + (cheight) + " style='position: absolute;'>"; | |
var preloadcard = new Image(cwidth, cheight); | |
preloadcard.src = "http://c.justsolitaire.com/decks/" + deckname + "/" + val + "." + ct | |
} | |
if (deckname == "Rectangular") ct = "gif"; | |
ih += "<IMG id=high" + this.id + " ALIGN=CENTER SRC='http://c.justsolitaire.com/decks/" + deckname + "/highlight." + ct + "' width=" + (cwidth) + " height=" + (cheight) + " style='position: absolute; visibility: hidden;'>"; | |
this.div.innerHTML = ih; | |
this.highimg = null; | |
if (this.cardInfo.facing != this.facing) { | |
this.cardInfo.facing = this.facing | |
} | |
}; | |
this.canBeMoved = function () { | |
if (this.movable == 0) return false; | |
if (this.facing == 0) return false; | |
if (this.stack.build == "discard") { | |
if (this.stack.topCard().id != this.id) { | |
return false | |
} | |
} | |
return true | |
}; | |
this.div = document.createElement("div"); | |
this.div.style.zIndex = topz++; | |
this.div.style.border = "0"; | |
this.div.style.width = cwidth + "px"; | |
this.div.style.height = cheight + "px"; | |
this.div.style.position = "absolute"; | |
this.div.style.padding = "1px"; | |
this.div.id = cardids; | |
this.div.iscard = 1; | |
this.div.loadingSteps = 0; | |
this.high = 0; | |
this.showCard(); | |
ggd.appendChild(this.div); | |
cards[cardids] = this; | |
cardids++ | |
}; | |
function actonCard(card, mouseEvent) { | |
if (gameover) return; | |
dismissDialogs(); | |
if (card == previousCardClicked) { | |
if (card.stack.type == "foundation") { | |
selstack = null; | |
selcard = null; | |
highlightAll(0); | |
autoFinish(); | |
return | |
} | |
} | |
if (selstack != null) { | |
deststack = card.stack; | |
if ((card == selcard) && (mouseEvent == "down")) { | |
if (((new Date()).getTime() - seltime) < 1000) { | |
for (var i = 0; i < stacks.length; i++) { | |
if (stacks[i].takeStack(selstack)) { | |
selstack = null; | |
selcard = null; | |
highlightAll(0); | |
return | |
} | |
} | |
return | |
} | |
} else if (deststack != null) { | |
if (deststack.takeStack(selstack)) { | |
selstack = null; | |
selcard = null; | |
dragstack = null; | |
dragcard = null; | |
highlightAll(0); | |
return | |
} else { | |
highlightAll(0) | |
} | |
} | |
} | |
if (dragstack == null) { | |
if (cardCanDrag(card)) { | |
origstack = card.stack; | |
dragstack = card.stack.getDragStack(card); | |
dragcard = card; | |
if (dragstack.type != "pyramidreserve") { | |
dragstack.raiseToTop() | |
} | |
dragstack.highlight(1); | |
if (settings["Hints"] == "On") markPossibles(); | |
selstack = null; | |
selcard = null | |
} else if (cardCanClick(card, mouseEvent)) { | |
dragstack = null; | |
dragcard = null | |
} | |
} else if ((dragstack != null) && (mouseEvent == "up")) { | |
deststack = card.stack; | |
if (deststack != null) { | |
if (!deststack.takeStack(dragstack)) { | |
origstack.returnToStack(dragstack); | |
selstack = dragstack; | |
selcard = dragcard; | |
seltime = (new Date()).getTime(); | |
highlightAll(0); | |
selstack.highlight(1); | |
dragstack = null; | |
dragcard = null | |
} else { | |
highlightAll(0) | |
} | |
} | |
deststack = null; | |
dragstack = null; | |
dragcard = null | |
} | |
}; | |
function mouseDown(e) { | |
e = e || window.event; | |
var target = e.target != null ? e.target : e.srcElement; | |
if (!target.parentNode.iscard) { | |
selstack = null; | |
selcard = null; | |
highlightAll(0); | |
dragstack = null; | |
dragcard = null; | |
return | |
} | |
dismissDialogs(); | |
if (isTouchDevice) event.preventDefault(); | |
dragoffset = getMouseOffset(e, target); | |
var card = cards[target.parentNode.id]; | |
actonCard(card, "down"); | |
previousCardClicked = card; | |
return false | |
}; | |
function mouseDouble(e) { | |
if (getDeviceType() == "IE") { | |
if (getIEType() < 9) { | |
mouseDown(e) | |
} | |
} | |
}; | |
function cardCanClickDefault(card) { | |
if (card.stack.type == "deck") { | |
card.stack.dealCards(true) | |
} else if (card.facing == 0) { | |
if (card.id == card.stack.topCard().card.id) { | |
card.stack.turnOverTop() | |
} | |
} | |
}; | |
function mouseUp(e) { | |
e = e || window.event; | |
var target = e.target != null ? e.target : e.srcElement; | |
if (!target.parentNode.iscard) { | |
if ((origstack != null) && (dragstack != null)) { | |
origstack.returnToStack(dragstack) | |
} | |
selstack = null; | |
selcard = null; | |
highlightAll(0); | |
dragstack = null; | |
dragcard = null; | |
return | |
} | |
if (isTouchDevice) event.preventDefault(); | |
if (dragstack == null) return; | |
var card = null; | |
var mc = mouseCoords(e); | |
for (var i = 0; i < cards.length; i++) { | |
if (cards[i].drag == 1) continue; | |
if (pointOverCard(mc.x, mc.y, cards[i])) { | |
card = cards[i]; | |
break | |
} | |
} | |
if (card == null) { | |
for (var i = 0; i < cards.length; i++) { | |
if (cards[i].drag == 1) continue; | |
if (pointOverCard(mc.x, mc.y - dragoffset.y, cards[i])) { | |
card = cards[i]; | |
break | |
} | |
} | |
} | |
if (card != null) { | |
actonCard(card, "up") | |
} else { | |
origstack.returnToStack(dragstack); | |
selstack = dragstack; | |
selcard = dragcard; | |
seltime = (new Date()).getTime(); | |
dragstack = null; | |
dragcard = null | |
} | |
}; | |
function mouseMove(e) { | |
if (dragstack == null) return; | |
e = e || window.event; | |
if (isTouchDevice) event.preventDefault(); | |
var mousePos = mouseCoords(e); | |
lastmouse = mousePos; | |
dragstack.setPos(mousePos.x - dragoffset.x, mousePos.y - dragoffset.y, false); | |
return false | |
}; | |
function pointOverCard(x, y, c) { | |
var cx = c.x; | |
var cy = c.y; | |
if (x < cx) return false; | |
if (y < cy) return false; | |
if (x > cx + cwidth) return false; | |
if (y > cy + cheight) return false; | |
return true | |
}; | |
function mouseCoords(e) { | |
var x = lastmouse.x; | |
var y = lastmouse.y; | |
if (e.pageX || e.pageY) { | |
x = e.pageX; | |
y = e.pageY | |
} else if (e.clientX || e.clientY) { | |
x = e.clientX + document.body.scrollLeft - document.body.clientLeft; | |
y = e.clientY + document.body.scrollTop - document.body.clientTop | |
} else if (event.targetTouches[0]) { | |
x = event.targetTouches[0].pageX; | |
y = event.targetTouches[0].pageY | |
} | |
return { | |
x: x, | |
y: y | |
} | |
}; | |
function getMouseOffset(e, target) { | |
var docPos = getPosition(target); | |
var mousePos = mouseCoords(e); | |
lastmouse = mousePos; | |
return { | |
x: mousePos.x - docPos.x, | |
y: mousePos.y - docPos.y | |
} | |
}; | |
function getPosition(e) { | |
var x = 0; | |
var y = 0; | |
while (e.offsetParent) { | |
x += e.offsetLeft; | |
y += e.offsetTop; | |
e = e.offsetParent | |
} | |
x += e.offsetLeft; | |
y += e.offsetTop; | |
return { | |
x: x, | |
y: y | |
} | |
}; | |
function makeDeck(numDecksToDeal, suitStr) { | |
playSound("cardshuffle"); | |
numDecks += numDecksToDeal; | |
if (suitStr == undefined) { | |
suits = new Array("s", "c", "h", "d") | |
} else { | |
suits = suitStr.split(",") | |
} | |
deck = new Array(); | |
var temp = new Array(); | |
for (var i = 0; i < numDecksToDeal; i++) { | |
for (var s = 0; s < 4; s++) { | |
for (var v = 1; v <= 13; v++) { | |
temp.push("" + suits[s] + v) | |
} | |
} | |
} | |
while (temp.length > 0) { | |
var r = Math.floor(Math.random() * temp.length); | |
deck.push(temp[r]); | |
temp.splice(r, 1) | |
} | |
}; | |
function highlightAll(onoff) { | |
for (var i = cards.length - 1; i >= 0; i--) { | |
cards[i].highlight(onoff) | |
} | |
}; | |
function getCardFromDeck() { | |
if (deck.length == 0) return false; | |
return deck.pop() | |
}; | |
function getSpecificCardFromDeck(cardVal) { | |
for (var i = 0; i < deck.length; i++) { | |
if (deck[i] == cardVal) { | |
deck.splice(i, 1); | |
return cardVal | |
} | |
} | |
return false | |
}; | |
function getStack(n) { | |
if (n == parseInt(n)) { | |
var name = "stack" + n | |
} else { | |
var name = n | |
} | |
for (var i = 0; i < stacks.length; i++) { | |
if (stacks[i].name == name) return stacks[i] | |
} | |
return null | |
}; | |
function getText(name) { | |
for (var i = 0; i < texts.length; i++) { | |
if (texts[i].name == name) return texts[i] | |
} | |
return null | |
}; | |
function restCard(card) { | |
card.stack.removeCard(card); | |
card.stack = rest; | |
card.facing = 0; | |
card.showCard(); | |
rest.cards.push(card); | |
rest.raiseToTop(); | |
rest.redraw(true); | |
selstack = null; | |
selcard = null; | |
dragstack = null; | |
dragcard = null; | |
highlightAll(0) | |
}; | |
function doneMove() { | |
playSound("cardput1"); | |
numMoves++; | |
stateList.push(saveCardStacks()); | |
showScore(); | |
saveGame(); | |
checkWin(); | |
checkAutoplay() | |
}; | |
function saveCardStacks() { | |
var saveString = ""; | |
for (var i = 0; i < stacks.length; i++) { | |
var stackCards = new Array(); | |
if (i > 0) saveString += "|"; | |
var facing = 1; | |
for (var j = 0; j < stacks[i].cards.length; j++) { | |
var card = stacks[i].cards[j]; | |
if (card.facing != facing) { | |
facing = card.facing; | |
saveString += "^" | |
} | |
saveString += cardValToChar(card.val) | |
} | |
} | |
saveString += "|*" + numMoves + "*" + numDeals + "*" + previousScore + "*" + gameTime + "*" + numDecks + "*" + previousCardsRemoved + "*" + numGameDeals + "*" + miscGameData; | |
return saveString | |
}; | |
function markPossibles() { | |
for (var i = 0; i < stacks.length; i++) { | |
if (stacks[i] == dragstack) continue; | |
if (canAcceptStack(stacks[i], dragstack)) { | |
stacks[i].topCard().card.highlight(2) | |
} | |
} | |
}; | |
function checkAutoplay() { | |
if (settings["Autoplay"] == "Off") return; | |
for (var i = 0; i < stacks.length; i++) { | |
if (stacks[i].type == "deck") { | |
if (stacks[i].linked != null) { | |
if (stacks[i].linked.cards.length < 2) { | |
stacks[i].dealCards(false) | |
} | |
} | |
} | |
} | |
for (var i = 0; i < stacks.length; i++) { | |
if (stacks[i].type == "stack") { | |
if (stacks[i].cards.length < 1) continue; | |
if (stacks[i].topCard().card.facing == 0) { | |
stacks[i].turnOverTop() | |
} | |
} | |
} | |
}; | |
function autoFinish() { | |
if (autoFinishAttempt()) { | |
setTimeout(autoFinish, 250) | |
} | |
}; | |
function autoFinishAttempt() { | |
for (var i = 0; i < stacks.length; i++) { | |
if (stacks[i].type == "foundation") continue; | |
if (stacks[i].topCard().card.movable == 0) continue; | |
if (stacks[i].topCard().card.facing == 0) continue; | |
var card = stacks[i].topCard().card; | |
origstack = card.stack; | |
selstack = card.stack.getDragStack(card); | |
selstack.raiseToTop(); | |
dragcard = null; | |
dragstack = null; | |
dragstack = null; | |
for (var j = 0; j < stacks.length; j++) { | |
if (stacks[j].type != "foundation") continue; | |
if (stacks[j].takeStack(selstack)) { | |
dragstack = null; | |
dragcard = null; | |
highlightAll(0); | |
return true | |
} | |
} | |
origstack.returnToStack(selstack) | |
} | |
selstack = null; | |
selcard = null; | |
dragstack = null; | |
dragcard = null; | |
highlightAll(0); | |
return false | |
}; | |
function cardValToChar(cardval) { | |
if (cardval == "") return "0"; | |
if (cardval == "blank") return "1"; | |
if (cardval == "turnover") return "2"; | |
if (cardval == "foundation") return "3"; | |
if (cardval == "foundationA") return "4"; | |
if (cardval == "foundationK") return "5"; | |
if (cardval == "x") return "6"; | |
var suitStr = cardval.substr(0, 1); | |
var suit = 0; | |
if (suitStr == "c") suit = 1; | |
if (suitStr == "h") suit = 2; | |
if (suitStr == "d") suit = 3; | |
var num = parseInt(cardval.substr(1)); | |
if (suit < 2) { | |
var c = String.fromCharCode(64 + suit * 13 + num) | |
} else { | |
var c = String.fromCharCode(96 + (suit - 2) * 13 + num) | |
} | |
return c | |
}; | |
function charToCardVal(c) { | |
if (c == "0") return ""; | |
if (c == "1") return "blank"; | |
if (c == "2") return "turnover"; | |
if (c == "3") return "foundation"; | |
if (c == "4") return "foundationA"; | |
if (c == "5") return "foundationK"; | |
if (c == "6") return "x"; | |
var n = c.charCodeAt(0); | |
if (n <= 77) { | |
var suit = "s"; | |
var num = n - 64 | |
} else if (n < 91) { | |
var suit = "c"; | |
var num = n - 77 | |
} else if (n <= 109) { | |
var suit = "h"; | |
var num = n - 96 | |
} else { | |
var suit = "d"; | |
var num = n - 109 | |
} | |
return suit + num | |
}; | |
function undoMove() { | |
if (gameover) { | |
gameUnwon() | |
} | |
if (stateList.length > 1) { | |
numMoves--; | |
stateList.pop(); | |
var saveString = stateList[stateList.length - 1]; | |
recallCardStack(saveString); | |
showScore(); | |
saveGame() | |
} else if (numMoves > 1) { | |
alertMessage("Reloaded games can only undo up to the point of the latest reload. You can still use RESET to start from the original deal.") | |
} else { | |
resetGame() | |
} | |
}; | |
function recallCardStack(saveString) { | |
var cards = new Array(); | |
for (var i = 0; i < stacks.length; i++) { | |
for (var j = stacks[i].cards.length - 1; j >= 0; j--) { | |
var card = stacks[i].cards[j]; | |
if (card.movable == 0) continue; | |
stacks[i].cards.splice(j, 1); | |
card.stack = null; | |
cards.push(card) | |
} | |
} | |
str = ""; | |
var sstacks = saveString.split("|"); | |
for (var i = 0; i < sstacks.length; i++) { | |
if (sstacks[i].substr(0, 1) == "*") { | |
var gamedata = sstacks[i].split("*"); | |
numMoves = parseInt(gamedata[1]); | |
numDeals = parseInt(gamedata[2]); | |
previousScore = parseInt(gamedata[3]); | |
gameTime = parseInt(gamedata[4]); | |
numDecks = parseInt(gamedata[5]); | |
previousCardsRemoved = parseInt(gamedata[6]); | |
numGameDeals = parseInt(gamedata[7]); | |
if (gamedata.length > 8) { | |
miscGameData = gamedata[8] | |
} | |
} else { | |
var facing = 1; | |
for (var j = 0; j < sstacks[i].length; j++) { | |
var c = sstacks[i].substr(j, 1); | |
if (c == "^") { | |
facing = (facing == 0 ? 1 : 0); | |
continue | |
} else { | |
var cardval = charToCardVal(c); | |
if (i == 10) str += c + "=" + cardval + " "; | |
for (var k = 0; k < cards.length; k++) { | |
if (cards[k].val == cardval) { | |
var card = cards[k]; | |
cards.splice(k, 1); | |
stacks[i].cards.push(card); | |
if (i == 10) str += c + "=" + cardval + " "; | |
card.stack = stacks[i]; | |
card.facing = facing; | |
card.showCard(); | |
break | |
} | |
} | |
} | |
} | |
stacks[i].setPos(0, 0) | |
} | |
} | |
redrawAll() | |
}; | |
function saveGame() { | |
var saveString = saveCardStacks(); | |
setCookie("saveString" + game, saveString); | |
setCookie("resetString" + game, resetString) | |
}; | |
function loadGame() { | |
var saveString = getCookie("saveString" + game); | |
resetString = getCookie("resetString" + game); | |
stateList = new Array(); | |
stateList.push(saveString); | |
recallCardStack(saveString); | |
starttime = (new Date()).getTime() - gameTime * 1000; | |
showScore(); | |
showTime() | |
}; | |
function checkWin() { | |
if (winState()) { | |
gameWon() | |
} | |
}; | |
function gameWon() { | |
playSound("applause"); | |
feedback("win"); | |
gStats["Games Won"]++; | |
saveStats(); | |
showMessage("You Won!"); | |
gameover = true; | |
var goanim = getGameOverAnim(); | |
var temp = new Array(); | |
var firstset = Math.floor(goanim.substr(0, 1)); | |
for (var i = 0; i < Math.floor(goanim.length / 2); i++) { | |
temp.push({ | |
x: goanim.charCodeAt(i * 2 + 1) - 77.5, | |
y: goanim.charCodeAt(i * 2 + 2) - 77.5 | |
}) | |
} | |
var n = 0; | |
var m = tableWidth / 30; | |
var topY = 2000; | |
var leftX = 2000; | |
var rightX = -2000; | |
for (var i = 0; i < cards.length; i++) { | |
if (cards[i].movable == 0) { | |
cards[i].div.style.visibility = "hidden" | |
} else { | |
cards[i].facing = 1; | |
cards[i].animSpeed = 0; | |
cards[i].showCard(); | |
var nn = n; | |
if (n >= temp.length) nn = n % firstset; | |
var x = (temp[nn].x - .5) * m; | |
var y = Math.max(340, tableTop + tableHeight / 2 - cheight) + temp[nn].y * m; | |
if (nn < firstset) { | |
x += Math.random() * m - m / 2; | |
y += Math.random() * m - m / 2 | |
} | |
if (y < topY) topY = y; | |
if (x < leftX) leftX = x; | |
if (x > rightX) rightX = x; | |
cards[i].setLoc(x, y, true); | |
cards[i].div.style.zIndex = String(topz++); | |
n++ | |
} | |
} | |
var middleX = (rightX - leftX) / 2 + leftX; | |
for (var i = 0; i < cards.length; i++) { | |
cards[i].y = cards[i].y + ((tableTop + cheight / 2) - topY); | |
cards[i].x = cards[i].x + tableLeft + tableWidth / 2 - cwidth / 2 | |
} | |
if (isApp) { | |
for (var i = 0; i < cards.length; i++) { | |
cards[i].y += 40 | |
} | |
} | |
makeMessage() | |
}; | |
function gameUnwon() { | |
gStats["Games Won"]--; | |
dismissDialogs(); | |
saveStats(); | |
gameover = false; | |
for (var i = 0; i < cards.length; i++) { | |
if (cards[i].movable == 0) { | |
cards[i].div.style.visibility = "visible" | |
} | |
} | |
redrawAll() | |
}; | |
function getGameOverAnim() { | |
var aa = new Array(); | |
aa.push("2MVOVMPMNMLMJMHMFOPONOLOJOHOF"); | |
aa.push("2JKRKOEQERFTFUGVGWHXIXKXMXOXQXSWTVUUUTVRVQWOWMWKWJVHVGUFUETDSDQDODMDKDIEHFGGGHFJFKEMETPRPQQOQMQKQJPHP"); | |
aa.push("3GGUGNMYQXSWTVUUUTVRVQWOWMWKWJVHVGUFUETDSCQ"); | |
aa.push("1NELSPSQUKUJWRWLJPJNINKNMNONQJIHHRITHIYSYVGFGOEMEMDOD"); | |
aa.push("1NNNEMGLIKKOGPIQKVKTJRJOJTLSNQOSURSRPRNQTOSMRHUJTLSNRISIPINEKGLHNJOGJIJLJNCXJTVGVCJLMPMLOPONMNO"); | |
aa.push("6KNNNQNKJNJQJNWPWRWLWJWNTNQPQRQLQJQHPTPTMHMIKSKRIJILGPGNEHWTW"); | |
aa.push("4NMHOTONGPWLWNSNVNPRPTQJPHQFPVPVMFMHLTLOJMJKGQGRMJMMDODLPPPLMPMKXQX"); | |
aa.push("9IILIPISIIMLMPMSMLQPQNVOUPTQSRRSQTPUOVNVLVJVHUGTFSEQEPFOGMULTKSJRIQHPGOFNFLFJFHGGHFIEKELFMG"); | |
aa.push("8KLPLKPPPLHOHLTOTOXPVQTSRTPUNMXKVITHRGPENGLHJIHKFTLSJQHPFODMD"); | |
var r = Math.floor(Math.random() * aa.length); | |
return aa[r] | |
}; | |
function trace(t) { | |
document.getElementById("db").value = String(t) | |
}; | |
function checkImagesLoaded() { | |
var numImages = document.images.length; | |
var numLoaded = 0; | |
for (var i = 0; i < numImages; i++) { | |
if (document.images[i].complete) { | |
numLoaded++; | |
if (document.images[i].parentNode.iscard) { | |
if (document.images[i].parentNode.loadingSteps != -1) { | |
if (document.images[i].parentNode.style.background != "none") { | |
document.images[i].parentNode.style.background = "none"; | |
document.images[i].parentNode.style.opacity = "1"; | |
document.images[i].parentNode.loadingSteps = -1 | |
} | |
} | |
} | |
} else { | |
if (document.images[i].parentNode.iscard) { | |
if (document.images[i].parentNode.loadingSteps++ > 3) { | |
if (document.images[i].parentNode.style.background != "black") { | |
document.images[i].parentNode.style.background = "black"; | |
document.images[i].parentNode.style.opacity = ".1" | |
} | |
} | |
} | |
} | |
} | |
var numToLoad = numImages - numLoaded; | |
if ((numImagesToLoad == 0) && (numToLoad > 0)) { | |
numImagesToLoad = numToLoad | |
} else if ((numImagesToLoad > 0) && (numToLoad == 0)) { | |
showDefaultMessage() | |
} | |
if (numToLoad > 0) { | |
showMessage("Loading Images: " + numToLoad) | |
} | |
}; | |
function setCookie(name, value, expires) { | |
if (!isApp) { | |
var expires = new Date((new Date()).getTime() + (365 * 24 * 60 * 60 * 1000)); | |
document.cookie = name + "=" + value + ";expires=" + expires.toGMTString() | |
} else { | |
localStorage.setItem(name, value) | |
} | |
}; | |
function getCookie(name) { | |
if (!isApp) { | |
var dc = document.cookie; | |
var cname = name + "="; | |
if (dc.length > 0) { | |
begin = dc.indexOf(cname); | |
if (begin != -1) { | |
begin += cname.length; | |
end = dc.indexOf(";", begin); | |
if (end == -1) end = dc.length; | |
return (dc.substring(begin, end)) | |
} | |
} | |
} else { | |
return localStorage.getItem(name) | |
} | |
return null | |
}; | |
function isFixedDevice() { | |
var d = navigator.userAgent.toLowerCase(); | |
if (d.indexOf("ipad") != -1) return true; | |
if (d.indexOf("iphone") != -1) return true; | |
if (d.indexOf("ipod") != -1) return true; | |
if (d.indexOf("android") != -1) return true; | |
return false | |
}; | |
function getDeviceType() { | |
var d = navigator.userAgent.toLowerCase(); | |
if (d.indexOf("ipad") != -1) return "iPad"; | |
if (d.indexOf("iphone") != -1) return "iPhone"; | |
if (d.indexOf("ipod") != -1) return "iPod"; | |
if (d.indexOf("android") != -1) return "Android"; | |
if (d.indexOf("safari") != -1) return "Safari"; | |
if (d.indexOf("ie") != -1) return "IE"; | |
if (d.indexOf("firefox") != -1) return "Firefox"; | |
return "unknown" | |
}; | |
function getIEType() { | |
var d = navigator.userAgent.toLowerCase(); | |
if (d.indexOf("msie 7") != -1) return 7; | |
if (d.indexOf("msie 8") != -1) return 8; | |
if (d.indexOf("msie 9") != -1) return 9; | |
if (d.indexOf("msie 10") != -1) return 10; | |
if (d.indexOf("msie 11") != -1) return 11; | |
if (d.indexOf("msie 12") != -1) return 12; | |
return 6 | |
}; | |
function getGraphicsSupport() { | |
var d = navigator.userAgent.toLowerCase(); | |
if (d.indexOf("ipad") != -1) return 2; | |
if (d.indexOf("iphone") != -1) return 2; | |
if (d.indexOf("ipod") != -1) return 2; | |
if (d.indexOf("android") != -1) return 2; | |
if (d.indexOf("safari") != -1) return 2; | |
if (d.indexOf("msie 8") != -1) return 1; | |
if (d.indexOf("msie 9") != -1) return 2; | |
if (d.indexOf("msie 10") != -1) return 2; | |
if (d.indexOf("msie 11") != -1) return 2; | |
if (d.indexOf("msie 12") != -1) return 2; | |
if (d.indexOf("ie") != -1) return 1; | |
if (d.indexOf("firefox") != -1) return 2; | |
return 1 | |
}; | |
function drawToolbar() { | |
if (toolbar != null) { | |
ggd.removeChild(toolbar); | |
ggd.removeChild(toolbarbg); | |
ggd.removeChild(tooltext) | |
} | |
toolScale = .4; | |
if (winWidth < 1000) { | |
toolScale = .32 | |
} else if (winWidth < 800) { | |
toolScale = .32 | |
} | |
if (smallDevice) toolScale = .32; | |
toolHeight = 100 * toolScale; | |
toolbar = document.createElement("toolbar"); | |
toolbar.style.left = toolLeft + "px"; | |
toolbar.style.top = (toolTop + toolEdge) + "px"; | |
toolbar.style.width = toolWidth + "px"; | |
toolbar.style.height = toolHeight + "px"; | |
toolbar.style.position = "absolute"; | |
toolbarbg = document.createElement("toolbarbg"); | |
toolbarbg.style.left = "0px"; | |
toolbarbg.style.top = toolTop + "px"; | |
toolbarbg.style.width = (winWidth) + "px"; | |
toolbarbg.style.height = (toolHeight + toolEdge * 2) + "px"; | |
toolbarbg.style.position = "absolute"; | |
toolbarbg.style.background = "#000"; | |
toolbarbg.style.opacity = .5; | |
ggd.appendChild(toolbarbg); | |
ggd.appendChild(toolbar); | |
var ht = ""; | |
var w = Math.floor((toolWidth - 15 + 1) / 7); | |
var buttons = new Array(); | |
buttons.push(["prefs", 80, showPrefs]); | |
buttons.push(["info", 80, showInfo]); | |
buttons.push(["undo", 80, undoMove]); | |
buttons.push(["new", 80, showNewMenu]); | |
var xpos = toolWidth; | |
for (var i = 0; i < buttons.length; i++) { | |
var label = buttons[i][0]; | |
var buttonWidth = buttons[i][1] * toolScale; | |
var buttonHeight = 80 * toolScale; | |
if (smallDevice) {} | |
if (isApp) { | |
xpos -= buttonWidth * 1.5 | |
} else { | |
xpos -= buttonWidth * 1.5 | |
} | |
ht += "<div id=toolbarbutton" + i + " style='width: " + buttonWidth + "px; height: " + buttonHeight + "px; left: " + xpos + "px; top: 4px; position: absolute; cursor: pointer;'><img src='http://c.justsolitaire.com/buttons/jsi-" + label + ".png' style='height: " + buttonHeight + "px; width: " + buttonWidth + "px;'></div>" | |
} | |
if (winWidth > 480) { | |
var titleWidth = 600 * toolScale; | |
var titleHeight = 100 * toolScale; | |
ht += "<div id=titlebutton style='width: " + (titleWidth) + "px; height: " + (titleHeight) + "px; left: 0px; top: 0px; position: absolute; cursor: pointer;'><img src='http://c.justsolitaire.com/buttons/jsb-title.png' style='height: " + (titleHeight) + "px; width: " + (titleWidth) + "px;' onclick='mainMenu();'></div>" | |
} else { | |
titleWidth = 0 | |
} | |
var displayLeft = (titleWidth == 0 ? 0 : titleWidth + toolLeft); | |
var displayTop = toolTop + 20 * toolScale; | |
var displayWidth = (xpos - titleWidth); | |
var displayHeight = toolHeight - 40 * toolScale; | |
toolbar.innerHTML = ht; | |
for (var i = 0; i < buttons.length; i++) { | |
document.getElementById("toolbarbutton" + i).onclick = buttons[i][2] | |
} | |
tooltext = document.createElement("tooltext"); | |
tooltext.style.left = displayLeft + "px"; | |
tooltext.style.top = displayTop + "px"; | |
tooltext.style.width = displayWidth + "px"; | |
tooltext.style.height = displayHeight + "px"; | |
tooltext.style.position = "absolute"; | |
ggd.appendChild(tooltext); | |
var ht = ""; | |
var displayParts = new Array(); | |
if (!isApp) displayParts.push(["Message", 3]); | |
displayParts.push(["Time", 1]); | |
displayParts.push(["Score", 1]); | |
var totalDisplayParts = 0; | |
for (var i = 0; i < displayParts.length; i++) { | |
totalDisplayParts += displayParts[i][1] | |
} | |
var w = Math.floor((displayWidth) / totalDisplayParts); | |
var fontsize = displayHeight * .75; | |
var n = 0; | |
for (var i = 0; i < displayParts.length; i++) { | |
ht += "<div id='display" + displayParts[i][0] + "' style='width: " + (displayParts[i][1] * w) + "px; height: " + (displayHeight - 4) + "px; left: " + (n * w) + "px; top: 4px; position: absolute; cursor: default; margin: 0; font-size: " + fontsize + "px; color: #000; text-align: center; font-weight: bold;'></div>"; | |
n += displayParts[i][1] | |
} | |
if (winWidth <= -1) { | |
ht += displayMessageForApp(displayHeight, (toolTop + toolHeight)) | |
} | |
tooltext.innerHTML = ht; | |
tableTop = toolTop + toolHeight + toolEdge * 2 + 4 | |
}; | |
function displayMessageForApp(h, t) { | |
var ret = ""; | |
var fontsize = h / 2; | |
ret += "<div id='displayMessage' style='width: 320px; height: 20px; left: 0px; top: " + (380 - t) + "px; position: absolute; cursor: default; padding-top: 1px; margin: 0; font-size: " + fontsize + "pt; color: #FFFFFF; text-align: center; font-weight: bold;'></div>"; | |
return ret | |
}; | |
function showMessage(mess) { | |
if (document.getElementById("displayMessage") == undefined) return; | |
document.getElementById("displayMessage").innerHTML = "<span class=displaym>" + mess + "</span>"; | |
if (mess != "") { | |
if (messageTimer != null) clearTimeout(messageTimer); | |
messageTimer = setTimeout(showDefaultMessage, 3000) | |
} | |
}; | |
function showDefaultMessage() { | |
var mess = "<span class=displayd>" + game + "</span>"; | |
if (defaultMessage != "") mess += "<span class=displaym> (" + defaultMessage + ")</span>"; | |
document.getElementById("displayMessage").innerHTML = mess; | |
if (messageTimer != null) clearTimeout(messageTimer); | |
messageTimer = null | |
}; | |
function changeScore(n) { | |
showScore() | |
}; | |
function showScore() { | |
cardsRemoved = 0; | |
for (var i = 0; i < stacks.length; i++) { | |
if (scoreStack == "default") { | |
if ((stacks[i].type == "rest") || (stacks[i].type == "foundation")) { | |
cardsRemoved += (stacks[i].cards.length - 1) | |
} | |
} else { | |
if (stacks[i].type == scoreStack) { | |
cardsRemoved += (stacks[i].cards.length - 1) | |
} | |
} | |
} | |
if (settings["Scoring Method"] == "+1 Per Card") { | |
var score = cardsRemoved + previousCardsRemoved | |
} else if (settings["Scoring Method"] == "-52 Per Deck +5 Per Card") { | |
var score = -52 * (numDecks) + (cardsRemoved + previousCardsRemoved) * 5 | |
} else { | |
var score = -52 * (numDecks) + (cardsRemoved + previousCardsRemoved) * 5 | |
} | |
if (specialScore != null) { | |
score = specialScore | |
} | |
var scoreText = "<span class=displayd>" + score + "</span>"; | |
if (tableWidth > 480) { | |
scoreText += "<span class=displayh> pts</span>" | |
} | |
document.getElementById("displayScore").innerHTML = scoreText; | |
return score | |
}; | |
function showTime() { | |
if (gameover) return; | |
gameTime = Math.floor(((new Date()).getTime() - starttime) / 1000); | |
var min = Math.floor(gameTime / 60); | |
var hour = Math.floor(min / 60); | |
if (hour > 0) { | |
var str = "" + hour + ":" + String(min - hour * 60 + 100).substr(1, 2) + ":" + String(gameTime - min * 60 + 100).substr(1, 2) | |
} else { | |
var str = "" + min + ":" + String(gameTime - min * 60 + 100).substr(1, 2) | |
} | |
gameTimeStr = str; | |
document.getElementById("displayTime").innerHTML = "<span class=displayd>" + str + "</span>"; | |
checkImagesLoaded(); | |
if (lastMinute != min) { | |
lastMinute = min; | |
saveGame() | |
} | |
}; | |
function redrawAll() { | |
for (var i = 0; i < stacks.length; i++) { | |
stacks[i].redraw(false); | |
stacks[i].raiseToTop() | |
} | |
for (var i = 0; i < texts.length; i++) { | |
texts[i].setLoc() | |
} | |
}; | |
function redrawAllCards() { | |
for (var i = 0; i < cards.length; i++) { | |
cards[i].showCard() | |
} | |
}; | |
function animCards() { | |
for (var i = 0; i < cards.length; i++) { | |
if (cards[i].animPos != null) { | |
cards[i].animCard() | |
} | |
} | |
}; | |
function resetGame() { | |
dismissDialogs(); | |
if (gameover) { | |
gameUnwon() | |
} | |
for (var i = 0; i < cards.length; i++) { | |
cards[i].div.style.visibility = "visible" | |
} | |
recallCardStack(resetString); | |
stateList = new Array(); | |
stateList.push(resetString); | |
numDeals = 0; | |
numMoves = 0; | |
showScore(); | |
gameover = false; | |
saveGame(); | |
checkAutoplay() | |
}; | |
function mainMenu() { | |
if (isApp) {} else { | |
window.location = "http://justsolitaire.com/" | |
} | |
}; | |
function twitterButton() { | |
window.open("http://twitter.com/justsolitaire", "_blank") | |
}; | |
function facebookButton() { | |
window.open("http://www.facebook.com/justsolitaire", "_blank") | |
}; | |
function newGame() { | |
dismissDialogs(); | |
setCookie("saveString" + game, ""); | |
window.location.reload() | |
}; | |
function newDeal() { | |
dismissDialogs(); | |
gameScore = showScore(); | |
previousScore = gameScore; | |
previousCardsRemoved += cardsRemoved; | |
cardsRemoved = 0; | |
cleanUpGame(); | |
if (settings["Reset Timer"] == "Each Deal") { | |
starttime = (new Date()).getTime() | |
} | |
setUpGame(); | |
afterLoad(); | |
showScore(); | |
resetString = saveCardStacks(); | |
numGameDeals++; | |
saveGame(); | |
feedback("start"); | |
gStats["Games Played"]++; | |
saveStats() | |
}; | |
function clearStats() { | |
if (!isApp) { | |
if (!confirm("Are you sure you want to clear the stats for this game?")) { | |
return | |
} | |
} | |
gStats = new Array(); | |
saveStats(); | |
loadStats(); | |
showStats(); | |
gStats["Games Played"]++ | |
}; | |
function showImportantMessage(bg, mess) { | |
dismissDialogs(); | |
diagLeftSide = tableLeft + (tableWidth - 320) / 2; | |
diagTop = tableTop; | |
hdiag = document.createElement("hdiag"); | |
hdiag.style.zIndex = topz++; | |
hdiag.style.width = "300px"; | |
hdiag.style.height = "240px"; | |
hdiag.style.background = "url(http://c.justsolitaire.com/buttons/" + bg + ".png)"; | |
hdiag.style.position = "absolute"; | |
hdiag.style.color = "#fff"; | |
hdiag.style.fontSize = "1.1em"; | |
hdiag.style.padding = "10px"; | |
var closeButtonTop = 5; | |
if (bg == "jsdialogarrow") { | |
hdiag.style.paddingTop = "30px"; | |
hdiag.style.height = "220px"; | |
closeButtonTop = 25; | |
diagLeftSide = tableLeft + tableWidth - 300 - 28; | |
diagTop = tableTop - 10 | |
} | |
hdiag.style.top = diagTop + "px"; | |
hdiag.style.left = diagLeftSide + "px"; | |
hdiag.id = "hdiag"; | |
ggd.appendChild(hdiag); | |
var ihtml = "<img src=http://c.justsolitaire.com/buttons/jsb-x.png width=32 height=32 style='position: absolute; left: 283px; top: " + closeButtonTop + "px;' id=messclose>" + mess; | |
hdiag.innerHTML = ihtml; | |
document.getElementById("messclose").onclick = dismissDialogs | |
}; | |
function showCorner() { | |
if (isFixedDevice()) { | |
corner = null; | |
return | |
} | |
getWinDim(); | |
corner = document.createElement("corner"); | |
corner.style.zIndex = topz++; | |
corner.style.left = (winWidth - 150) + "px"; | |
corner.style.top = (winHeight - 150) + "px"; | |
corner.style.width = "150px"; | |
corner.style.height = "150px"; | |
corner.style.position = "absolute"; | |
corner.style.background = "url(http://c.justsolitaire.com/images/cornerhelp.png)"; | |
corner.onclick = hideCorner; | |
corner.id = "corner"; | |
ggd.appendChild(corner) | |
}; | |
function hideCorner() { | |
if (corner != null) { | |
ggd.removeChild(corner); | |
corner = null | |
} | |
}; | |
function showNewMenu() { | |
makeOptions("new", "") | |
}; | |
function showInfoPane(infoPane) { | |
lastInfoPane = infoPane; | |
makeOptions("info", lastInfoPane) | |
}; | |
function showPrefsPane(prefsPane) { | |
lastPrefsPane = prefsPane; | |
makeOptions("prefs", lastPrefsPane) | |
}; | |
function showInfo() { | |
showInfoPane(lastInfoPane) | |
}; | |
function showPrefs() { | |
showPrefsPane(lastPrefsPane) | |
}; | |
function showGeneralPrefs() { | |
showPrefsPane("generalprefs") | |
}; | |
function showRulePrefs() { | |
showPrefsPane("ruleprefs") | |
}; | |
function showHelp() { | |
showInfoPane("help") | |
}; | |
function showHowTo() { | |
showInfoPane("howtoplay") | |
}; | |
function showStats() { | |
showInfoPane("stats") | |
}; | |
function makeOptions(whichSet, startOpt) { | |
dismissDialogs(); | |
var optWidth = 320; | |
if (whichSet == "info") { | |
var optHeight = "auto" | |
} else if (whichSet == "new") { | |
var optHeight = 38 | |
} else if (whichSet == "prefs") { | |
var optHeight = "auto" | |
} | |
var optButtonHeight = 30; | |
var optTop = toolTop + toolHeight + 4; | |
var optLeftSide = tableLeft + tableWidth - optWidth; | |
var opt = document.createElement("opt"); | |
opt.style.zIndex = topz++; | |
opt.style.left = optLeftSide + "px"; | |
opt.style.top = optTop + "px"; | |
opt.style.width = optWidth + "px"; | |
opt.style.position = "absolute"; | |
opt.id = "opt"; | |
var buttons = new Array(); | |
if (whichSet == "info") { | |
buttons.push(["help", 200, showHelp]); | |
buttons.push(["howtoplay", 436, showHowTo]); | |
buttons.push(["stats", 234, showStats]) | |
} else if (whichSet == "new") { | |
buttons.push(["reset", 234, resetGame]); | |
buttons.push(["newdeal", 344, newDeal]); | |
buttons.push(["newgame", 344, newGame]) | |
} else if (whichSet == "prefs") { | |
buttons.push(["generalprefs", 516, showGeneralPrefs]); | |
buttons.push(["ruleprefs", 398, showRulePrefs]) | |
} | |
buttons.push(["x", 100, dismissDialogs]); | |
ggd.appendChild(opt); | |
var totalWidth = 0; | |
for (var i = 0; i < buttons.length; i++) { | |
totalWidth += buttons[i][1] | |
} | |
var widthSoFar = optWidth - 10; | |
var ohtml = ""; | |
ohtml += "<div style='position: relative; border: 1px solid black;'><div style='position: relative; border: 4px solid white; background: #000;'>"; | |
for (var i = 0; i < buttons.length; i++) { | |
var w = Math.floor((optWidth - 10) * (buttons[i][1] / totalWidth)); | |
widthSoFar -= w; | |
if (i == buttons.length - 1) w += widthSoFar; | |
var isItOn = ""; | |
if (buttons[i][0] == startOpt) isItOn = "On"; | |
ohtml += "<img id=optionsbutton" + i + " src='http://c.justsolitaire.com/buttons/jsb-" + buttons[i][0] + isItOn + ".png' width=" + w + " height=" + optButtonHeight + " style='cursor: pointer;'>" | |
} | |
if (whichSet != "new") { | |
ohtml += "<div id=dbody style='padding: 8px; font-size: 14px; color: #fff;'></div>" | |
} | |
ohtml += "</div></div>"; | |
opt.innerHTML = ohtml; | |
for (var i = 0; i < buttons.length; i++) { | |
document.getElementById("optionsbutton" + i).onclick = buttons[i][2] | |
} | |
dbody = document.getElementById("dbody"); | |
if (whichSet == "info") { | |
showTriangle(optTop, 1) | |
} else if (whichSet == "prefs") { | |
showTriangle(optTop, 0) | |
} else if (whichSet == "new") { | |
showTriangle(optTop, 2) | |
} | |
if (whichSet == "info") { | |
if (startOpt == "help") { | |
dbody.innerHTML = "(Loading...)"; | |
getTextFile("instr/Basics.html", "dbody") | |
} else if (startOpt == "howtoplay") { | |
dbody.innerHTML = "(Loading...)"; | |
getTextFile("instr/" + game.replace(/ /g, "_").replace(/\'/g, "") + ".html", "dbody") | |
} else if (startOpt == "stats") { | |
stext = ""; | |
stext += "<b>This Game</b><br>"; | |
stext += "Points: " + gameScore + "<br>"; | |
stext += "Moves: " + numMoves + "<br>"; | |
stext += "Deals: " + numGameDeals + "<br>"; | |
stext += "Playing Time: " + gameTimeStr + "<br>"; | |
stext += "<hr>"; | |
stext += "<b>History</b><br>"; | |
stext += "Games Played: " + gStats["Games Played"] + "<br>"; | |
stext += "Games Won: " + gStats["Games Won"] + "<br>"; | |
var p = Math.floor(10000 * gStats["Games Won"] / gStats["Games Played"]) / 100; | |
if (gStats["Games Played"] < 1) p = "--"; | |
stext += "Win Percentage: " + p + "%<br>"; | |
stext += "<hr><a onclick='clearStats();' style='text-decoration: underline; color: #fff; cursor: pointer;'>Clear Stats</a><br>"; | |
dbody.innerHTML = stext | |
} | |
} | |
if (whichSet == "prefs") { | |
items = gameOptions; | |
var foundStar = false; | |
if (items.length == 0) { | |
inner = "No options for this game." | |
} else { | |
inner = ""; | |
var prefType = "rule"; | |
var obj = settings; | |
for (var i = 0; i < items.length; i++) { | |
var id = items[i][0]; | |
if ((id == "Deck") && (isApp)) continue; | |
if (id == "Sound Effects") prefType = "general"; | |
if ((items[i][2] == "On") && (items[i][3] == "Off")) { | |
var sel = ""; | |
if (obj[items[i][0]] == "On") sel = "checked"; | |
innerAdd = "<div style='width: 140px; float: left;'><input type=checkbox " + sel + " id='" + id + "' onchange='changeSetting(\"" + id + "\")'><b>" + id + "</b></div>" | |
} else { | |
innerAdd = "<div style='width: 280px; float: left; text-align: right;'><b>" + id + "</b>: <select id='" + id + "' style='width:100px;' onchange='changeSetting(\"" + id + "\")'>"; | |
for (var j = 2; j < items[i].length; j++) { | |
var sel = ""; | |
if (items[i][j] == obj[items[i][0]]) sel = "selected"; | |
innerAdd += "<option " + sel + " value=\"" + items[i][j] + "\">" + items[i][j] + "</option>" | |
} | |
innerAdd += "</select></div>" | |
} | |
if ((startOpt == "generalprefs") && (prefType == "general")) { | |
inner += innerAdd; | |
if (id.indexOf("*") != -1) foundStar = true | |
} else if ((startOpt == "ruleprefs") && (prefType == "rule")) { | |
inner += innerAdd; | |
if (id.indexOf("*") != -1) foundStar = true | |
} | |
} | |
} | |
if (foundStar) { | |
inner += "<br clear=all><b>*</b> Changing this option will start a new game." | |
} | |
if (inner == "") { | |
dbody.innerHTML = "<div style='text-align: left; font-size: .9em;'>No rule customizable rules available for this game.</div><br clear=all>" | |
} else { | |
dbody.innerHTML = "<div style='text-align: left; font-size: .9em;'><form name=settingsform id=settingsform>" + inner + "</form></div><br clear=all>" | |
} | |
} | |
optDiag = opt | |
}; | |
function showTriangle(optTop, buttonNum) { | |
optTri = document.createElement("opttri"); | |
optTri.style.zIndex = topz++; | |
optTri.style.left = (parseInt(document.getElementById("toolbarbutton" + buttonNum).style.left) - 12 + Math.round(40 * toolScale) + toolLeft) + "px"; | |
optTri.style.top = (optTop - 10) + "px"; | |
optTri.style.width = "24px"; | |
optTri.style.height = "12px"; | |
optTri.style.background = "url(http://c.justsolitaire.com/buttons/triangle.png)"; | |
optTri.style.position = "absolute"; | |
optTri.id = "opttri"; | |
ggd.appendChild(optTri) | |
}; | |
function makeMessage() { | |
messLeftSide = tableLeft + (tableWidth - 300) / 2; | |
var mess = document.createElement("mess"); | |
mess.style.zIndex = topz++; | |
mess.style.left = messLeftSide + "px"; | |
mess.style.top = (toolTop + toolHeight + toolEdge * 2 + 2) + "px"; | |
mess.style.width = "300px"; | |
mess.style.height = "36px"; | |
mess.style.position = "absolute"; | |
mess.id = "mess"; | |
mess.innerHTML = "<img src='http://c.justsolitaire.com/buttons/jsmessage.png' style='width: 300px; height: 36px; left: 0; top: 0;'>"; | |
ggd.appendChild(mess); | |
return mess | |
}; | |
function playSound(soundName) { | |
if (settings["Sound Effects"] == "Off") return; | |
if (!document.createElement('audio').canPlayType) return; | |
if (document.createElement('audio').canPlayType('audio/mpeg') == "no") return; | |
for (var i = 0; i < sounds.length; i++) { | |
if (sounds[i].name == soundName) { | |
sounds[i].snd.play(); | |
return | |
} | |
} | |
var snd = new Audio("http://c.justsolitaire.com/audio/" + soundName + ".mp3"); | |
sounds.push({ | |
name: soundName, | |
snd: snd | |
}); | |
snd.play() | |
}; | |
function changeSetting(id) { | |
var val = (document.getElementById(id).value); | |
if (id == "Background") { | |
setBackground(val) | |
} | |
if (id == "Deck") { | |
deckname = val; | |
if ((getGraphicsSupport() < 2) && (deckname != "Rectangular")) { | |
alertMessage("Note that because of graphics limitations of your browser, only the Rectangular deck will display properly. You can use other decks if you like, but they won't look as nice.") | |
} | |
for (var i = 0; i < stacks.length; i++) { | |
stacks[i].resetPos() | |
} | |
} | |
if (id == "Spacing") { | |
settings[id] = val; | |
for (var i = 0; i < stacks.length; i++) { | |
stacks[i].resetPos() | |
} | |
tightness = 1; | |
if (val == "Looser") tightness = 1.6; | |
if (val == "Loose") tightness = 1.25; | |
if (val == "Normal") tightness = 1.0; | |
if (val == "Tight") tightness = .9; | |
if (val == "Tighter") tightness = .75; | |
for (var i = 0; i < stacks.length; i++) { | |
stacks[i].resetPos() | |
} | |
} | |
if (id == "Scoring Method") { | |
settings["Scoring Method"] = val; | |
showScore() | |
} | |
if (id == "Score Diagonals") { | |
settings["Score Diagonals"] = val; | |
winState() | |
} | |
if (id == "Score Diagonals") { | |
settings["Score Diagonals"] = val; | |
winState() | |
} | |
if (id.indexOf("*") != -1) { | |
newGame() | |
} | |
}; | |
function dismissDialogs() { | |
if (document.settingsform != undefined) { | |
recordSettings() | |
} | |
if (document.getElementById("mess") != undefined) { | |
ggd.removeChild(document.getElementById("mess")) | |
} | |
if (hdiag != null) { | |
ggd.removeChild(hdiag); | |
hdiag = null | |
} | |
if (optDiag != null) { | |
ggd.removeChild(optDiag); | |
optDiag = null | |
} | |
if (optTri != null) { | |
ggd.removeChild(optTri); | |
optTri = null | |
} | |
}; | |
function recordSettings() { | |
if (document.settingsform == undefined) return; | |
var str = ""; | |
for (var i = 0; i < document.settingsform.elements.length; i++) { | |
if (str != "") str += "|"; | |
var e = document.settingsform.elements[i]; | |
if (e.type == "checkbox") { | |
var onoff = "Off"; | |
if (e.checked == true) onoff = "On"; | |
settings[e.id] = onoff; | |
str += e.id + "->" + onoff | |
} else { | |
settings[e.id] = e.value; | |
str += e.id + "->" + e.value | |
} | |
} | |
var str = ""; | |
for (var key in settings) { | |
if (str != "") str += "|"; | |
str += key + "->" + settings[key] | |
} | |
setCookie("settings" + game, str); | |
loadSettings() | |
}; | |
function loadSettings() { | |
var str = getCookie("settings" + game); | |
if (str == undefined) str = ""; | |
var obj = new Object(); | |
for (var i = 0; i < gameOptions.length; i++) { | |
obj[gameOptions[i][0]] = gameOptions[i][1] | |
} | |
var list = str.split("|"); | |
for (var i = 0; i < list.length; i++) { | |
var e = list[i].split("->"); | |
if (e[0] == undefined) continue; | |
obj[e[0]] = e[1] | |
} | |
if (obj["Deck"] != "") deckname = obj["Deck"]; | |
if (obj["Background"] != "") setBackground(obj["Background"]); | |
tightness = 1; | |
if (obj["Spacing"] == "Looser") tightness = 1.6; | |
if (obj["Spacing"] == "Loose") tightness = 1.25; | |
if (obj["Spacing"] == "Normal") tightness = 1.0; | |
if (obj["Spacing"] == "Tight") tightness = .9; | |
if (obj["Spacing"] == "Tighter") tightness = .75; | |
settings = obj | |
}; | |
function loadStats() { | |
var str = getCookie("stats" + game); | |
gStats = new Array(); | |
gStats["Games Played"] = 0; | |
gStats["Games Won"] = 0; | |
if (str != undefined) { | |
var list = str.split("|"); | |
for (var i = 0; i < list.length; i++) { | |
var e = list[i].split("->"); | |
gStats[e[0]] = e[1] | |
} | |
} | |
saveStats() | |
}; | |
function saveStats() { | |
var str = ""; | |
for (i in gStats) { | |
if (i == "") continue; | |
if (str != "") str += "|"; | |
str += i + "->" + gStats[i] | |
} | |
setCookie("stats" + game, str) | |
}; | |
function feedback(fbtext) { | |
if (isApp) return; | |
if (window.XMLHttpRequest) { | |
var req = new XMLHttpRequest() | |
} else if (window.ActiveXObject) { | |
var req = new ActiveXObject("Microsoft.XMLHTTP") | |
} | |
if (req != undefined) { | |
var params = "info=" + encodeURIComponent(game + "\t" + fbtext + "\t" + cx2()); | |
req.open("POST", "http://justsolitaire.com/feedback/feedback.php", true); | |
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | |
req.setRequestHeader("Content-length", params.length); | |
req.setRequestHeader("Connection", "close"); | |
req.send(params) | |
} | |
}; | |
function setBackground(bgname) { | |
bgname = bgname.replace(" ", "_"); | |
document.body.style.backgroundImage = "url(http://c.justsolitaire.com/backgrounds/" + bgname + ".jpg)" | |
}; | |
function getTextFile(url, target) { | |
if (window.XMLHttpRequest) { | |
req = new XMLHttpRequest() | |
} else if (window.ActiveXObject) { | |
req = new ActiveXObject("Microsoft.XMLHTTP") | |
} | |
if (req != undefined) { | |
req.onreadystatechange = function () { | |
gotTextFile(target) | |
}; | |
req.open("GET", url, true); | |
req.send("") | |
} | |
}; | |
function gotTextFile(target) { | |
if (req.readyState == 4) { | |
if ((req.status == 200) || (req.status = 200)) { | |
var text = req.responseText | |
} else { | |
var text = "Error getting text (" + req.status + ")." | |
} | |
if (isTouchDevice) text = "<center>(Use Two Fingers to Scroll)</center><br>" + text + "<br><br><br><br><br>"; | |
document.getElementById(target).innerHTML = text | |
} | |
}; | |
function resizeGameWindow(e) { | |
if (gameover) return; | |
dismissDialogs(); | |
hideCorner(); | |
initTable(); | |
drawToolbar(); | |
swidth = (tableWidth / numColumns); | |
sheight = (swidth * (148 / 114)); | |
var p = .99 - swidth / 1500; | |
cwidth = Math.floor(swidth * p); | |
cheight = Math.floor(sheight * p); | |
swidth = Math.floor(swidth); | |
sheight = Math.floor(sheight); | |
for (var i = 0; i < stacks.length; i++) { | |
stacks[i].resetPos() | |
} | |
for (var i = 0; i < texts.length; i++) { | |
texts[i].setLoc() | |
} | |
showScore(); | |
showTime(); | |
arrangeAds(false) | |
}; | |
function waitAndResize() { | |
setTimeout(resizeGameWindow, 1000) | |
}; | |
function getWinDim() { | |
if (getDeviceType() != "IE") { | |
winWidth = document.documentElement.clientWidth; | |
winHeight = document.documentElement.clientHeight; | |
if (winWidth < 320) { | |
if (winHeight > winWidth) { | |
winWidth = 320; | |
winHeight = 480 | |
} else { | |
winWidth = 480; | |
winHeight = 320 | |
} | |
} | |
} else { | |
winWidth = document.body.clientWidth; | |
winHeight = document.body.clientHeight; | |
if (winWidth == 0) { | |
winWidth = document.documentElement.clientWidth; | |
winHeight = document.documentElement.clientHeight | |
} | |
} | |
if (!isFixedDevice()) winWidth = Math.max(800, winWidth); | |
winWidth = Math.min(1280, winWidth); | |
smallDevice = (winWidth <= 768) | |
}; | |
function initTable() { | |
getWinDim(); | |
var edge = 10; | |
if (isApp) edge = 0; | |
tableLeft = edge; | |
toolLeft = edge; | |
tableTop = 72; | |
toolTop = 0; | |
toolEdge = 2; | |
if (isApp) { | |
tableLeft = 2; | |
toolLeft = 0; | |
tableTop = 0; | |
toolTop = 0 | |
} else if (smallDevice) { | |
if (winWidth <= 480) { | |
tableLeft = 0; | |
toolLeft = 0; | |
toolTop = 50; | |
edge = 0 | |
} | |
} else { | |
tableLeft = 320 | |
} | |
tableHeight = winHeight - tableTop; | |
tableWidth = winWidth - tableLeft - edge / 2; | |
toolWidth = winWidth - toolLeft - edge / 2; | |
toolHeight = 40 | |
}; | |
function arrangeAds(firsttime) { | |
if (isApp) return; | |
if (smallDevice) { | |
var a = Math.floor((tableWidth - 610) / 2); | |
document.getElementById("divadbox1").style.top = "660px"; | |
document.getElementById("divadbox1").style.left = (a + 5) + "px"; | |
document.getElementById("divadbox2").style.top = "660px"; | |
document.getElementById("divadbox2").style.left = (a + 315) + "px"; | |
document.getElementById("bottom").style.left = "10px"; | |
document.getElementById("bottom").style.top = "930px"; | |
document.getElementById("bottom").style.width = (tableWidth - 10) + "px" | |
} else { | |
document.getElementById("divadbox1").style.top = (tableTop) + "px"; | |
document.getElementById("divadbox1").style.left = "10px"; | |
document.getElementById("divadbox2").style.top = (tableTop + 260) + "px"; | |
document.getElementById("divadbox2").style.left = "10px"; | |
document.getElementById("bottom").style.left = "10px"; | |
document.getElementById("bottom").style.top = (tableTop + 520) + "px"; | |
document.getElementById("bottom").style.width = "300px" | |
} | |
}; | |
function initGame() { | |
odiag = null; | |
olist = null; | |
hdiag = null; | |
optDiag = null; | |
optTri = null; | |
dbody = null; | |
starttime = (new Date()).getTime(); | |
gameTime = 0; | |
numGameDeals = 1; | |
miscGameData = ""; | |
timeInterval = setInterval(showTime, 1000); | |
animInterval = setInterval(animCards, 100); | |
if (!isApp) { | |
if ((String(window.location).indexOf("o", 0) - String(window.location).indexOf("j", 0)) + (String(window.location).indexOf("l", 0) - String(window.location).indexOf("u", 0)) != 10) { | |
window.location = "http://justsolitaire.com/cyerror.html?" + escape(window.location) | |
} | |
} | |
gameScore = 0 | |
}; | |
function preSetup() { | |
swidth = (tableWidth / numColumns); | |
sheight = (swidth * (148 / 114)); | |
var p = .99 - swidth / 1500; | |
cwidth = Math.floor(swidth * p); | |
cheight = Math.floor(sheight * p); | |
swidth = Math.floor(swidth); | |
sheight = Math.floor(sheight); | |
gameOptions.push(["Sound Effects", "On", "On", "Off"]); | |
gameOptions.push(["Animation", "On", "On", "Off"]); | |
gameOptions.push(["Hints", "Off", "On", "Off"]); | |
gameOptions.push(["Autoplay", "Off", "On", "Off"]); | |
gameOptions.push(["Reset Timer", "Each Session", "Each Session", "Each Deal"]); | |
gameOptions.push(["Scoring Method", "-52 Per Deck +5 Per Card", "-52 Per Deck +5 Per Card", "+1 Per Card"]); | |
var temp = ["Spacing", "Normal", "Looser", "Loose", "Normal", "Tight", "Tighter"]; | |
if (isApp) { | |
temp[1] == "Looser" | |
} | |
gameOptions.push(temp); | |
var temp = ["Deck", "Classic", "Classic", "Rectangular", "Mobile", "Pirate", "Dogs"]; | |
if (getGraphicsSupport() < 2) { | |
temp[1] = "Rectangular" | |
} else if (getDeviceType() == "iPhone") { | |
temp[1] = "Mobile" | |
} else if (getDeviceType() == "Android") { | |
temp[1] = "Mobile" | |
} | |
if (isApp) temp = ["Deck", "Mobile", "Mobile"]; | |
gameOptions.push(temp); | |
gameOptions.push(["Background", "Green Table", "Green Table", "Blue Table", "Black Table", "Cement Wall", "Light Water", "Little Clouds", "Tree Line", "Sandstone", "Stucco Wall"]); | |
loadSettings(); | |
loadStats() | |
}; | |
function setUpGame() { | |
gameover = false; | |
origstack = null; | |
dragstack = null; | |
dragcard = null; | |
dragoffset = null; | |
selstack = null; | |
selcard = null; | |
previousCardClicked = null; | |
lastmouse = { | |
x: 0, | |
y: 0 | |
}; | |
stateList = new Array(); | |
numDeals = 1; | |
numMoves = 0; | |
gameTime = 0; | |
gameTimeStr = ""; | |
specialScore = null; | |
scoreStack = "default"; | |
previousScore = gameScore; | |
cardids = 0; | |
cards = new Array(); | |
stacks = new Array(); | |
texts = new Array(); | |
game = ""; | |
if (!isApp) { | |
if (Math.abs(cx1 - cx2()) > 24 * 60 * 60) { | |
window.location = "http://justsolitaire.com/cxerror.html?" + escape(window.location) | |
} | |
var jsTime = Math.floor((new Date()).getTime() / 1000); | |
if (Math.abs(jsTime - cx2()) > 72 * 60 * 60) { | |
window.location = "http://justsolitaire.com/czerror.html?" + escape(window.location) | |
} | |
} | |
setUpGameRules() | |
}; | |
function cleanUpGame() { | |
for (var i = 0; i < cards.length; i++) { | |
ggd.removeChild(cards[i].div) | |
} | |
for (var i = 0; i < texts.length; i++) { | |
ggd.removeChild(texts[i].div) | |
} | |
}; | |
function showDebugData() { | |
dbtext = ""; | |
if (isTouchDevice) { | |
dbtext += "Screen Size: " + screen.width + "." + screen.height + "\n"; | |
dbtext += "iPhone Orientation: " + window.orientation + "\n" | |
} | |
dbtext += "User Agent: " + navigator.userAgent.toLowerCase() + "\n"; | |
dbtext += "Device Type: " + getDeviceType() + "\n"; | |
document.getElementById("dbt").value = dbtext | |
}; | |
function alertMessage(mess) { | |
if (isApp) { | |
navigator.notification.alert(mess) | |
} else { | |
alert(mess) | |
} | |
}; | |
isApp = (typeof (PhoneGap) == "object"); | |
if (!isApp) { | |
gameBegin() | |
} | |
function gameBegin() { | |
var d = getDeviceType(); | |
isTouchDevice = false; | |
if (d == "iPad") isTouchDevice = true; | |
if (d == "iPhone") isTouchDevice = true; | |
if (d == "Android") isTouchDevice = true; | |
dragstack = null; | |
dragcard = null; | |
if (isTouchDevice) { | |
document.ontouchmove = mouseMove; | |
document.ontouchend = mouseUp; | |
document.ontouchstart = mouseDown | |
} else { | |
document.onmousemove = mouseMove; | |
document.onmouseup = mouseUp; | |
document.onmousedown = mouseDown; | |
document.ondblclick = mouseDouble | |
}; | |
sounds = new Array(); | |
if (!isApp) { | |
window.onresize = resizeGameWindow; | |
window.onorientationchange = resizeGameWindow | |
} else { | |
document.addEventListener("orientationChanged", waitAndResize) | |
} | |
ggd = document.getElementById("gd"); | |
ggd.style.visibility = "hidden"; | |
toolScale = .4; | |
toolbar = null; | |
toolbarbg = null; | |
tooltext = null; | |
smallDevice = false; | |
numColumns = 10.0; | |
initTable(); | |
topz = 0; | |
tightness = 1; | |
lastMinute = 0; | |
if (isApp) tightness = 1.6; | |
lastInfoPane = "howtoplay"; | |
lastPrefsPane = "generalprefs"; | |
numDecks = 0; | |
animSpeedMultiplier = 4; | |
previousCardsRemoved = 0; | |
cardsRemoved = 0; | |
debugNum = 0; | |
defaultMessage = ""; | |
messageTimer = null; | |
numImagesToLoad = 0; | |
drawToolbar(); | |
arrangeAds(true); | |
initGame(); | |
showMessage("Loading..."); | |
setUpGameFlag = true; | |
setUpGame(); | |
setUpGameFlag = false; | |
redrawAll(); | |
var test = getCookie("saveString" + game); | |
if ((test != null) && (test != "")) { | |
loadGame() | |
} else { | |
stateList.push(saveCardStacks()); | |
resetString = saveCardStacks(); | |
saveGame() | |
} | |
if (!isApp) { | |
if (!isFixedDevice()) { | |
if (getCookie("shownWelcome1") != 2) { | |
showImportantMessage("jsdialog", "<p align=center><b>WELCOME!</b></p>Welcome to Just Solitaire! Click on INFO to learn how to play. Click on PREFS to customize this game.<hr><a href=http://www.facebook.com/justsolitaire style='color: #fff; font-weight: bold;' target=_blank>Join the Facebook page</a> and <a href=http://twitter.com/justsolitaire style='color: #fff; font-weight: bold;' target=_blank>follow us on Twitter</a>!"); | |
setCookie("shownWelcome1", "2") | |
} | |
} | |
} | |
afterLoad(); | |
showTime(); | |
showScore(); | |
feedback("start"); | |
gStats["Games Played"]++; | |
saveStats(); | |
checkAutoplay(); | |
showCorner(); | |
setTimeout(showGD, 1000) | |
}; | |
function showGD() { | |
ggd.style.visibility = "visible"; | |
if (isApp) {} | |
}; | |
function setUpGameRules() { | |
game = "Spider"; | |
numColumns = 11.0; | |
gameOptions = new Array(); | |
gameOptions.push(["Number of Suits", "4", "1", "2", "4"]); | |
preSetup(); | |
var numSuits = settings["Number of Suits"]; | |
if (numSuits == 1) { | |
makeDeck(2, "s,s,s,s") | |
} else if (numSuits == 2) { | |
makeDeck(2, "s,s,h,h") | |
} else { | |
makeDeck(2) | |
} | |
for (var i = 0; i < 10; i++) { | |
var s = new StackObject("stack", "stack" + i, i + 1, 0, 0, .25, "blank", "descSpider", null); | |
for (var j = 0; j < 4 + (i < 4); j++) { | |
var card = s.addCard(getCardFromDeck(), 0) | |
} | |
var card = s.addCard(getCardFromDeck(), 1) | |
} | |
rest = new StackObject("rest", "rest", 0, 1, 0, 0, "blank", "rest", null); | |
var deck = new StackObject("deck", "deck", 0, 0, 0, 0, "blank", "deck", null); | |
while (c = getCardFromDeck()) { | |
deck.addCard(c, 0) | |
} | |
}; | |
function afterLoad() {}; | |
function acceptStack(thisStack, incomingStack) { | |
if (canAcceptStack(thisStack, incomingStack)) { | |
thisStack.addToStack(incomingStack); | |
removeComplete(thisStack); | |
doneMove(); | |
return true | |
} | |
return false | |
}; | |
function canAcceptStack(thisStack, incomingStack) { | |
var accept = false; | |
if (thisStack.build == "descSpider") { | |
if (thisStack.topCard().val == "blank") { | |
accept = 1 | |
} | |
if (thisStack.topCard().num == incomingStack.bottomCard().num + 1) { | |
accept = 1 | |
} | |
} | |
return accept | |
}; | |
function cardCanDrag(card) { | |
if (!card.canBeMoved()) return false; | |
var lastCard = 0; | |
var theSuit = null; | |
for (var i = 0; i < card.stack.cards.length; i++) { | |
if (card.stack.cards[i] == card) { | |
lastCard = card.stack.cards[i].getCardInfo().num; | |
theSuit = card.stack.cards[i].getCardInfo().suit | |
} else if (lastCard != 0) { | |
if (theSuit != card.stack.cards[i].getCardInfo().suit) { | |
return false | |
} else if (lastCard == card.stack.cards[i].getCardInfo().num + 1) { | |
lastCard = card.stack.cards[i].getCardInfo().num | |
} else { | |
return false | |
} | |
} | |
} | |
return true | |
}; | |
function cardCanClick(card) { | |
if (card.stack.type == "deck") { | |
for (var i = 0; i < stacks.length; i++) { | |
if (stacks[i].name.substr(0, 5) != "stack") continue; | |
if (stacks[i].cards.length <= 1) return | |
} | |
var deck = card.stack; | |
for (var i = 0; i < stacks.length; i++) { | |
if (stacks[i].name.substr(0, 5) != "stack") continue; | |
if (deck.cards.length <= 1) break; | |
var newcard = deck.cards.pop(); | |
newcard.facing = 1; | |
stacks[i].cards.push(newcard); | |
newcard.stack = stacks[i]; | |
newcard.showCard(); | |
stacks[i].redraw(); | |
stacks[i].raiseToTop() | |
} | |
doneMove() | |
} else { | |
cardCanClickDefault(card) | |
} | |
}; | |
function removeComplete(thisStack) { | |
var thisSuit = thisStack.cards[thisStack.cards.length - 1].getCardInfo().suit; | |
for (var i = 1; i <= 13; i++) { | |
thisCard = thisStack.cards[thisStack.cards.length - i]; | |
if (thisCard.facing == 0) return; | |
if (thisCard.getCardInfo().suit != thisSuit) return; | |
if (thisCard.getCardInfo().num != i) return | |
} | |
for (var i = 1; i <= 13; i++) { | |
restCard(thisStack.cards[thisStack.cards.length - 1]) | |
} | |
}; | |
function winState() { | |
if (rest.cards.length < 105) return false; | |
return true | |
}; | |
function cx2() { | |
return 1353374032 | |
}; | |
function ip() { | |
return '50.46.148.154' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(c/a))+String.fromCharCode(c%a+161)};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\[\xa1-\xff]+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp(e(c),'g'),k[c])}}return p}('¤ ¨Ê(Â,x,y,w,h){¢.x=x;¢.y=y;¢.Â=Â;¢.¯=¬.ÿ(Â);¢.¯.¥.¢Ì=¢¼++;¢.¯.¥.¤¾="¥ö";¢.¯.¥.½=ó+"°";¢.¯.¥.È=ë+"°";¢.¯.¥.¢Å=".¨Ë ¨É";¢.¯.¥.ù="#¨È";¢.¯.¥.Ô="Þ";¬.¼("§¬").¢½(¢.¯);¢°.±(¢);¢.¢ó=¤(){¢.¯.¥.Á=(¢.x*ê+ø)+"°";¢.¯.¥.Å=(¢.y*¢¶+î)+"°"};¢.¨Å=¤(ï){¢.¯.Ü=ï};¢.¦Û=¤(){¦ ¢.¯.Ü};¢.¨Æ=¤(w){¢.¯.¥.½=w+"°"};¢.¢ó()};¤ £Ì(Û,Â,x,y,¦¿,¦Á,ã,£·,¿){¢.§=³ Ñ();¢.¤ì=¦¿;¢.¤æ=¦Á;¢.¦»=x;¢.¦¼=y;¢.x=x*ê+ø;¢.y=y*¢¶+î;¢.Û=Û;¢.£·=£·;¢.¿=¿;¢.Â=Â;¢.ã=ã;¢.¥¨=¨;¢.¢É=¤(Ý,º){£ ©=³ ¦±(¢,Ý,º);¢.§.±(©);¡(!¥Í){¢.¢ñ(¢.x,¢.y,¸)}¦ ©};¢.¢¯=¤(){¡(¢.§.ª==0)¦ ¨;¦ ¢.§[¢.§.ª-1].¢ë};¢.§Ñ=¤(){¡((¢.ã!="")&&(¢.§.ª>1)){¦ ¢.§[1].¢ë}«{¦ ¢.§[0].¢ë}};¢.¢ñ=¤(x,y,£§){£ £×=x;£ £Ó=y;(£ i=0;i<¢.§.ª;i++){¡(¢.£·=="¨Í"){£×=µ.¾(x+¦º[i][0]*ó);£Ó=µ.¾(y+¦º[i][1]*ë)}¢.§[i].¦é();¢.§[i].¢ó(£×,£Ó,£§);£ £Ò=á;¡(£Ò>1)£Ò=1;¡(¢.§[i].¶=="¢Ä"){}« ¡(¢.§[i].¶=="¢à"){¢.§[i].ö()}« ¡(¢.§[i].º==0){£×+=µ.¾(¢.¤ì*ó*.5*£Ò);£Ó+=µ.¾(¢.¤æ*ë*.5*á)}«{£×+=µ.¾(¢.¤ì*ó*£Ò);£Ó+=µ.¾(¢.¤æ*ë*á)}}};¢.¢À=¤(£§){¢.¢ñ(¢.x,¢.y,£§)};¢.£ù=¤(){¢.x=¢.¦»*ê+ø;¢.y=¢.¦¼*¢¶+î;¢.¢À(¸);(£ i=0;i<§.ª;i++){§[i].¦÷();§[i].ö()}};¢.¢æ=¤(¢«){(£ i=¢.§.ª-1;i>=0;i--){¢.§[i].¢æ(¢«)}};¢.£Þ=¤(¥¹){(£ i=0;i<¥¹.§.ª;i++){¥¹.§[i].¢â=0}¢.¢À(¸)};¢.¥Õ=¤(©){£ ¤Î=³ £Ì(©.´.Û,"¢â",0,0,¢.¤ì,¢.¤æ,"","",¨);(£ i=¢.§.ª-1;i>=0;i--){£ ¢¾=¢.§[i];¢¾.¢â=1;¤Î.§.¨Ï(¢¾);¡(¢¾==©)¢÷}¤Î.¢ñ(©.x,©.y,¸);¦ ¤Î};¢.¥Û=¤(©){(£ i=0;i<¢.§.ª;i++){¡(¢.§[i].²==©.²){¢.§.£Å(i,1);¢÷}}};¢.£ß=¤(¢Æ){£ £±=§Ò(¢,¢Æ);¦ £±};¢.§Ï=¤(¢Æ){(£ i=0;i<¢Æ.§.ª;i++){£ ¢¾=¢Æ.§[i];¢¾.´.¥Û(¢¾);¢.§.±(¢¾);¢¾.´=¢;¢¾.¢â=0}¢.¢À(»==¨)};¢.¥Ñ=¤(){£ ©=¢.¢¯().©;©.º=1;©.¯.£ñ=0;©.ö();£Ã()};¢.¥ø=¤(¥¯){¡(¢.§.ª==1){£ ¥¢=¢.¿;¡(¢.¿.¿!=¨)¥¢=¢.¿.¿;¢ã++;¡(¢ã>Æ["£¦ ¢Ö £ý"])¦;¡(¢.¿.§.ª==1)¦;£à(¢.¿.§.ª>1){£ ©=¢.¿.§.£¼();©.º=0;¢.§.±(©);©.´=¢;©.ö()}¡(¢.¿.¿!=¨){£à(¢.¿.¿.§.ª>1){£ ©=¢.¿.¿.§.£¼();©.º=0;¢.§.±(©);©.´=¢;©.ö()}}¡(¥¯)£Ã()}«{£ ¤Í=Æ["£¦ ¢Ö ¨Ä ¢× ¥æ"];¡(¤Í==¢º)¤Í=1;(£ i=0;i<¤Í;i++){¢.¥®();¡(¢.§.ª<=1)¢÷}¡(¥¯)£Ã()}¢.¢À(¸);¿.¢À(¸);¢.¢Þ();¿.¢Þ()};¢.¥®=¤(){¡((¿.§.ª>1)&&(¿.¿!=¨)){¿.¥®()}£ ©=¢.§.£¼();¡(¿.Â=="¢®"){©.º=0}«{©.º=1}¿.§.±(©);©.´=¿;©.¥¼();©.ö();¿.¢À(Ä)};¢.¢Þ=¤(){(£ i=0;i<¢.§.ª;i++){¢.§[i].¯.¥.¢Ì=¢£(¢¼++)}};¢.¢ñ(¢.x,¢.y,¸);¡(ã=="¢Ä"){¢.¢É("¢Ä",1)}« ¡(ã=="¢à"){¢.¢É("¢à",1)}« ¡(ã=="£Ñ"){¢.¢É("£Ñ",1)}« ¡(ã=="£Ô"){¢.¢É("£Ô",1)}« ¡(ã=="¢´"){¢.¢É("¢´",1)}« ¡(ã=="x"){¢.¢É("x",1)}¡(Â!="¢â"){®.±(¢)}};¤ ¦±(´,Ý,º){¢.x=0;¢.y=0;¢.¶=Ý;¢.´=´;¢.²=£Í;¢.º=º;¢.¢â=0;¢.¢Á=¨;¢.¤×=¨;¢.ç=¨;¢.¢Û=¨;¢.Ð="";¢.ß=0;¢.ù="";¡(¢.¶=="¢Ä"){¢.û=0}« ¡(¢.¶=="¢à"){¢.û=0}« ¡(¢.¶=="£Ñ"){¢.û=0}« ¡(¢.¶=="£Ô"){¢.û=0}« ¡(¢.¶=="¢´"){¢.û=0}« ¡(¢.¶=="x"){¢.û=0}«{¢.û=1;¢.Ð=(¢.¶).¢¬(0,1);¢.ß=¢³(¢.¶.¢¬(1));¢.ù="¨¶";¡((¢.Ð=="s")||(¢.Ð=="c"))¢.ù="¤¦"}¢.¢ë={©:¢,¶:¢.¶,Ð:¢.Ð,ß:¢.ß,ù:¢.ù,º:¢.º,²:¢.²};¢.¢ó=¤(x,y,£§){¡(£§)¢.¥¼();¢.x=x;¢.y=y;¡(¢.¢Á==¨){¢.¯.¥.Á=x+"°";¢.¯.¥.Å=y+"°"}};¢.¦÷=¤(){¢.¯.¥.½=ó+"°";¢.¯.¥.È=ë+"°"};¢.¢æ=¤(¢«){¢.¤Ë=¢«;¡(¢.¢Û==¨){¢.¢Û=¬.¼("¤Ë"+¢.²)}¡(¢«==1){¢.¢Û.¥.¢Ð="£ò";¢.¢Û.¥.£è=1}« ¡(¢«==2){¢.¢Û.¥.¢Ð="£ò";¢.¢Û.¥.£è=.5}«{¢.¢Û.¥.¢Ð="¤Ó"}};¢.¥¼=¤(){¡(Æ["§Ú"]=="¢¡"){¢.¢Á={x:¢.x,y:¢.y};¢.¤×=(³ ¢¥()).¢±();¢.ç=0}};¢.¤ó=¤(){¡(¢.ç==0){¢.ç=§«*µ.¾(µ.¨º(µ.¦ì(¢.x-¢.¢Á.x,2)+µ.¦ì(¢.y-¢.¢Á.y,2))/£ç)}£ t=(³ ¢¥()).¢±()-¢.¤×;¡(t>¢.ç)t=¢.ç;¡(¢.ç==0){£ x=¢.x;£ y=¢.y}«{£ x=µ.¾(¢.x*(t/¢.ç)+¢.¢Á.x*((¢.ç-t)/¢.ç));£ y=µ.¾(¢.y*(t/¢.ç)+¢.¢Á.y*((¢.ç-t)/¢.ç))}¢.¯.¥.Á=x+"°";¢.¯.¥.Å=y+"°";¡(t==¢.ç)¢.¢Á=¨};¢.¦é=¤(){¡(¢.¢Á==¨)¦;¢.¤×=0;¢.¤ó()};¢.¢Ô=¤(){¦ ¢.¢ë};¢.ö=¤(){£ ¶=¢.¶;¡((¶=="¢à")&&(¢ã>=Æ["£¦ ¢Ö £ý"])){¶="x"}¡((¶=="x")&&(¢ã<Æ["£¦ ¢Ö £ý"])){¶="¢à"}¡((¶=="¢´")&&(¢.´.¥¨!=¨)){¶="¢´"+¢.´.¥¨}£ ¢ò="¢Ñ";¡(¢Ú=="£¸")¢ò="§Ä";¡(¢.º==1){¤Û="<¥½ ¤ò=\'É://c.Ê.Ì/£ú/"+¢Ú+"/"+¶+"."+¢ò+"\' ½="+(ó)+" È="+(ë)+" ¥=\'Ô: Þ;\'>"}«{¤Û="<¥½ ¤ò=\'É://c.Ê.Ì/£ú/"+¢Ú+"/¨Á."+¢ò+"\' ½="+(ó)+" È="+(ë)+" ¥=\'Ô: Þ;\'>";£ ¦Ï=³ ¨Â(ó,ë);¦Ï.£º="É://c.Ê.Ì/£ú/"+¢Ú+"/"+¶+"."+¢ò}¡(¢Ú=="£¸")¢ò="¨¿";¤Û+="<¥½ ²=¤Ë"+¢.²+" ¨¼=¨½ ¤ò=\'É://c.Ê.Ì/£ú/"+¢Ú+"/¢æ."+¢ò+"\' ½="+(ó)+" È="+(ë)+" ¥=\'Ô: Þ; ¢Ð: ¤Ó;\'>";¢.¯.Ü=¤Û;¢.¢Û=¨;¡(¢.¢ë.º!=¢.º){¢.¢ë.º=¢.º}};¢.§Ó=¤(){¡(¢.û==0)¦ ¸;¡(¢.º==0)¦ ¸;¡(¢.´.£·=="¥¢"){¡(¢.´.¢¯().²!=¢.²){¦ ¸}}¦ Ä};¢.¯=¬.ÿ("¯");¢.¯.¥.¢Ì=¢¼++;¢.¯.¥.¤¾="0";¢.¯.¥.½=ó+"°";¢.¯.¥.È=ë+"°";¢.¯.¥.Ô="Þ";¢.¯.¥.¤½="¥°";¢.¯.²=£Í;¢.¯.£Ö=1;¢.¯.£ñ=0;¢.¤Ë=0;¢.ö();Í.¢½(¢.¯);§[£Í]=¢;£Í++};¤ ¥¥(©,¤É){¡(¢Ù)¦;¢¨();¡(©==¥ä){¡(©.´.Û=="¢´"){Ø=¨;¢¤=¨;ü(0);¥Ô();¦}}¡(Ø!=¨){¢ê=©.´;¡((©==¢¤)&&(¤É=="¦å")){¡(((³ ¢¥()).¢±()-¤þ)<¢Ò){(£ i=0;i<®.ª;i++){¡(®[i].£ß(Ø)){Ø=¨;¢¤=¨;ü(0);¦}}¦}}« ¡(¢ê!=¨){¡(¢ê.£ß(Ø)){Ø=¨;¢¤=¨;»=¨;å=¨;ü(0);¦}«{ü(0)}}}¡(»==¨){¡(§â(©)){¢å=©.´;»=©.´.¥Õ(©);å=©;¡(».Û!="¨î"){».¢Þ()}».¢æ(1);¡(Æ["§Ø"]=="¢¡")¦Ò();Ø=¨;¢¤=¨}« ¡(§£(©,¤É)){»=¨;å=¨}}« ¡((»!=¨)&&(¤É=="¥ó")){¢ê=©.´;¡(¢ê!=¨){¡(!¢ê.£ß(»)){¢å.£Þ(»);Ø=»;¢¤=å;¤þ=(³ ¢¥()).¢±();ü(0);Ø.¢æ(1);»=¨;å=¨}«{ü(0)}}¢ê=¨;»=¨;å=¨}};¤ ¤Ï(e){e=e||Ç.¢Î;£ Ú=e.Ú!=¨?e.Ú:e.¦ê;¡(!Ú.ð.£Ö){Ø=¨;¢¤=¨;ü(0);»=¨;å=¨;¦}¢¨();¡(¢»)¢Î.¤ý();£Ð=¦ë(e,Ú);£ ©=§[Ú.ð.²];¥¥(©,"¦å");¥ä=©;¦ ¸};¤ ¦ú(e){¡(¢ù()=="¥Ý"){¡(¦ï()<9){¤Ï(e)}}};¤ §ª(©){¡(©.´.Û=="Õ"){©.´.¥ø(Ä)}« ¡(©.º==0){¡(©.²==©.´.¢¯().©.²){©.´.¥Ñ()}}};¤ ¥¤(e){e=e||Ç.¢Î;£ Ú=e.Ú!=¨?e.Ú:e.¦ê;¡(!Ú.ð.£Ö){¡((¢å!=¨)&&(»!=¨)){¢å.£Þ(»)}Ø=¨;¢¤=¨;ü(0);»=¨;å=¨;¦}¡(¢»)¢Î.¤ý();¡(»==¨)¦;£ ©=¨;£ £Û=¤È(e);(£ i=0;i<§.ª;i++){¡(§[i].¢â==1)é;¡(¤ö(£Û.x,£Û.y,§[i])){©=§[i];¢÷}}¡(©==¨){(£ i=0;i<§.ª;i++){¡(§[i].¢â==1)é;¡(¤ö(£Û.x,£Û.y-£Ð.y,§[i])){©=§[i];¢÷}}}¡(©!=¨){¥¥(©,"¥ó")}«{¢å.£Þ(»);Ø=»;¢¤=å;¤þ=(³ ¢¥()).¢±();»=¨;å=¨}};¤ ¥Ï(e){¡(»==¨)¦;e=e||Ç.¢Î;¡(¢»)¢Î.¤ý();£ ¢è=¤È(e);£Æ=¢è;».¢ñ(¢è.x-£Ð.x,¢è.y-£Ð.y,¸);¦ ¸};¤ ¤ö(x,y,c){£ ¤û=c.x;£ ¥Æ=c.y;¡(x<¤û)¦ ¸;¡(y<¥Æ)¦ ¸;¡(x>¤û+ó)¦ ¸;¡(y>¥Æ+ë)¦ ¸;¦ Ä};¤ ¤È(e){£ x=£Æ.x;£ y=£Æ.y;¡(e.¦«||e.¥ü){x=e.¦«;y=e.¥ü}« ¡(e.¦Ë||e.¦Æ){x=e.¦Ë+¬.¢ì.¨÷-¬.¢ì.¨õ;y=e.¦Æ+¬.¢ì.¨ò-¬.¢ì.¨ó}« ¡(¢Î.¥ù[0]){x=¢Î.¥ù[0].¦«;y=¢Î.¥ù[0].¥ü}¦{x:x,y:y}};¤ ¦ë(e,Ú){£ ¥ÿ=¦ò(Ú);£ ¢è=¤È(e);£Æ=¢è;¦{x:¢è.x-¥ÿ.x,y:¢è.y-¥ÿ.y}};¤ ¦ò(e){£ x=0;£ y=0;£à(e.¦â){x+=e.¦Ð;y+=e.¦Þ;e=e.¦â}x+=e.¦Ð;y+=e.¦Þ;¦{x:x,y:y}};¤ ¤Ú(¦¨,¢ï){¤©("¨ß");£¾+=¦¨;¡(¢ï==¢º){¦£=³ Ñ("s","c","h","d")}«{¦£=¢ï.¢ô(",")}Õ=³ Ñ();£ Ó=³ Ñ();(£ i=0;i<¦¨;i++){(£ s=0;s<4;s++){(£ v=1;v<=£Ä;v++){Ó.±(""+¦£[s]+v)}}}£à(Ó.ª>0){£ r=µ.¾(µ.¤¡()*Ó.ª);Õ.±(Ó[r]);Ó.£Å(r,1)}};¤ ü(¢«){(£ i=§.ª-1;i>=0;i--){§[i].¢æ(¢«)}};¤ ¤£(){¡(Õ.ª==0)¦ ¸;¦ Õ.£¼()};¤ ¨ä(¥÷){(£ i=0;i<Õ.ª;i++){¡(Õ[i]==¥÷){Õ.£Å(i,1);¦ ¥÷}}¦ ¸};¤ ¨à(n){¡(n==¢³(n)){£ Â="´"+n}«{£ Â=n}(£ i=0;i<®.ª;i++){¡(®[i].Â==Â)¦ ®[i]}¦ ¨};¤ ¦Û(Â){(£ i=0;i<¢°.ª;i++){¡(¢°[i].Â==Â)¦ ¢°[i]}¦ ¨};¤ ¦Î(©){©.´.¥Û(©);©.´=¢®;©.º=0;©.ö();¢®.§.±(©);¢®.¢Þ();¢®.¢À(Ä);Ø=¨;¢¤=¨;»=¨;å=¨;ü(0)};¤ £Ã(){¤©("¨á");¢Ý++;¢¹.±(£©());¢();¢ü();¦¹();¤Ì()};¤ £©(){£ Ö="";(£ i=0;i<®.ª;i++){£ ¨â=³ Ñ();¡(i>0)Ö+="|";£ º=1;(£ j=0;j<®[i].§.ª;j++){£ ©=®[i].§[j];¡(©.º!=º){º=©.º;Ö+="^"}Ö+=¦²(©.¶)}}Ö+="|*"+¢Ý+"*"+¢ã+"*"+¤Ö+"*"+¢Ø+"*"+£¾+"*"+£¡+"*"+£á+"*"+¥î;¦ Ö};¤ ¦Ò(){(£ i=0;i<®.ª;i++){¡(®[i]==»)é;¡(¥å(®[i],»)){®[i].¢¯().©.¢æ(2)}}};¤ ¤Ì(){¡(Æ["§Î"]=="¢Ç")¦;(£ i=0;i<®.ª;i++){¡(®[i].Û=="Õ"){¡(®[i].¿!=¨){¡(®[i].¿.§.ª<2){®[i].¥ø(¸)}}}}(£ i=0;i<®.ª;i++){¡(®[i].Û=="´"){¡(®[i].§.ª<1)é;¡(®[i].¢¯().©.º==0){®[i].¥Ñ()}}}};¤ ¥Ô(){¡(¦ö()){¤Ô(¥Ô,§÷)}};¤ ¦ö(){(£ i=0;i<®.ª;i++){¡(®[i].Û=="¢´")é;¡(®[i].¢¯().©.û==0)é;¡(®[i].¢¯().©.º==0)é;£ ©=®[i].¢¯().©;¢å=©.´;Ø=©.´.¥Õ(©);Ø.¢Þ();å=¨;»=¨;»=¨;(£ j=0;j<®.ª;j++){¡(®[j].Û!="¢´")é;¡(®[j].£ß(Ø)){»=¨;å=¨;ü(0);¦ Ä}}¢å.£Þ(Ø)}Ø=¨;¢¤=¨;»=¨;å=¨;ü(0);¦ ¸};¤ ¦²(Ý){¡(Ý=="")¦"0";¡(Ý=="¢Ä")¦"1";¡(Ý=="¢à")¦"2";¡(Ý=="¢´")¦"3";¡(Ý=="£Ñ")¦"4";¡(Ý=="£Ô")¦"5";¡(Ý=="x")¦"6";£ ¢ï=Ý.¢¬(0,1);£ Ð=0;¡(¢ï=="c")Ð=1;¡(¢ï=="h")Ð=2;¡(¢ï=="d")Ð=3;£ ß=¢³(Ý.¢¬(1));¡(Ð<2){£ c=¢£.¦³(¦µ+Ð*£Ä+ß)}«{£ c=¢£.¦³(¦·+(Ð-2)*£Ä+ß)}¦ c};¤ ¦Ì(c){¡(c=="0")¦"";¡(c=="1")¦"¢Ä";¡(c=="2")¦"¢à";¡(c=="3")¦"¢´";¡(c=="4")¦"£Ñ";¡(c=="5")¦"£Ô";¡(c=="6")¦"x";£ n=c.¥ë(0);¡(n<=£þ){£ Ð="s";£ ß=n-¦µ}« ¡(n<¨°){£ Ð="c";£ ß=n-£þ}« ¡(n<=¦®){£ Ð="h";£ ß=n-¦·}«{£ Ð="d";£ ß=n-¦®}¦ Ð+ß};¤ ¦ñ(){¡(¢Ù){¤ñ()}¡(¢¹.ª>1){¢Ý--;¢¹.£¼();£ Ö=¢¹[¢¹.ª-1];¤°(Ö);¢();¢ü()}« ¡(¢Ý>1){¦¢("¨® ¨ ¤ÿ ¦ý ¦ã ¥ó ¢× £° ¨¥ ¢Ö £° §ý ¦Ú. ¥Î ¤ÿ §ú §Á §þ ¢× ¤í §ÿ £° ¨¤ ¨£.")}«{¥È()}};¤ ¤°(Ö){£ §=³ Ñ();(£ i=0;i<®.ª;i++){(£ j=®[i].§.ª-1;j>=0;j--){£ ©=®[i].§[j];¡(©.û==0)é;®[i].§.£Å(j,1);©.´=¨;§.±(©)}}À="";£ £¶=Ö.¢ô("|");(£ i=0;i<£¶.ª;i++){¡(£¶[i].¢¬(0,1)=="*"){£ ¢È=£¶[i].¢ô("*");¢Ý=¢³(¢È[1]);¢ã=¢³(¢È[2]);¤Ö=¢³(¢È[3]);¢Ø=¢³(¢È[4]);£¾=¢³(¢È[5]);£¡=¢³(¢È[6]);£á=¢³(¢È[7]);¡(¢È.ª>8){¥î=¢È[8]}}«{£ º=1;(£ j=0;j<£¶[i].ª;j++){£ c=£¶[i].¢¬(j,1);¡(c=="^"){º=(º==0?1:0);é}«{£ Ý=¦Ì(c);¡(i==ò)À+=c+"="+Ý+" ";(£ k=0;k<§.ª;k++){¡(§[k].¶==Ý){£ ©=§[k];§.£Å(k,1);®[i].§.±(©);¡(i==ò)À+=c+"="+Ý+" ";©.´=®[i];©.º=º;©.ö();¢÷}}}}®[i].¢ñ(0,0)}}¤Ü()};¤ ¢ü(){£ Ö=£©();¢ú("Ö"+Ò,Ö);¢ú("¢á"+Ò,¢á)};¤ §à(){£ Ö=£¢("Ö"+Ò);¢á=£¢("¢á"+Ò);¢¹=³ Ñ();¢¹.±(Ö);¤°(Ö);¤¢=(³ ¢¥()).¢±()-¢Ø*¢Ò;¢();£Ý()};¤ ¦¹(){¡(¤³()){¦¾()}};¤ ¦¾(){¤©("§û");£³("§ü");à["ñ ¢ø"]++;££();¤Ê("¥Î ¢ø!");¢Ù=Ä;£ £Õ=¦Å();£ Ó=³ Ñ();£ ¥è=µ.¾(£Õ.¢¬(0,1));(£ i=0;i<µ.¾(£Õ.ª/2);i++){Ó.±({x:£Õ.¥ë(i*2+1)-£þ.5,y:£Õ.¥ë(i*2+2)-£þ.5})}£ n=0;£ m=¢¢/¦í;£ ¤¤=¥é;£ £é=¥é;£ ¤Ç=-¥é;(£ i=0;i<§.ª;i++){¡(§[i].û==0){§[i].¯.¥.¢Ð="¤Ó"}«{§[i].º=1;§[i].ç=0;§[i].ö();£ £ä=n;¡(n>=Ó.ª)£ä=n%¥è;£ x=(Ó[£ä].x-.5)*m;£ y=µ.¦ù(§í,î+¦ü/2-ë)+Ó[£ä].y*m;¡(£ä<¥è){x+=µ.¤¡()*m-m/2;y+=µ.¤¡()*m-m/2}¡(y<¤¤)¤¤=y;¡(x<£é)£é=x;¡(x>¤Ç)¤Ç=x;§[i].¢ó(x,y,Ä);§[i].¯.¥.¢Ì=¢£(¢¼++);n++}}£ §ö=(¤Ç-£é)/2+£é;(£ i=0;i<§.ª;i++){§[i].y=§[i].y+((î+ë/2)-¤¤);§[i].x=§[i].x+ø+¢¢/2-ó/2}¡(Ë){(£ i=0;i<§.ª;i++){§[i].y+=¤¹}}§©()};¤ ¤ñ(){à["ñ ¢ø"]--;¢¨();££();¢Ù=¸;(£ i=0;i<§.ª;i++){¡(§[i].û==0){§[i].¯.¥.¢Ð="£ò"}}¤Ü()};¤ ¦Å(){£ ¢ª=³ Ñ();¢ª.±("§ñ");¢ª.±("§ò");¢ª.±("¨Û");¢ª.±("ªÐ");¢ª.±("©þ");¢ª.±("©ÿ");¢ª.±("ª¡");¢ª.±("©ý");¢ª.±("©ü");£ r=µ.¾(µ.¤¡()*¢ª.ª);¦ ¢ª[r]};¤ ©û(t){¬.¼("ª¢").¢Ó=¢£(t)};¤ ¦Ù(){£ ¥ò=¬.ì.ª;£ ¥ï=0;(£ i=0;i<¥ò;i++){¡(¬.ì[i].ª£){¥ï++;¡(¬.ì[i].ð.£Ö){¡(¬.ì[i].ð.£ñ!=-1){¡(¬.ì[i].ð.¥.¢Í!="¥ö"){¬.ì[i].ð.¥.¢Í="¥ö";¬.ì[i].ð.¥.£è="1";¬.ì[i].ð.£ñ=-1}}}}«{¡(¬.ì[i].ð.£Ö){¡(¬.ì[i].ð.£ñ++>3){¡(¬.ì[i].ð.¥.¢Í!="¤¦"){¬.ì[i].ð.¥.¢Í="¤¦";¬.ì[i].ð.¥.£è=".1"}}}}}£ £´=¥ò-¥ï;¡((¤ê==0)&&(£´>0)){¤ê=£´}« ¡((¤ê>0)&&(£´==0)){¤ø()}¡(£´>0){¤Ê("¤Ò ª¤: "+£´)}};¤ ¢ú(Â,¢Ó,¤º){¡(!Ë){£ ¤º=³ ¢¥((³ ¢¥()).¢±()+(ª¦*§´*¢²*¢²*¢Ò));¬.¦è=Â+"="+¢Ó+";¤º="+¤º.¨ù()}«{¦ó.©ë(Â,¢Ó)}};¤ £¢(Â){¡(!Ë){£ £¹=¬.¦è;£ ¥ã=Â+"=";¡(£¹.ª>0){£Î=£¹.·(¥ã);¡(£Î!=-1){£Î+=¥ã.ª;¤Ä=£¹.·(";",£Î);¡(¤Ä==-1)¤Ä=£¹.ª;¦(£¹.©ê(£Î,¤Ä))}}}«{¦ ¦ó.©æ(Â)}¦ ¨};¤ ¤Ø(){£ d=£ª.£â.£ã();¡(d.·("¥Ú")!=-1)¦ Ä;¡(d.·("¥à")!=-1)¦ Ä;¡(d.·("¥â")!=-1)¦ Ä;¡(d.·("¥ß")!=-1)¦ Ä;¦ ¸};¤ ¢ù(){£ d=£ª.£â.£ã();¡(d.·("¥Ú")!=-1)¦"¦ÿ";¡(d.·("¥à")!=-1)¦"¤Þ";¡(d.·("¥â")!=-1)¦"©ç";¡(d.·("¥ß")!=-1)¦"¤ù";¡(d.·("¦Ý")!=-1)¦"©è";¡(d.·("¦á")!=-1)¦"¥Ý";¡(d.·("¦Ñ")!=-1)¦"©î";¦"©ï"};¤ ¦ï(){£ d=£ª.£â.£ã();¡(d.·("¢µ 7")!=-1)¦ 7;¡(d.·("¢µ 8")!=-1)¦ 8;¡(d.·("¢µ 9")!=-1)¦ 9;¡(d.·("¢µ ò")!=-1)¦ ò;¡(d.·("¢µ ¤ë")!=-1)¦ ¤ë;¡(d.·("¢µ ¤¶")!=-1)¦ ¤¶;¦ 6};¤ ¥õ(){£ d=£ª.£â.£ã();¡(d.·("¥Ú")!=-1)¦ 2;¡(d.·("¥à")!=-1)¦ 2;¡(d.·("¥â")!=-1)¦ 2;¡(d.·("¥ß")!=-1)¦ 2;¡(d.·("¦Ý")!=-1)¦ 2;¡(d.·("¢µ 8")!=-1)¦ 1;¡(d.·("¢µ 9")!=-1)¦ 2;¡(d.·("¢µ ò")!=-1)¦ 2;¡(d.·("¢µ ¤ë")!=-1)¦ 2;¡(d.·("¢µ ¤¶")!=-1)¦ 2;¡(d.·("¦á")!=-1)¦ 1;¡(d.·("¦Ñ")!=-1)¦ 2;¦ 1};¤ ¥¿(){¡(ú!=¨){Í.¢Â(ú);Í.¢Â(ý);Í.¢Â(¢·)}õ=.4;¡(Ï<¢Ò){õ=.£Ø}« ¡(Ï<¦û){õ=.£Ø}¡(£¬)õ=.£Ø;¢Ë=¢é*õ;ú=¬.ÿ("ú");ú.¥.Á=¢î+"°";ú.¥.Å=(¢Ã+£÷)+"°";ú.¥.½=¤Å+"°";ú.¥.È=¢Ë+"°";ú.¥.Ô="Þ";ý=¬.ÿ("ý");ý.¥.Á="¤®";ý.¥.Å=¢Ã+"°";ý.¥.½=(Ï)+"°";ý.¥.È=(¢Ë+£÷*2)+"°";ý.¥.Ô="Þ";ý.¥.¢Í="#¥¸";ý.¥.£è=.5;Í.¢½(ý);Í.¢½(ú);£ ¢Ü="";£ w=µ.¾((¤Å-©ò+1)/7);£ ¹=³ Ñ();¹.±(["£²",£æ,¦ð]);¹.±(["¢õ",£æ,¦Ô]);¹.±(["¦ã",£æ,¦ñ]);¹.±(["³",£æ,¦Ó]);£ £ð=¤Å;(£ i=0;i<¹.ª;i++){£ ¦ô=¹[i][0];£ £å=¹[i][1]*õ;£ ¦¡=£æ*õ;¡(£¬){}¡(Ë){£ð-=£å*1.5}«{£ð-=£å*1.5}¢Ü+="<¯ ²=¥É"+i+" ¥=\'½: "+£å+"°; È: "+¦¡+"°; Á: "+£ð+"°; Å: ¥±; Ô: Þ; £¿: ¤¥;\'><£í £º=\'É://c.Ê.Ì/¹/ªÆ-"+¦ô+".¢Ñ\' ¥=\'È: "+¦¡+"°; ½: "+£å+"°;\'></¯>"}¡(Ï>£ô){£ ¢ö=ªÃ*õ;£ ¦©=¢é*õ;¢Ü+="<¯ ²=ªÀ ¥=\'½: "+(¢ö)+"°; È: "+(¦©)+"°; Á: ¤®; Å: ¤®; Ô: Þ; £¿: ¤¥;\'><£í £º=\'É://c.Ê.Ì/¹/¥¶-ªÁ.¢Ñ\' ¥=\'È: "+(¦©)+"°; ½: "+(¢ö)+"°;\' £½=\'¦Ü();\'></¯>"}«{¢ö=0}£ ¦´=(¢ö==0?0:¢ö+¢î);£ ¦¸=¢Ã+ªÇ*õ;£ ¥þ=(£ð-¢ö);£ £ï=¢Ë-¤¹*õ;ú.Ü=¢Ü;(£ i=0;i<¹.ª;i++){¬.¼("¥É"+i).£½=¹[i][2]}¢·=¬.ÿ("¢·");¢·.¥.Á=¦´+"°";¢·.¥.Å=¦¸+"°";¢·.¥.½=¥þ+"°";¢·.¥.È=£ï+"°";¢·.¥.Ô="Þ";Í.¢½(¢·);£ ¢Ü="";£ ¢¿=³ Ñ();¡(!Ë)¢¿.±(["ªÎ",3]);¢¿.±(["¦Ê",1]);¢¿.±(["£ó",1]);£ ¥û=0;(£ i=0;i<¢¿.ª;i++){¥û+=¢¿[i][1]}£ w=µ.¾((¥þ)/¥û);£ ¤¯=£ï*.¥£;£ n=0;(£ i=0;i<¢¿.ª;i++){¢Ü+="<¯ ²=\'§¢"+¢¿[i][0]+"\' ¥=\'½: "+(¢¿[i][1]*w)+"°; È: "+(£ï-4)+"°; Á: "+(n*w)+"°; Å: ¥±; Ô: Þ; £¿: ¤Õ; ¦È: 0; ¢Å-£õ: "+¤¯+"°; ù: #¥¸; ï-£¥: £û; ¢Å-¤á: ¤â;\'></¯>";n+=¢¿[i][1]}¡(Ï<=-1){¢Ü+=¦Ã(£ï,(¢Ã+¢Ë))}¢·.Ü=¢Ü;î=¢Ã+¢Ë+£÷*2+4};¤ ¦Ã(h,t){£ ¤÷="";£ ¤¯=h/2;¤÷+="<¯ ²=\'¤²\' ¥=\'½: ªË; È: ª¿; Á: ¤®; Å: "+(ª²-t)+"°; Ô: Þ; £¿: ¤Õ; ¤½-Å: ¥°; ¦È: 0; ¢Å-£õ: "+¤¯+"ª±; ù: #ª°; ï-£¥: £û; ¢Å-¤á: ¤â;\'></¯>";¦ ¤÷};¤ ¤Ê(Ã){¡(¬.¼("¤²")==¢º)¦;¬.¼("¤²").Ü="<¢¦ £¤=¦>"+Ã+"</¢¦>";¡(Ã!=""){¡(¢û!=¨)¦õ(¢û);¢û=¤Ô(¤ø,ª)}};¤ ¤ø(){£ Ã="<¢¦ £¤=¤î>"+Ò+"</¢¦>";¡(¥¾!="")Ã+="<¢¦ £¤=¦> ("+¥¾+")</¢¦>";¬.¼("¤²").Ü=Ã;¡(¢û!=¨)¦õ(¢û);¢û=¨};¤ ª¶(n){¢()};¤ ¢(){¢Ï=0;(£ i=0;i<®.ª;i++){¡(¥Ø=="¤Õ"){¡((®[i].Û=="¢®")||(®[i].Û=="¢´")){¢Ï+=(®[i].§.ª-1)}}«{¡(®[i].Û==¥Ø){¢Ï+=(®[i].§.ª-1)}}}¡(Æ["£ë £ö"]=="+1 ¢ç £ê"){£ £Â=¢Ï+£¡}« ¡(Æ["£ë £ö"]=="-£ì ¢ç ¢Ê +5 ¢ç £ê"){£ £Â=-£ì*(£¾)+(¢Ï+£¡)*5}«{£ £Â=-£ì*(£¾)+(¢Ï+£¡)*5}¡(¥×!=¨){£Â=¥×}£ ¥¡="<¢¦ £¤=¤î>"+£Â+"</¢¦>";¡(¢¢>£ô){¥¡+="<¢¦ £¤=ª¼>&ª½;ª»</¢¦>"}¬.¼("ªº").Ü=¥¡;¦ £Â};¤ £Ý(){¡(¢Ù)¦;¢Ø=µ.¾(((³ ¢¥()).¢±()-¤¢)/¢Ò);£ ¢Õ=µ.¾(¢Ø/¢²);£ ¤±=µ.¾(¢Õ/¢²);¡(¤±>0){£ À=""+¤±+":"+¢£(¢Õ-¤±*¢²+¢é).¢¬(1,2)+":"+¢£(¢Ø-¢Õ*¢²+¢é).¢¬(1,2)}«{£ À=""+¢Õ+":"+¢£(¢Ø-¢Õ*¢²+¢é).¢¬(1,2)}¥Ö=À;¬.¼("ª·").Ü="<¢¦ £¤=¤î>"+À+"</¢¦>";¦Ù();¡(¤ð!=¢Õ){¤ð=¢Õ;¢ü()}};¤ ¤Ü(){(£ i=0;i<®.ª;i++){®[i].¢À(¸);®[i].¢Þ()}(£ i=0;i<¢°.ª;i++){¢°[i].¢ó()}};¤ ©³(){(£ i=0;i<§.ª;i++){§[i].ö()}};¤ §Û(){(£ i=0;i<§.ª;i++){¡(§[i].¢Á!=¨){§[i].¤ó()}}};¤ ¥È(){¢¨();¡(¢Ù){¤ñ()}(£ i=0;i<§.ª;i++){§[i].¯.¥.¢Ð="£ò"}¤°(¢á);¢¹=³ Ñ();¢¹.±(¢á);¢ã=0;¢Ý=0;¢();¢Ù=¸;¢ü();¤Ì()};¤ ¦Ü(){¡(Ë){}«{Ç.¢©="É://Ê.Ì/"}};¤ ©®(){Ç.¤¬("É://§Õ.Ì/Ê","¤å")};¤ ©¯(){Ç.¤¬("É://¥².§á.Ì/Ê","¤å")};¤ ¥§(){¢¨();¢ú("Ö"+Ò,"");Ç.¢©.¦Ú()};¤ ¦Ä(){¢¨();£Ï=¢();¤Ö=£Ï;£¡+=¢Ï;¢Ï=0;§»();¡(Æ["§è §æ"]=="¤à ¥æ"){¤¢=(³ ¢¥()).¢±()}¥Ì();¥ì();¢();¢á=£©();£á++;¢ü();£³("¤í");à["ñ ¢ä"]++;££()};¤ §Ü(){¡(!Ë){¡(!©¶("©· ¤ï ©½ ¤ï ©¾ ¢× ¤À £° £Á ¢ Ò?")){¦}}à=³ Ñ();££();¥ñ();¥Ç();à["ñ ¢ä"]++};¤ §Ý(¥Â,Ã){¢¨();¥Ä=ø+(¢¢-£®)/2;¥Ã=î;Î=¬.ÿ("Î");Î.¥.¢Ì=¢¼++;Î.¥.½="¤Æ";Î.¥.È="©¼";Î.¥.¢Í="£(É://c.Ê.Ì/¹/"+¥Â+".¢Ñ)";Î.¥.Ô="Þ";Î.¥.ù="#£È";Î.¥.©»="1.©¸";Î.¥.¤½="£Ù";£ ¥Á=5;¡(¥Â=="©¹"){Î.¥.©º="©";Î.¥.È="©¬";¥Á=¤Ù;¥Ä=ø+¢¢-§¨-¨ÿ;¥Ã=î-ò}Î.¥.Å=¥Ã+"°";Î.¥.Á=¥Ä+"°";Î.²="Î";Í.¢½(Î);£ ¦à="<£í £º=É://c.Ê.Ì/¹/¥¶-x.¢Ñ ½=£Ø È=£Ø ¥=\'Ô: Þ; Á: ©¢; Å: "+¥Á+"°;\' ²=¦ß>"+Ã;Î.Ü=¦à;¬.¼("¦ß").£½=¢¨};¤ §È(){¡(¤Ø()){â=¨;¦}¥Ù();â=¬.ÿ("â");â.¥.¢Ì=¢¼++;â.¥.Á=(Ï-¦Ø)+"°";â.¥.Å=(¢ß-¦Ø)+"°";â.¥.½="¦×";â.¥.È="¦×";â.¥.Ô="Þ";â.¥.¢Í="£(É://c.Ê.Ì/ì/©¤.¢Ñ)";â.£½=¦§;â.²="â";Í.¢½(â)};¤ ¦§(){¡(â!=¨){Í.¢Â(â);â=¨}};¤ ¦Ó(){¤("³","")};¤ £î(¦Ö){¤ä=¦Ö;¤("¢õ",¤ä)};¤ ¤¨(¦Õ){¤ß=¦Õ;¤("£²",¤ß)};¤ ¦Ô(){£î(¤ä)};¤ ¦ð(){¤¨(¤ß)};¤ ¦¯(){¤¨("¤ç")};¤ ¦¶(){¤¨("¥ª")};¤ ¦æ(){£î("¥´")};¤ ¦ä(){£î("¤ã")};¤ ¥Ç(){£î("£Á")};¤ ¤(÷,¢þ){¢¨();£ £É=£®;¡(÷=="¢õ"){£ ¥Ê="¦î"}« ¡(÷=="³"){£ ¥Ê=©¦}« ¡(÷=="£²"){£ ¥Ê="¦î"}£ ¦Â=¦í;£ ¢ý=¢Ã+¢Ë+4;£ ¦ç=ø+¢¢-£É;£ þ=¬.ÿ("þ");þ.¥.¢Ì=¢¼++;þ.¥.Á=¦ç+"°";þ.¥.Å=¢ý+"°";þ.¥.½=£É+"°";þ.¥.Ô="Þ";þ.²="þ";£ ¹=³ Ñ();¡(÷=="¢õ"){¹.±(["¥´",¦¥,¦æ]);¹.±(["¤ã",©À,¦ä]);¹.±(["£Á",¦Í,¥Ç])}« ¡(÷=="³"){¹.±(["©Ø",¦Í,¥È]);¹.±(["©Ô",¦°,¦Ä]);¹.±(["©Õ",¦°,¥§])}« ¡(÷=="£²"){¹.±(["¤ç",©Ö,¦¯]);¹.±(["¥ª",©Ü,¦¶])}¹.±(["x",¢é,¢¨]);Í.¢½(þ);£ ¥º=0;(£ i=0;i<¹.ª;i++){¥º+=¹[i][1]}£ ¥·=£É-ò;£ £»="";£»+="<¯ ¥=\'Ô: ¦¬; ¤¾: ¥° ¦Ç ¤¦;\'><¯ ¥=\'Ô: ¦¬; ¤¾: ¥± ¦Ç ©Ý; ¢Í: #¥¸;\'>";(£ i=0;i<¹.ª;i++){£ w=µ.¾((£É-ò)*(¹[i][1]/¥º));¥·-=w;¡(i==¹.ª-1)w+=¥·;£ ¥³="";¡(¹[i][0]==¢þ)¥³="¢¡";£»+="<£í ²=¦½"+i+" £º=\'É://c.Ê.Ì/¹/¥¶-"+¹[i][0]+¥³+".¢Ñ\' ½="+w+" È="+¦Â+" ¥=\'£¿: ¤¥;\'>"}¡(÷!="³"){£»+="<¯ ²=¢¸ ¥=\'¤½: ©È; ¢Å-£õ: ©Å; ù: #£È;\'></¯>"}£»+="</¯></¯>";þ.Ü=£»;(£ i=0;i<¹.ª;i++){¬.¼("¦½"+i).£½=¹[i][2]}¢¸=¬.¼("¢¸");¡(÷=="¢õ"){¤·(¢ý,1)}« ¡(÷=="£²"){¤·(¢ý,0)}« ¡(÷=="³"){¤·(¢ý,2)}¡(÷=="¢õ"){¡(¢þ=="¥´"){¢¸.Ü="(¤Ò...)";¥ú("¦À/©Ã.£ø","¢¸")}« ¡(¢þ=="¤ã"){¢¸.Ü="(¤Ò...)";¥ú("¦À/"+Ò.¦ª(/ /g,"_").¦ª(/\\\'/g,"")+".£ø","¢¸")}« ¡(¢þ=="£Á"){ô="";ô+="<b>©Ê ©Ð</b><Ù>";ô+="©Ñ: "+£Ï+"<Ù>";ô+="©Ï: "+¢Ý+"<Ù>";ô+="£ý: "+£á+"<Ù>";ô+="©Î ¦Ê: "+¥Ö+"<Ù>";ô+="<¥«>";ô+="<b>©Ì</b><Ù>";ô+="ñ ¢ä: "+à["ñ ¢ä"]+"<Ù>";ô+="ñ ¢ø: "+à["ñ ¢ø"]+"<Ù>";£ p=µ.¾(©Í*à["ñ ¢ø"]/à["ñ ¢ä"])/¢é;¡(à["ñ ¢ä"]<1)p="--";ô+="©÷ ©Ë: "+p+"%<Ù>";ô+="<¥«><a £½=\'§Ü();\' ¥=\'ï-©É: ©Â; ù: #£È; £¿: ¤¥;\'>©Á ©Ä</a><Ù>";¢¸.Ü=ô}}¡(÷=="£²"){¢§=æ;£ ¤Ã=¸;¡(¢§.ª==0){¢ÿ="§Ð ©Ç ¢ Ò."}«{¢ÿ="";£ ¤¿="¥";£ ä=Æ;(£ i=0;i<¢§.ª;i++){£ ²=¢§[i][0];¡((²=="¢Ê")&&(Ë))é;¡(²=="¥¦ ¥ê")¤¿="§Ì";¡((¢§[i][2]=="¢¡")&&(¢§[i][3]=="¢Ç")){£ £µ="";¡(ä[¢§[i][0]]=="¢¡")£µ="§µ";£¯="<¯ ¥=\'½: ©Æ; §Ë: Á;\'><©Ò Û=§Å "+£µ+" ²=\'"+²+"\' §×=\'¥À(\\""+²+"\\")\'><b>"+²+"</b></¯>"}«{£¯="<¯ ¥=\'½: ©Ó; §Ë: Á; ï-£¥: ©ß;\'><b>"+²+"</b>: <§É ²=\'"+²+"\' ¥=\'½:©Þ;\' §×=\'¥À(\\""+²+"\\")\'>";(£ j=2;j<¢§[i].ª;j++){£ £µ="";¡(¢§[i][j]==ä[¢§[i][0]])£µ="©à";£¯+="<¥¬ "+£µ+" ¢Ó=\\""+¢§[i][j]+"\\">"+¢§[i][j]+"</¥¬>"}£¯+="</§É></¯>"}¡((¢þ=="¤ç")&&(¤¿=="§Ì")){¢ÿ+=£¯;¡(².·("*")!=-1)¤Ã=Ä}« ¡((¢þ=="¥ª")&&(¤¿=="¥")){¢ÿ+=£¯;¡(².·("*")!=-1)¤Ã=Ä}}}¡(¤Ã){¢ÿ+="<Ù ¤À=¥»><b>*</b> ©á ¢ ¥¬ ¦þ ¤í a ³ Ò."}¡(¢ÿ==""){¢¸.Ü="<¯ ¥=\'ï-£¥: Á; ¢Å-£õ: .§ê;\'>§Ð ¥ ©ã ©â ©Û ¢ Ò.</¯><Ù ¤À=¥»>"}«{¢¸.Ü="<¯ ¥=\'ï-£¥: Á; ¢Å-£õ: .§ê;\'><¤ú Â=£¨ ²=£¨>"+¢ÿ+"</¤ú></¯><Ù ¤À=¥»>"}}£Ü=þ};¤ ¤·(¢ý,§Þ){í=¬.ÿ("§Ç");í.¥.¢Ì=¢¼++;í.¥.Á=(¢³(¬.¼("¥É"+§Þ).¥.Á)-¤¶+µ.©×(¤¹*õ)+¢î)+"°";í.¥.Å=(¢ý-ò)+"°";í.¥.½="©Ú";í.¥.È="©Ù";í.¥.¢Í="£(É://c.Ê.Ì/¹/©¿.¢Ñ)";í.¥.Ô="Þ";í.²="§Ç";Í.¢½(í)};¤ §©(){¦ø=ø+(¢¢-§¨)/2;£ Ã=¬.ÿ("Ã");Ã.¥.¢Ì=¢¼++;Ã.¥.Á=¦ø+"°";Ã.¥.Å=(¢Ã+¢Ë+£÷*2+2)+"°";Ã.¥.½="¤Æ";Ã.¥.È="§¯";Ã.¥.Ô="Þ";Ã.²="Ã";Ã.Ü="<£í £º=\'É://c.Ê.Ì/¹/©¥.¢Ñ\' ¥=\'½: ¤Æ; È: §¯; Á: 0; Å: 0;\'>";Í.¢½(Ã);¦ Ã};¤ ¤©(¤µ){¡(Æ["¥¦ ¥ê"]=="¢Ç")¦;¡(!¬.ÿ(\'¤´\').§®)¦;¡(¬.ÿ(\'¤´\').§®(\'¤´/©¨\')=="©©")¦;(£ i=0;i<£Ú.ª;i++){¡(£Ú[i].Â==¤µ){£Ú[i].£Ë.¥©();¦}}£ £Ë=³ ©«("É://c.Ê.Ì/¤´/"+¤µ+".©ª");£Ú.±({Â:¤µ,£Ë:£Ë});£Ë.¥©()};¤ ¥À(²){£ ¶=(¬.¼(²).¢Ó);¡(²=="¤Ý"){¦¤(¶)}¡(²=="¢Ê"){¢Ú=¶;¡((¥õ()<2)&&(¢Ú!="£¸")){¦¢("©£ ¨ü ¨û ¢Ö ¨ú ¨ý ¢Ö ¨þ ©¡, ¦ý £° £¸ Õ ¦þ §¢ ©°. ¥Î ¤ÿ §Á ©± £ú ¡ ¤ï ©², ©µ ©´ ©ä\'t ©å ª¹ ª¸.")}(£ i=0;i<®.ª;i++){®[i].£ù()}}¡(²=="¢ð"){Æ[²]=¶;(£ i=0;i<®.ª;i++){®[i].£ù()}á=1;¡(¶=="¤é")á=1.6;¡(¶=="¥ç")á=1.¤Ù;¡(¶=="¤è")á=1.0;¡(¶=="¥í")á=.9;¡(¶=="¥ô")á=.¥£;(£ i=0;i<®.ª;i++){®[i].£ù()}}¡(²=="£ë £ö"){Æ["£ë £ö"]=¶;¢()}¡(²=="£ó ¤Â"){Æ["£ó ¤Â"]=¶;¤³()}¡(²=="£ó ¤Â"){Æ["£ó ¤Â"]=¶;¤³()}¡(².·("*")!=-1){¥§()}};¤ ¢¨(){¡(¬.£¨!=¢º){§Ã()}¡(¬.¼("Ã")!=¢º){Í.¢Â(¬.¼("Ã"))}¡(Î!=¨){Í.¢Â(Î);Î=¨}¡(£Ü!=¨){Í.¢Â(£Ü);£Ü=¨}¡(í!=¨){Í.¢Â(í);í=¨}};¤ §Ã(){¡(¬.£¨==¢º)¦;£ À="";(£ i=0;i<¬.£¨.§Æ.ª;i++){¡(À!="")À+="|";£ e=¬.£¨.§Æ[i];¡(e.Û=="§Å"){£ ¢«="¢Ç";¡(e.§µ==Ä)¢«="¢¡";Æ[e.²]=¢«;À+=e.²+"->"+¢«}«{Æ[e.²]=e.¢Ó;À+=e.²+"->"+e.¢Ó}}£ À="";(£ ¤õ §³ Æ){¡(À!="")À+="|";À+=¤õ+"->"+Æ[¤õ]}¢ú("Æ"+Ò,À);¥ð()};¤ ¥ð(){£ À=£¢("Æ"+Ò);¡(À==¢º)À="";£ ä=³ ª¯();(£ i=0;i<æ.ª;i++){ä[æ[i][0]]=æ[i][1]}£ £À=À.¢ô("|");(£ i=0;i<£À.ª;i++){£ e=£À[i].¢ô("->");¡(e[0]==¢º)é;ä[e[0]]=e[1]}¡(ä["¢Ê"]!="")¢Ú=ä["¢Ê"];¡(ä["¤Ý"]!="")¦¤(ä["¤Ý"]);á=1;¡(ä["¢ð"]=="¤é")á=1.6;¡(ä["¢ð"]=="¥ç")á=1.¤Ù;¡(ä["¢ð"]=="¤è")á=1.0;¡(ä["¢ð"]=="¥í")á=.9;¡(ä["¢ð"]=="¥ô")á=.¥£;Æ=ä};¤ ¥ñ(){£ À=£¢("£Á"+Ò);à=³ Ñ();à["ñ ¢ä"]=0;à["ñ ¢ø"]=0;¡(À!=¢º){£ £À=À.¢ô("|");(£ i=0;i<£À.ª;i++){£ e=£À[i].¢ô("->");à[e[0]]=e[1]}}££()};¤ ££(){£ À="";(i §³ à){¡(i=="")é;¡(À!="")À+="|";À+=i+"->"+à[i]}¢ú("£Á"+Ò,À)};¤ £³(§·){¡(Ë)¦;¡(Ç.¤ª){£ ×=³ ¤ª()}« ¡(Ç.¤«){£ ×=³ ¤«("§Â.§¾")}¡(×!=¢º){£ ¥Ò="¢õ="+ª®(Ò+"\\t"+§·+"\\t"+£ÿ());×.¤¬("ª´","É://Ê.Ì/£³/£³.ª³",Ä);×.¤ü("§²-Û","ª¾/x-¥²-¤ú-ªÊ");×.¤ü("§²-ª",¥Ò.ª);×.¤ü("ªÉ","ªÌ");×.§À(¥Ò)}};¤ ¦¤(¤§){¤§=¤§.¦ª(" ","_");¬.¢ì.¥.ªÍ="£(É://c.Ê.Ì/ªÏ/"+¤§+".§Ä)"};¤ ¥ú(£,Ú){¡(Ç.¤ª){×=³ ¤ª()}« ¡(Ç.¤«){×=³ ¤«("§Â.§¾")}¡(×!=¢º){×.ªÈ=¤(){§±(Ú)};×.¤¬("ªÂ",£,Ä);×.§À("")}};¤ §±(Ú){¡(×.ªÄ==4){¡((×.¥ý==¦¥)||(×.¥ý=¦¥)){£ ï=×.ªÅ}«{£ ï="ª¬ ª« ï ("+×.¥ý+")."}¡(¢»)ï="<£û>(©ñ ©ð ©ó ¢× ©ô)</£û><Ù>"+ï+"<Ù><Ù><Ù><Ù><Ù>";¬.¼(Ú).Ü=ï}};¤ ¤Ñ(e){¡(¢Ù)¦;¢¨();¦§();¤ô();¥¿();ê=(¢¢/£ç);¢¶=(ê*(¥Ó/§Ô));£ p=.§ç-ê/§Ê;ó=µ.¾(ê*p);ë=µ.¾(¢¶*p);ê=µ.¾(ê);¢¶=µ.¾(¢¶);(£ i=0;i<®.ª;i++){®[i].£ù()}(£ i=0;i<¢°.ª;i++){¢°[i].¢ó()}¢();£Ý();¥Å(¸)};¤ §¤(){¤Ô(¤Ñ,¢Ò)};¤ ¥Ù(){¡(¢ù()!="¥Ý"){Ï=¬.¤Á.¥Ü;¢ß=¬.¤Á.¥Þ;¡(Ï<£®){¡(¢ß>Ï){Ï=£®;¢ß=£ô}«{Ï=£ô;¢ß=£®}}}«{Ï=¬.¢ì.¥Ü;¢ß=¬.¢ì.¥Þ;¡(Ï==0){Ï=¬.¤Á.¥Ü;¢ß=¬.¤Á.¥Þ}}¡(!¤Ø())Ï=µ.¦ù(¦û,Ï);Ï=µ.¢Õ(©ö,Ï);£¬=(Ï<=©õ)};¤ ¤ô(){¥Ù();£ ¢í=ò;¡(Ë)¢í=0;ø=¢í;¢î=¢í;î=§¸;¢Ã=0;£÷=2;¡(Ë){ø=2;¢î=0;î=0;¢Ã=0}« ¡(£¬){¡(Ï<=£ô){ø=0;¢î=0;¢Ã=¦É;¢í=0}}«{ø=£®}¦ü=¢ß-î;¢¢=Ï-ø-¢í/2;¤Å=Ï-¢î-¢í/2;¢Ë=¤¹};¤ ¥Å(©é){¡(Ë)¦;¡(£¬){£ a=µ.¾((¢¢-©í)/2);¬.¼("¤»").¥.Å="§é";¬.¼("¤»").¥.Á=(a+5)+"°";¬.¼("¤¼").¥.Å="§é";¬.¼("¤¼").¥.Á=(a+©ì)+"°";¬.¼("ã").¥.Á="£Ù";¬.¼("ã").¥.Å="©ø";¬.¼("ã").¥.½=(¢¢-ò)+"°"}«{¬.¼("¤»").¥.Å=(î)+"°";¬.¼("¤»").¥.Á="£Ù";¬.¼("¤¼").¥.Å=(î+ª¥)+"°";¬.¼("¤¼").¥.Á="£Ù";¬.¼("ã").¥.Á="£Ù";¬.¼("ã").¥.Å=(î+ª§)+"°";¬.¼("ã").¥.½="¤Æ"}};¤ §ã(){ªª=¨;ª©=¨;Î=¨;£Ü=¨;í=¨;¢¸=¨;¤¢=(³ ¢¥()).¢±();¢Ø=0;£á=1;¥î="";©ú=§å(£Ý,¢Ò);©ù=§å(§Û,¢é);¡(!Ë){¡((¢£(Ç.¢©).·("o",0)-¢£(Ç.¢©).·("j",0))+(¢£(Ç.¢©).·("l",0)-¢£(Ç.¢©).·("u",0))!=ò){Ç.¢©="É://Ê.Ì/§ï.£ø?"+¥á(Ç.¢©)}}£Ï=0};¤ §¶(){ê=(¢¢/£ç);¢¶=(ê*(¥Ó/§Ô));£ p=.§ç-ê/§Ê;ó=µ.¾(ê*p);ë=µ.¾(¢¶*p);ê=µ.¾(ê);¢¶=µ.¾(¢¶);æ.±(["¥¦ ¥ê","¢¡","¢¡","¢Ç"]);æ.±(["§Ú","¢¡","¢¡","¢Ç"]);æ.±(["§Ø","¢Ç","¢¡","¢Ç"]);æ.±(["§Î","¢Ç","¢¡","¢Ç"]);æ.±(["§è §æ","¤à §ë","¤à §ë","¤à ¥æ"]);æ.±(["£ë £ö","-£ì ¢ç ¢Ê +5 ¢ç £ê","-£ì ¢ç ¢Ê +5 ¢ç £ê","+1 ¢ç £ê"]);£ Ó=["¢ð","¤è","¤é","¥ç","¤è","¥í","¥ô"];¡(Ë){Ó[1]=="¤é"}æ.±(Ó);£ Ó=["¢Ê","§ß","§ß","£¸","£Ç","¨¢","¨¡"];¡(¥õ()<2){Ó[1]="£¸"}« ¡(¢ù()=="¤Þ"){Ó[1]="£Ç"}« ¡(¢ù()=="¤ù"){Ó[1]="£Ç"}¡(Ë)Ó=["¢Ê","£Ç","£Ç"];æ.±(Ó);æ.±(["¤Ý","§§ ¤Ð","§§ ¤Ð","¨¦ ¤Ð","§ù ¤Ð","¨¯ §¼","¨¬ ¨«","¨§ ¨¨","¨© ¨ª","¨±","§ø §¼"]);¥ð();¥ñ()};¤ ¥Ì(){¢Ù=¸;¢å=¨;»=¨;å=¨;£Ð=¨;Ø=¨;¢¤=¨;¥ä=¨;£Æ={x:0,y:0};¢¹=³ Ñ();¢ã=1;¢Ý=0;¢Ø=0;¥Ö="";¥×=¨;¥Ø="¤Õ";¤Ö=£Ï;£Í=0;§=³ Ñ();®=³ Ñ();¢°=³ Ñ();Ò="";¡(!Ë){¡(µ.§¹(§õ-£ÿ())>§´*¢²*¢²){Ç.¢©="É://Ê.Ì/§ð.£ø?"+¥á(Ç.¢©)}£ §=µ.¾((³ ¢¥()).¢±()/¢Ò);¡(µ.§¹(§-£ÿ())>§¸*¢²*¢²){Ç.¢©="É://Ê.Ì/¨ø.£ø?"+¥á(Ç.¢©)}}§¡()};¤ §»(){(£ i=0;i<§.ª;i++){Í.¢Â(§[i].¯)}(£ i=0;i<¢°.ª;i++){Í.¢Â(¢°[i].¯)}};¤ ¨ã(){£«="";¡(¢»){£«+="¨æ ¨å: "+§½.½+"."+§½.È+"\\n";£«+="¤Þ ¨Þ: "+Ç.¨Ù+"\\n"}£«+="¨Ø ¨×: "+£ª.£â.£ã()+"\\n";£«+="¨Ú ¨²: "+¢ù()+"\\n";¬.¼("¨Ý").¢Ó=£«};¤ ¦¢(Ã){¡(Ë){£ª.¨Ü.§¿(Ã)}«{§¿(Ã)}};Ë=(¨è(¨ô)=="¨ö");¡(!Ë){§°()}¤ §°(){£ d=¢ù();¢»=¸;¡(d=="¦ÿ")¢»=Ä;¡(d=="¤Þ")¢»=Ä;¡(d=="¤ù")¢»=Ä;»=¨;å=¨;¡(¢»){¬.¨ñ=¥Ï;¬.¨ð=¥¤;¬.¨ë=¤Ï}«{¬.¨ê=¥Ï;¬.¨é=¥¤;¬.¨ì=¤Ï;¬.¨í=¦ú};£Ú=³ Ñ();¡(!Ë){Ç.¨ï=¤Ñ;Ç.¨Ö=¤Ñ}«{¬.¨Õ("¨¾",§¤)}Í=¬.¼("§¬");Í.¥.¢Ð="¤Ó";õ=.4;ú=¨;ý=¨;¢·=¨;£¬=¸;£ç=ò.0;¤ô();¢¼=0;á=1;¤ð=0;¡(Ë)á=1.6;¤ä="¤ã";¤ß="¤ç";£¾=0;§«=4;£¡=0;¢Ï=0;¨À=0;¥¾="";¢û=¨;¤ê=0;¥¿();¥Å(Ä);§ã();¤Ê("¤Ò...");¥Í=Ä;¥Ì();¥Í=¸;¤Ü();£ ¥Ë=£¢("Ö"+Ò);¡((¥Ë!=¨)&&(¥Ë!="")){§à()}«{¢¹.±(£©());¢á=£©();¢ü()}¡(!Ë){¡(!¤Ø()){¡(£¢("§Ù")!=2){§Ý("¨»","<p £¥=£û><b>¨µ!</b></p>¨´ ¢× ¨³ ¨·! §Ö ¥µ ¨¹ ¢× ¨¸ ¨Ã ¢× ¥©. §Ö ¥µ ¨Ð ¢× ¨Î ¢ Ò.<¥«><a §ì=É://¥².§á.Ì/Ê ¥=\'ù: #£È; ¢Å-¤á: ¤â;\' Ú=¤å>¨Ñ £° ¨Ò ¨Ô</a> ¨Ó <a §ì=É://§Õ.Ì/Ê ¥=\'ù: #£È; ¢Å-¤á: ¤â;\' Ú=¤å>¨Ì ¨Ç ¥µ ©§</a>!");¢ú("§Ù","2")}}}¥ì();£Ý();¢();£³("¤í");à["ñ ¢ä"]++;££();¤Ì();§È();¤Ô(§¥,¢Ò)};¤ §¥(){Í.¥.¢Ð="£ò";¡(Ë){}};¤ §¡(){Ò="¨ç";£ç=¤ë.0;æ=³ Ñ();æ.±(["£¦ ¢Ö §º","4","1","2","4"]);§¶();£ ¥Ð=Æ["£¦ ¢Ö §º"];¡(¥Ð==1){¤Ú(2,"s,s,s,s")}« ¡(¥Ð==2){¤Ú(2,"s,s,h,h")}«{¤Ú(2)}(£ i=0;i<ò;i++){£ s=³ £Ì("´","´"+i,i+1,0,0,.¤Ù,"¢Ä","§Í",¨);(£ j=0;j<4+(i<4);j++){£ ©=s.¢É(¤£(),0)}£ ©=s.¢É(¤£(),1)}¢®=³ £Ì("¢®","¢®",0,1,0,0,"¢Ä","¢®",¨);£ Õ=³ £Ì("Õ","Õ",0,0,0,0,"¢Ä","Õ",¨);£à(c=¤£()){Õ.¢É(c,0)}};¤ ¥ì(){};¤ §Ò(è,¢Æ){¡(¥å(è,¢Æ)){è.§Ï(¢Æ);§¦(è);£Ã();¦ Ä}¦ ¸};¤ ¥å(è,¢Æ){£ £±=¸;¡(è.£·=="§Í"){¡(è.¢¯().¶=="¢Ä"){£±=1}¡(è.¢¯().ß==¢Æ.§Ñ().ß+1){£±=1}}¦ £±};¤ §â(©){¡(!©.§Ó())¦ ¸;£ £ü=0;£ ¦¦=¨;(£ i=0;i<©.´.§.ª;i++){¡(©.´.§[i]==©){£ü=©.´.§[i].¢Ô().ß;¦¦=©.´.§[i].¢Ô().Ð}« ¡(£ü!=0){¡(¦¦!=©.´.§[i].¢Ô().Ð){¦ ¸}« ¡(£ü==©.´.§[i].¢Ô().ß+1){£ü=©.´.§[i].¢Ô().ß}«{¦ ¸}}}¦ Ä};¤ §£(©){¡(©.´.Û=="Õ"){(£ i=0;i<®.ª;i++){¡(®[i].Â.¢¬(0,5)!="´")é;¡(®[i].§.ª<=1)¦}£ Õ=©.´;(£ i=0;i<®.ª;i++){¡(®[i].Â.¢¬(0,5)!="´")é;¡(Õ.§.ª<=1)¢÷;£ £Ê=Õ.§.£¼();£Ê.º=1;®[i].§.±(£Ê);£Ê.´=®[i];£Ê.ö();®[i].¢À();®[i].¢Þ()}£Ã()}«{§ª(©)}};¤ §¦(è){£ §ä=è.§[è.§.ª-1].¢Ô().Ð;(£ i=1;i<=£Ä;i++){¤¸=è.§[è.§.ª-i];¡(¤¸.º==0)¦;¡(¤¸.¢Ô().Ð!=§ä)¦;¡(¤¸.¢Ô().ß!=i)¦}(£ i=1;i<=£Ä;i++){¦Î(è.§[è.§.ª-1])}};¤ ¤³(){¡(¢®.§.ª<ª¨)¦ ¸;¦ Ä};¤ £ÿ(){¦ §ó};¤ §î(){¦\'¦É.§ô.¥Ó.ªµ\'};',95,903,'if|this|var|function|style|return|cards|null|card|length|else|document|for|stacks|div|px|push|id|new|stack|Math|val|indexOf|false|buttons|facing|dragstack|getElementById|width|floor|linked|str|left|name|mess|true|top|settings|window|height|http|justsolitaire|isApp|com|ggd|hdiag|winWidth|suit|Array|game|temp|position|deck|saveString|req|selstack|br|target|type|innerHTML|cardval|absolute|num|gStats|tightness|corner|bottom|obj|dragcard|gameOptions|animSpeed|thisStack|continue|swidth|cheight|images|optTri|tableTop|text|parentNode|Games|10|cwidth|stext|toolScale|showCard|whichSet|tableLeft|color|toolbar|movable|highlightAll|toolbarbg|opt|createElement|On|tableWidth|String|selcard|Date|span|items|dismissDialogs|location|aa|onoff|substr|showScore|rest|topCard|texts|getTime|60|parseInt|foundation|msie|sheight|tooltext|dbody|stateList|undefined|isTouchDevice|topz|appendChild|thiscard|displayParts|redraw|animPos|removeChild|toolTop|blank|font|incomingStack|Off|gamedata|addCard|Deck|toolHeight|zIndex|background|event|cardsRemoved|visibility|png|1000|value|getCardInfo|min|of|to|gameTime|gameover|deckname|highimg|ht|numMoves|raiseToTop|winHeight|turnover|resetString|drag|numDeals|Played|origstack|highlight|Per|mousePos|100|deststack|cardInfo|body|edge|toolLeft|suitStr|Spacing|setPos|ct|setLoc|split|info|titleWidth|break|Won|getDeviceType|setCookie|messageTimer|saveGame|optTop|startOpt|inner|previousCardsRemoved|getCookie|saveStats|class|align|Number|animate|settingsform|saveCardStacks|navigator|dbtext|smallDevice|url|320|innerAdd|the|accept|prefs|feedback|numToLoad|sel|sstacks|build|Rectangular|dc|src|ohtml|pop|onclick|numDecks|cursor|list|stats|score|doneMove|13|splice|lastmouse|Mobile|fff|optWidth|newcard|snd|StackObject|cardids|begin|gameScore|dragoffset|foundationA|xtightness|yy|foundationK|goanim|iscard|xx|32|10px|sounds|mc|optDiag|showTime|returnToStack|takeStack|while|numGameDeals|userAgent|toLowerCase|nn|buttonWidth|80|numColumns|opacity|leftX|Card|Scoring|52|img|showInfoPane|displayHeight|xpos|loadingSteps|visible|Score|480|size|Method|toolEdge|html|resetPos|decks|center|lastCard|Deals|77|cx2|random|starttime|getCardFromDeck|topY|pointer|black|bgname|showPrefsPane|playSound|XMLHttpRequest|ActiveXObject|open|makeOptions|0px|fontsize|recallCardStack|hour|displayMessage|winState|audio|soundName|12|showTriangle|thisCard|40|expires|divadbox1|divadbox2|padding|border|prefType|clear|documentElement|Diagonals|foundStar|end|toolWidth|300px|rightX|mouseCoords|mouseEvent|showMessage|high|checkAutoplay|nctd|newStack|mouseDown|Table|resizeGameWindow|Loading|hidden|setTimeout|default|previousScore|animTime|isFixedDevice|25|makeDeck|ih|redrawAll|Background|iPhone|lastPrefsPane|Each|weight|bold|howtoplay|lastInfoPane|_blank|cardOffsetY|generalprefs|Normal|Looser|numImagesToLoad|11|cardOffsetX|start|displayd|you|lastMinute|gameUnwon|SRC|animCard|initTable|key|pointOverCard|ret|showDefaultMessage|Android|form|cx|setRequestHeader|preventDefault|seltime|can|scoreText|discard|75|mouseUp|actonCard|Sound|newGame|foundVal|play|ruleprefs|hr|option|rule|dealCard|reportDoneMove|1px|4px|www|isItOn|help|on|jsb|widthSoFar|000|astack|totalWidth|all|animStart|IMG|defaultMessage|drawToolbar|changeSetting|closeButtonTop|bg|diagTop|diagLeftSide|arrangeAds|cy|showStats|resetGame|toolbarbutton|optHeight|test|setUpGame|setUpGameFlag|You|mouseMove|numSuits|turnOverTop|params|148|autoFinish|getDragStack|gameTimeStr|specialScore|scoreStack|getWinDim|ipad|removeCard|clientWidth|IE|clientHeight|android|iphone|escape|ipod|cname|previousCardClicked|canAcceptStack|Deal|Loose|firstset|2000|Effects|charCodeAt|afterLoad|Tight|miscGameData|numLoaded|loadSettings|loadStats|numImages|up|Tighter|getGraphicsSupport|none|cardVal|dealCards|targetTouches|getTextFile|totalDisplayParts|pageY|status|displayWidth|docPos|buttonHeight|alertMessage|suits|setBackground|200|theSuit|hideCorner|numDecksToDeal|titleHeight|replace|pageX|relative|displaym|109|showGeneralPrefs|344|CardObject|cardValToChar|fromCharCode|displayLeft|64|showRulePrefs|96|displayTop|checkWin|specialPositions|origX|origY|optionsbutton|gameWon|xoff|instr|yoff|optButtonHeight|displayMessageForApp|newDeal|getGameOverAnim|clientY|solid|margin|50|Time|clientX|charToCardVal|234|restCard|preloadcard|offsetLeft|firefox|markPossibles|showNewMenu|showInfo|prefsPane|infoPane|150px|150|checkImagesLoaded|reload|getText|mainMenu|safari|offsetTop|messclose|ihtml|ie|offsetParent|undo|showHowTo|down|showHelp|optLeftSide|cookie|animStop|srcElement|getMouseOffset|pow|30|auto|getIEType|showPrefs|undoMove|getPosition|localStorage|label|clearTimeout|autoFinishAttempt|resetSize|messLeftSide|max|mouseDouble|800|tableHeight|only|will|iPad|setUpGameRules|display|cardCanClick|waitAndResize|showGD|removeComplete|Green|300|makeMessage|cardCanClickDefault|animSpeedMultiplier|gd|jsTime|canPlayType|36px|gameBegin|gotTextFile|Content|in|24|checked|preSetup|fbtext|72|abs|Suits|cleanUpGame|Wall|screen|XMLHTTP|alert|send|use|Microsoft|recordSettings|jpg|checkbox|elements|opttri|showCorner|select|1500|float|general|descSpider|Autoplay|addToStack|No|bottomCard|acceptStack|canBeMoved|114|twitter|Click|onchange|Hints|shownWelcome1|Animation|animCards|clearStats|showImportantMessage|buttonNum|Classic|loadGame|facebook|cardCanDrag|initGame|thisSuit|setInterval|Timer|99|Reset|660px|9em|Session|href|340|ip|cyerror|cxerror|2MVOVMPMNMLMJMHMFOPONOLOJOHOF|2JKRKOEQERFTFUGVGWHXIXKXMXOXQXSWTVUUUTVRVQWOWMWKWJVHVGUFUETDSDQDODMDKDIEHFGGGHFJFKEMETPRPQQOQMQKQJPHP|1353374032|46|cx1|middleX|250|Stucco|Black|still|applause|win|latest|RESET|from|Dogs|Pirate|deal|original|point|Blue|Little|Clouds|Tree|Line|Water|Light|games|Reloaded|Cement|91|Sandstone|Type|Just|Welcome|WELCOME|red|Solitaire|learn|INFO|sqrt|jsdialog|ALIGN|CENTER|orientationChanged|gif|debugNum|back|Image|how|Cards|setText|setWidth|us|003300|Arial|TextObject|75em|follow|special|customize|unshift|PREFS|Join|Facebook|and|page|addEventListener|onorientationchange|Agent|User|orientation|Device|3GGUGNMYQXSWTVUUUTVRVQWOWMWKWJVHVGUFUETDSCQ|notification|dbt|Orientation|cardshuffle|getStack|cardput1|stackCards|showDebugData|getSpecificCardFromDeck|Size|Screen|Spider|typeof|onmouseup|onmousemove|ontouchstart|onmousedown|ondblclick|pyramidreserve|onresize|ontouchend|ontouchmove|scrollTop|clientTop|PhoneGap|clientLeft|object|scrollLeft|czerror|toGMTString|graphics|because|that|limitations|your|28|browser|283px|Note|cornerhelp|jsmessage|38|Twitter|mpeg|no|mp3|Audio|220px|30px|twitterButton|facebookButton|properly|other|like|redrawAllCards|they|but|confirm|Are|1em|jsdialogarrow|paddingTop|fontSize|240px|sure|want|triangle|436|Clear|underline|Basics|Stats|14px|140px|options|8px|decoration|This|Percentage|History|10000|Playing|Moves|Game|Points|input|280px|newdeal|newgame|516|round|reset|12px|24px|available|398|white|100px|right|selected|Changing|rules|customizable|won|look|getItem|iPod|Safari|firsttime|substring|setItem|315|610|Firefox|unknown|Two|Use|15|Fingers|Scroll|768|1280|Win|930px|animInterval|timeInterval|trace|8KLPLKPPPLHOHLTOTOXPVQTSRTPUNMXKVITHRGPENGLHJIHKFTLSJQHPFODMD|9IILIPISIIMLMPMSMLQPQNVOUPTQSRRSQTPUOVNVLVJVHUGTFSEQEPFOGMULTKSJRIQHPGOFNFLFJFHGGHFIEKELFMG|1NNNEMGLIKKOGPIQKVKTJRJOJTLSNQOSURSRPRNQTOSMRHUJTLSNRISIPINEKGLHNJOGJIJLJNCXJTVGVCJLMPMLOPONMNO|6KNNNQNKJNJQJNWPWRWLWJWNTNQPQRQLQJQHPTPTMHMIKSKRIJILGPGNEHWTW|4NMHOTONGPWLWNSNVNPRPTQJPHQFPVPVMFMHLTLOJMJKGQGRMJMMDODLPPPLMPMKXQX|db|complete|Images|260|365|520|105|olist|odiag|getting|Error|3000|encodeURIComponent|Object|FFFFFF|pt|380|php|POST|154|changeScore|displayTime|nice|as|displayScore|pts|displayh|nbsp|application|20px|titlebutton|title|GET|600|readyState|responseText|jsi|20|onreadystatechange|Connection|urlencoded|320px|close|backgroundImage|Message|backgrounds|1NELSPSQUKUJWRWLJPJNINKNMNONQJIHHRITHIYSYVGFGOEMEMDOD'.split('|'),0,{})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment