View
Theme
Font Style
7pt
8pt
9pt
10pt
11pt
Line Style
100%
110%
120%
130%
140%
Bold Keyword
Default
Inspector
Kkaefer
Eclipse
SQ Light
Lesser
Dark
Cobalt
Monokai
Rubyblue
Night
SQ Dark
Ambiance
Blackboard
Line Num.
Wrap Lines
Preview
Redraw
JS Tab
HTML Tab
CSS Tab
Live Tab
Prev. Tab
Next Tab
Browser
History…
Help
Edit
Settings
Auto Complete
Match Brackets
Match Highlight
Strip Whitespace
Auto Close Brackets
Auto Close Quotes
Show Print Margin
Undo
Redo
Delete
Select Line
Select All
Find & Replace
Find
Find in Repo.
Find Next
Find Previous
Replace Single
Replace All
Wrap Search
Revert
As Template
Diff Revision
Format
Compress
Text
Zen Coding
Indent
Tab Width
1
2
3
4
5
6
7
8
Indent Unit
1
2
3
4
5
6
7
8
Smart Indent
Use Tabs
Visible Tabs
Shift Left
Shift Right
Put Indent
Number
Increment by 1
Decrement by 1
Increment by 0.1
Decrement by 0.1
Increment by 10
Decrement by 10
Simple Math
Comment
Line
Move Up
Move Down
Copy Up
Copy Down
Go to Line…
Remove Line
Next Point
Prev. Point
Help
Share
Login
You can jump to the latest bin by adding
/latest
to your URL
×
z
Find
→
←
⟲
Replace
⊗
All
Replace
var cards = [10, 11, 12, 13, 20, 21, 22, 23, 30, 31, 32, 33, 40, 41, 42, 43, 50, 51, 52, 53, 60, 61, 62, 63, 70, 71, 72, 73, 80, 81, 82, 83, 90, 91, 92, 93, 100, 101, 102, 103, 110, 111, 112, 113, 120, 121, 122, 123, 130, 131, 132, 133]; var spots = [ [0], [6, 10], [6, 8, 10], [1, 5, 11, 15], [1, 5, 8, 11, 15], [1, 3, 5, 11, 13, 15], [1, 3, 5, 7, 11, 13, 15], [1, 3, 5, 7, 9, 11, 13, 15], [1, 2, 4, 5, 8, 11, 12, 14, 15], [1, 2, 4, 5, 7, 9, 11, 12, 14, 15], [1, 15], [1, 15], [1, 15] ]; var ind = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"]; var coul = ["♥", "♦", "♣", "♠"]; var plateau = new Array(8); function init_game() { for (var n = 1, elm, col; n < 9; n++) { elm = document.createElement("div"); elm.id = "freecell" + n; elm.setAttribute("class", (n < 5 ? "libre" : "destination")); elm.setAttribute("onclick", "moveCardToFreeCell(" + n + ")"); elm.style.marginLeft = getPxfromCol(n - 1) + "px"; document.getElementById("plateau").appendChild(elm); col = document.createElement("div"); col.id = "c" + (n - 1); col.setAttribute("class", "colonne"); col.setAttribute("onclick", "select_column(" + (n - 1) + ")"); col.style.marginLeft = getPxfromCol(n - 1) + "px"; document.getElementById("plateau").appendChild(col) } for (var i = 0; i < cards.length; i++) { draw_card(i) } } function newgame() { localStorage.setItem("cardselected", 0); var i = 5; while (--i > 0) { localStorage.setItem("freecell" + i, 0); localStorage.setItem("destination" + i, 0) } for (var c = 0; c < 8; c++) plateau[c] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; for (var j, x, i = cards.length; i; j = parseInt(Math.random() * i), x = cards[--i], cards[i] = cards[j], cards[j] = x); for (var i = 0, c, l; i < cards.length; i++) { c = i % 8; l = parseInt(i / 8); plateau[c][l] = cards[i]; setTimeout("document.getElementById(cards[" + i + "]).setAttribute(\"style\",\"display:visible; margin-left:\"+getPxfromCol(" + c + ")+\"px; margin-top:\"+getPxfromLine(" + l + ")+\"px; z-index:\"+100+" + l + ");", 10 * i) } } function getPxfromCol(col) { return (16 + col * 100) } function getPxfromLine(line) { return (140 + line * 20) } function card_click(c) { var n = 4, d = 4, s = localStorage.getItem("cardselected"); while (n > 0 && localStorage.getItem('freecell' + n) != c.id) n--; while (d > 0 && localStorage.getItem('destination' + d) != c.id) d--; if (s == 0 && d == 0) { if (n > 0 || IsLastOnCol(c)) select_card(c); return } else if (s == c.id) { deselect(c); return } else if (s > 0 && n > 0) { alert("Incorrect move !"); return } else if (s > 0) { var sc = s % 10, cc = (c.id) % 10; var sn = parseInt(s / 10), cn = parseInt((c.id) / 10); if (d > 0 && s > 0 && sn == cn + 1 && sc == cc) { moveCardToFreeCell(4 + d); testwin() } else if (((sc < 2 && cc >= 2) || (sc >= 2 && cc < 2)) && cn == sn + 1) moveCardOver(s, c.id); else alert("Incorrect move !") } } function select_card(c) { c.setAttribute("class", "selected_card" + (c.id % 10 < 2 ? " red" : "")); localStorage.setItem("cardselected", c.id) } function deselect(c) { c.setAttribute("class", "carte" + (c.id % 10 < 2 ? " red" : "")); localStorage.setItem("cardselected", 0) } function select_column(c) { if ((s = localStorage.getItem("cardselected")) == 0) return; else if (plateau[c][0] == 0) moveCardToColumn(s, parseInt(c)); else { var l = 0; while (plateau[c][++l] > 0); card_click(document.getElementById(plateau[c][l - 1])) } } function IsLastOnCol(carte) { var n = parseInt(carte.id); for (var c = 0; c < 8; c++) { for (var l = 0; l < 23; l++) { if (plateau[c][l] == n) { if (plateau[c][l + 1] == 0) return true; else return false } } } return false } function moveCardOver(a, b) { var n = 4, ac, al, bc, bl; while (n > 0 && localStorage.getItem('freecell' + n) != a) n--; for (var c = 0; c < 8; c++) { for (var l = 0; l < 23; l++) { if (n == 0 && plateau[c][l] == a) { al = l; ac = c } if (plateau[c][l] == b) { bl = l; bc = c } } } plateau[bc][bl + 1] = a; if (n == 0) plateau[ac][al] = 0; else localStorage.setItem('freecell' + n, 0); var carte = document.getElementById(a); carte.setAttribute("style", "display:visible; margin-left:" + getPxfromCol(bc) + "px; margin-top:" + getPxfromLine(bl + 1) + "px; z-index:" + 101 + bl); deselect(carte) } function moveCardToColumn(s, c) { var f = 4; while (f > 0 && localStorage.getItem('freecell' + f) != s) f--; if (f == 0) for (var i = 0; i < 8; i++) { for (var l = 0; l < 23; l++) { if (plateau[i][l] == s) plateau[i][l] = 0 } } else localStorage.setItem('freecell' + f, 0); plateau[c][0] = s; var carte = document.getElementById(s); carte.setAttribute("style", "display:visible; margin-left:" + getPxfromCol(c) + "px; margin-top: 140px; z-index:100;"); deselect(carte) } function moveCardToFreeCell(n) { var f = 4, s = localStorage.getItem("cardselected"); if (n > 4 && localStorage.getItem('destination' + (parseInt(n) - 4)) == 0 && s > 14) return; while (f > 0 && localStorage.getItem('freecell' + f) != s) f--; if (f == 0) for (var c = 0; c < 8; c++) { for (var l = 0; l < 23; l++) { if (plateau[c][l] == s) plateau[c][l] = 0 } } else localStorage.setItem('freecell' + f, 0); if (n < 5) localStorage.setItem('freecell' + n, s); else localStorage.setItem('destination' + (parseInt(n) - 4), s); var carte = document.getElementById(s); carte.setAttribute("style", "display:visible; margin-left:" + getPxfromCol(n - 1) + "px; margin-top: 16px; z-index:100;"); deselect(carte) } function testwin() { var c = 8; while (--c >= 0 && plateau[c][0] == 0); if (c < 0) alert("Congratulations, you win !") } function draw_card(i) { var carte = document.createElement("div"); var n = carte.id = cards[i]; carte.setAttribute("class", "carte " + (n % 10 < 2 ? "red" : "")); carte.setAttribute("style", "margin-left:" + parseInt(20 + 700 * i / 52) + "px; margin-top:650px;"); carte.setAttribute("onclick", "card_click(this)"); var index = document.createElement("div"); index.innerHTML = ind[parseInt(n / 10) - 1]; index.setAttribute("class", "index"); carte.appendChild(index); if (n > 109) { var face = document.createElement("img"); face.setAttribute("class", "face"); face.setAttribute("src", "/attach/" + parseInt(n / 10) + ".gif"); carte.appendChild(face) } for (var s = 0; s < spots[parseInt(n / 10) - 1].length; s++) { var spot = document.createElement("div"); spot.setAttribute("class", (n < 19 ? "ace" : "spot" + spots[parseInt(n / 10) - 1][s])); spot.innerHTML = coul[n % 10]; carte.appendChild(spot) } document.getElementById("plateau").appendChild(carte) }
Freecell for 10K APART
Freecell
Click to select a card, click to place it
body { font-family:arial, sans-serif; background-color:#060; background:-webkit-gradient(radial, 50% 50%, 0, 50% 50%, 800, from(#33AA33), to(#006600)) } h1 { color:#FFF; margin:20px 0 0 20px; } #plateau { width:800px; height:750px; margin-left:auto; margin-right:auto; background-color:rgba(255, 255, 255, 0.1); } #commandes { float:right; width:100px; } #commandes input { float:right; margin-right:20px; padding:10px; } .carte, .selected_card { position:absolute; width:71px; height:96px; font-size:16pt; background-color:#FFF; } .carte { box-shadow:0 0 0 #FFF; -webkit-box-shadow:0 0 0 #FFF; -moz-box-shadow:0 0 0 #FFF; -webkit-transition:all 1s ease-in-out; border-color:gray #000 #000 gray; border-style:solid; border-width:1px; } .red { color:red; } .index { font-size:50%; font-weight:700; position:absolute; left:4px; top:4px; } .selected_card { box-shadow:0 0 30px #FFF; -webkit-box-shadow:0 0 30px #FFF; -moz-box-shadow:0 0 30px #FFF; -webkit-transition:all .2s ease-in; border-color:red; border-style:solid; border-width:2px; } .libre, .destination { position:absolute; width:67px; height:92px; margin-top:16px; z-index:1; } .libre { border:2px #FFF ridge; } .destination { border:2px #FFDF0F ridge; } .colonne { position:absolute; height:600px; width:71px; margin-top:140px; } .spot1 { position:absolute; left:16px; top:4px; } .spot2 { position:absolute; left:16px; top:21px; } .spot3 { position:absolute; left:16px; top:38px; } .spot4 { position:absolute; left:16px; top:55px; } .spot5 { position:absolute; left:16px; top:72px; } .spot6 { position:absolute; left:30px; top:4px; } .spot7 { position:absolute; left:30px; top:21px; } .spot8 { position:absolute; left:30px; top:38px; } .spot9 { position:absolute; left:30px; top:55px; } .spot10 { position:absolute; left:30px; top:72px; } .spot11 { position:absolute; left:44px; top:4px; } .spot12 { position:absolute; left:44px; top:21px; } .spot13 { position:absolute; left:44px; top:38px; } .spot14 { position:absolute; left:44px; top:55px; } .spot15 { position:absolute; left:44px; top:72px; } .ace { font-size:220%; position:absolute; left:20px; top:18px; } .face { position:absolute; left:12px; top:8px; width:45px; height: 80px; }
Pop out
Help
About
×
×