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
function randint(n) { return Math.floor(Math.random() * n) } var Sudoku = function () { var L = $('#sg'); var O = L.get(0).getContext('2d'); var P = function (g) { var N = 9, M = 3; var h = (function () { var a = [], r, c, i, val; var d = function (i) { var a = M * Math.floor(i / (M * N)); var b = M * Math.floor((i % N) / M); var c = a * M + b; return { sr: a, sc: b, block: c } }; var e = function (a, b) { var i, candidates = []; if (a) { return { fixed: true, value: b } } for (i = 1; i <= N; i++) { candidates[i - 1] = { n: i } } return { fixed: false, solved: false, candidates: candidates, nc: 9 } }; for (r = 0; r < N; r++) { for (c = 0; c < N; c++) { i = r * N + c; if (g && i < g.length) { val = parseInt(g.charAt(i), 10); a[i] = e(!isNaN(val), val) } else { a[i] = e() } a[i].index = i; a[i].row = r; a[i].col = c; a[i].block_info = d(i) } } return a })(); var j = function (f) { for (var i = 0; i < N * N; i++) { f(h[i]) } }; var k = function (a, f) { var r, c, i; a.seen = true; for (c = 0; c < N; c++) { i = a.row * N + c; if (!h[i].seen) { f(h[i]); h[i].seen = true } } for (r = 0; r < N; r++) { i = r * N + a.col; if (!h[i].seen) { f(h[i]); h[i].seen = true } } for (r = 0; r < M; r++) { for (c = 0; c < M; c++) { i = (a.block_info.sr + r) * N + a.block_info.sc + c; if (!h[i].seen) { f(h[i]); h[i].seen = true } } } a.seen = false; for (c = 0; c < N; c++) { h[a.row * N + c].seen = false } for (r = 0; r < N; r++) { h[r * N + a.col].seen = false } for (r = 0; r < M; r++) { for (c = 0; c < M; c++) { i = (a.block_info.sr + r) * N + a.block_info.sc + c; h[i].seen = false } } }; var l = 6; var m = 2; var n = 18; var o = n + 4; var p = 3 * n; var q = 4; var s = p + 2 * q; var t = 4 * l + 6 * m + 9 * s; var u = Math.floor(0.9 * n) + 'px'; var v = Math.floor(0.8 * o) + 'px'; var w = Math.floor(0.85 * p) + 'px'; var z = '#090909'; var A = ['#4d4d4d', '#fff']; var B = function (a) { var b = 0; for (var i = 0; i < N; i++) { if (!a.candidates[i].deleted && !a.candidates[i].eliminated) { b++ } } return b }; var C = function (a) { for (var i = 0; i < N; i++) { if (!a.candidates[i].deleted && !a.candidates[i].eliminated) { return a.candidates[i].n } } }; var D = function () { var a = 0; for (var i = 0; i < N * N; i++) { if (!h[i].fixed && !h[i].solved) { a++ } } return a }; var E = function (c) { var i = C(c) - 1; var d = true; k(c, function (a) { if (!a.fixed && !a.solved) { var b = a.candidates[i]; if (!b.deleted && !b.eliminated && a.nc === 1) { d = false } } }); return d }; var F = function (c) { c.solved = true; c.value = C(c); var i = c.value - 1; k(c, function (a) { if (!a.fixed) { var b = a.candidates[i]; if (!b.deleted) { b.deleted = 'solved'; b.times_deleted = 1; if (!b.eliminated) { a.nc-- } b.undo_deleted = function () { if (b.times_deleted === 1) { b.deleted = false; if (!b.eliminated) { a.nc++ } } b.times_deleted-- } } else { b.times_deleted++ } } }) }; var G = function (b) { b.solved = false; var i = b.value - 1; k(b, function (a) { if (!a.fixed && a.candidates[i].undo_deleted) { a.candidates[i].undo_deleted() } }) }; var H = function (r, c, e, f) { f.x = e.x + q + c * n; f.y = e.y + q + r * n; f.xm = f.x + (n >> 1); f.ym = f.y + (n >> 1); f.contains = function (x, y) { var a = f.x; var b = a + n; var c = f.y; var d = c + n; return x > a && x < b && y > c && y < d }; f.draw = function () { if (f.deleted) {} else if (f.eliminated) { O.font = u + ' Helvetica'; O.fillStyle = A[(e.block_info.block + 1) % 2]; O.fillText(f.n, f.xm, f.ym); O.lineWidth = 3; O.lineCap = 'round'; O.strokeStyle = '#5b0000'; O.beginPath(); O.moveTo(f.x + 2, f.y + n - 4); O.lineTo(f.x + n - 2, f.y + 4); O.stroke() } else { if (f.highlight) { O.fillStyle = A[(e.block_info.block + 1) % 2]; O.beginPath(); O.arc(f.xm, f.ym, (o >> 1), 0, 2 * Math.PI, true); O.fill(); O.font = 'bold ' + v + ' Helvetica'; O.fillStyle = A[(e.block_info.block) % 2]; O.fillText(f.n, f.xm, f.ym) } else { O.font = u + ' Helvetica'; O.fillStyle = A[(e.block_info.block + 1) % 2]; O.fillText(f.n, f.xm, f.ym) } } } }; (function () { j(function (e) { var r, c, b, rm, cm; r = e.row; c = e.col; b = e.block_info.block; rm = Math.floor(r / M); cm = Math.floor(c / M); e.x = (1 + cm) * l + (c - cm) * m + c * s; e.y = (1 + rm) * l + (r - rm) * m + r * s; e.xm = e.x + s / 2; e.ym = e.y + s / 2; e.contains = function (x, y) { var a = e.x; var b = a + s; var c = e.y; var d = c + s; return x >= a && x <= b && y >= c && y <= d }; if (!e.fixed && !e.solved) { (function () { for (var r = 0; r < M; r++) { for (var c = 0; c < M; c++) { H(r, c, e, e.candidates[r * M + c]) } } })() } e.bgcolor = A[b % 2]; e.draw = function () { var i; O.fillStyle = e.bgcolor; O.fillRect(e.x, e.y, s, s); if (e.fixed) { O.font = 'bold ' + w + ' Helvetica'; O.fillStyle = z; O.fillText(e.value, e.xm, e.ym) } else { if (e.solved) { O.font = 'bold ' + w + ' Helvetica'; O.fillStyle = A[(e.block_info.block + 1) % 2]; O.fillText(e.value, e.xm, e.ym) } else { if (e.show || e.visible) { for (i = 0; i < N; i++) { e.candidates[i].draw() } } } } }; e.mousemove = function (x, y) { var i; if (!e.fixed) { if (e.contains(x, y)) { e.mouseover = true; if (!e.solved) { e.visible = true; for (i = 0; i < N; i++) { e.candidates[i].highlight = !e.candidates[i].deleted && e.candidates[i].contains(x, y) } k(e, function (a) { a.visible = true }) } } else if (e.mouseover) { e.mouseover = false; if (!e.solved) { e.visible = false; for (i = 0; i < N; i++) { if (!e.candidates[i].deleted) { e.candidates[i].highlight = false } } k(e, function (a) { a.visible = false }) } } } }; e.mouseout = function () { var i; if (!e.fixed) { e.mouseover = false; if (!e.solved) { e.visible = false; for (i = 0; i < N; i++) { e.candidates[i].highlight = false } k(e, function (a) { a.visible = false }) } } }; e.click = function (x, y) { var i; if (!e.fixed && e.contains(x, y)) { if (e.solved) { G(e); j(function (a) { a.mousemove(x, y) }) } else { for (i = 0; i < N; i++) { if (e.candidates[i].contains(x, y)) { if (!e.candidates[i].deleted) { if (!e.candidates[i].eliminated && B(e) > 1) { e.candidates[i].eliminated = true; e.nc-- } else if (e.candidates[i].eliminated) { e.candidates[i].eliminated = false; e.nc++ } else if (!e.candidates[i].eliminated && B(e) === 1) { if (E(e)) { F(e); L.mouseout(); if (D() === 0) { return true } } } break } } } } } } }) })(); var I = function () { O.fillStyle = z; O.fillRect(0, 0, t, t); O.textAlign = 'center'; O.textBaseline = 'middle'; j(function (a) { a.draw() }) }; var J = function (c) { var i = c.value - 1; if (c.fixed) { k(c, function (a) { if (!a.fixed && !a.solved) { var b = a.candidates[i]; if (!b.deleted) { b.deleted = 'fixed'; a.nc-- } } }) } }; var K = function (e) { var a = L.offset(); var x = e.pageX - a.left; var y = e.pageY - a.top; return { x: x, y: y } }; L.mousemove(function (e) { var b = K(e); j(function (a) { a.mousemove(b.x, b.y) }); I() }); L.mouseout(function () { j(function (a) { a.mouseout() }); I() }); L.click(function (e) { var b = false; var c = K(e); j(function (a) { b = a.click(c.x, c.y) || b }); I(); if (b) { alert('Bloi! Bloi! Yuh solve de ting man!') } }); j(function (a) { if (a.fixed || a.solved) { J(a) } }); return { draw: I, show_all_candidates: function (b) { j(function (a) { a.show = b }) } } }; return { grid: P } }; var puzzles = { easy: ['.9.48.6.28.23.6.9..4......5.69..74..5.7...3.1..48..96.9......4..3.7.45.94.1.93.7.', '...7...9...9.3..6.8..6..4327....36...2..7..5...85....7981..7..6.4..9.2...6...5...'], medium: ['39...2..6.5..86...2.......3.3.7.......1.6.8.......1.9.4.......7...43..5.8..6...32', '.....4.952.87......493..1.7..2.5..14.3.....6.49..2.5..3.4..965......89.195.4.....'], hard: ['.32.....58..3.....9.428...1...4...39...6...5.....1.....2...67.8.....4....95....6.', '...5.3.......6.7..5.8....1636..2.......4.1.......3...567....2.8..4.7.......2..5..', '.5.3.7.4.1.........3.......5.8.3.61....8..5.9.6..1........4...6...6927....2...9..'] }; var SudokuApp = { puzzle: puzzles.easy[randint(puzzles.easy.length)], attach_difficulty_handlers: function () { var d; var e = $('#d li'); e.each(function () { $(this).click(function () { var c; e.each(function (a, b) { $(this).removeClass('selected') }); $(this).addClass('selected'); c = $(this).attr('id'); d = puzzles[c][randint(puzzles[c].length)]; while (d === SudokuApp.puzzle) { d = puzzles[c][randint(puzzles[c].length)] } SudokuApp.puzzle = d; SudokuApp.setup_puzzle(d) }) }) }, setup_puzzle: function (a) { var g = (new Sudoku()).grid(a); $(':checkbox').click(function () { g.show_all_candidates($(this).is(':checked')); g.draw() }); g.show_all_candidates($(':checkbox').is(':checked')); g.draw() } }; $(document).ready(function () { SudokuApp.setup_puzzle(puzzles.easy[randint(puzzles.easy.length)]); SudokuApp.attach_difficulty_handlers() });
Trinidoku | Sudoku wit ah Trini stylin'
Trini
doku
slight
medium
rel' peppa
pencil marks
body { margin:0; padding:0; background:#090909; font-family:Helvetica; font-size:0.9em; } #main { margin:2% 15%; border:6px solid #1a1a1a; -webkit-border-radius:6px; -moz-border-radius:6px; border-radius:6px; background:#5b0000; } .center { display:table; margin:0 auto; } header h1 { margin:0; background:#8c0000; color:#5b0000; text-align:center; font-size:5em; } header h1 span { color:#1a1a1a; letter-spacing:0.2em; } #dc { padding:7px 0; border-top:3px solid #1a1a1a; border-bottom:3px solid #1a1a1a; } #d { padding:0; background:#5b0000; } #d li { display:inline; list-style-type:none; padding:1px 2em; border:2px solid #5b0000; -webkit-border-radius:3px; -moz-border-radius:3px; border-radius:3px; margin:0 2px; background:#5b0000; color:#8c0000; font-size:1.8em; font-weight:bold; letter-spacing:0.05em; } #d li:hover { border:2px dotted #c65959; background:#8c0000; color:#c65959; } #d li.selected { border:2px solid #c65959; background:#8c0000; color:#c65959; } #sc { background:#5b0000; color:#c65959; padding-top:1.5em; padding-bottom:1em; } #sc * { font-weight:bold; vertical-align:middle; } #sc p { margin:1px 0; padding:0; font-size:0.9em; letter-spacing:0.1em; } #sc label { padding-left:0.15em; } footer { display:block; margin:0; padding:0.3em 0; border-top:3px solid #1a1a1a; border-bottom:3px solid #c65959; background:#5b0000; background:#c65959; color:#8c0000; font-size:0.85em; text-align:center; } footer p { margin:0.2em; padding:0; } footer a { padding:2px; font-weight:bold; text-decoration:none; } footer a:link, footer a:visited { color:#8c0000; } footer a:hover { -webkit-border-radius:2px; -moz-border-radius:2px; border-radius:2px; color:#c65959; background:#8c0000; text-decoration: underline; }
Pop out
Help
About
×
×