/* Copyright 2004 Louis Jean­Richard (www.ljr.ch). All Rights Reserved. */


var va001 = new Preload("../aa/game/5/")
va001.load("sudoku", 80, ".gif")
var va002 = 0
var va003 = 50
var va004 = 70
var va005 = 60
var va006 = 10
var va007 = 20
var va008 = 30
var va009 = 0
var va010 = 50
var va011 = 40
var va012 = 30


function Array2(va013, va014)
{
this.length = va013
for (var y = 0; y < va013; y++)
this[y] = new Array(va014)
}

function va015(va016)
{
return va001.image[va016].src
}

function va016(name,va016)
{
document.images[name].src = va001.image[va016].src
}

function va033(y,x)
{
return 'SU' + (y) + (x)
}

var va154 = '0123456789'
var va071 = va154.charAt(0).charCodeAt(0)
var lc = 0

function va201(va247, name)
{
if (va247 == '')
for (var ci=0; ci < 81; ci++)
va247 += va154.charAt(0)
else
if (va247 == '*')
{
va247 = ''
for (var  i=0; i < 3; i++)
for (var va017=9-i; va017 > 0; va017-=3)
for (var x=0; x < 9; x++)
va247 += va154.charAt((va017 + x) % 9 + 1)
}

this.va247 = va247

this.va139 = 0
for (var ci=0; ci < 81; ci++)
if (this.va247.charAt(ci) > va154)
this.va139++

lc++
if (name != undefined)
this.optionText = name
else
this.optionText = (lc) + ' puzzle(' + this.va139 + ')'
}
var va047 = new va201('','empty')
var va075 = new va201('*', 'full')

function va100(va032, va044)
{
this.ci = va032
this.d = va044
}

var va107 = new va100(81,0)
var va106 = new Array(false,false,false,false,false,false,false,false,false,false)

function va030(y,x)
{
this.name = va033(y,x)
this.y = y
this.x = x
this.ry = y % 3
this.rx = x % 3
this.va119 = va121[9 * y + x]
this.va066 = va067[this.va119]
this.va070 = 9 * y
this.va064 = x
this.reset()
}

function va127()
{
this.va044 = 0
this.va084 = 0
this.va023 = 9
this.va085 = new Array(true,true,true,true,true,true,true,true,true,true)
}
va030.prototype.reset = va127


function va099(d)
{
with (this)
va016(name + (d), va011 + d)
}
va030.prototype.markDigit = va099

function va124(d)
{
with (this)
if (va085[d])
{
va085[d] = false
va023--
return true
}
return false
}
va030.prototype.va122 = va124

function va138(d,va088)
{
with (this)
{
va044 = d
if (va088)
va084 = va010 + d
else
va084 = va009 + d

va023 = 0
va085 = va106
}
}
va030.prototype.va136 = va138

function va145()
{
with (this)
if (va044 == 0)
for (d=1; d < 10; d++)
this.va143(d)
else
{
va016(name + '1', va006)
va016(name + '2', va084)
va016(name + '3', va002)
va016(name + '4', va006)
va016(name + '5', va084 + 10)
va016(name + '6', va002)
va016(name + '7', va008)
va016(name + '8', va084 + 20)
va016(name + '9', va007)
}
}
va030.prototype.show = va145

function va147()
{
with (this)
{
va016(name + '2', va084)
va016(name + '5', va084 + 10)
va016(name + '8', va084 + 20)
}
}
va030.prototype.va146 = va147

var va019 = new Array(0
, va006, va002, va002
, va006, va002, va002
, va008, va007, va007)

function va144(d)
{
with (this)
if (va085[d])
va016(name + (d), va012 + d)
else
va016(name + (d), va019[d])
}
va030.prototype.va143 = va144

function va156()
{
with (this)
{
reset()
show()
}
}
va030.prototype.va155 = va156

var va067 = new Array(0,3,6,27,30,33,54,57,60)
var va105 = new Array
( 1, 2, 9, 4, 5,12, 7, 8,15
,10,11,18,13,14,21,16,17,24
,19,20,-1,22,23,-1,25,26,-1
,28,29,36,31,32,39,34,35,42
,37,38,45,40,41,48,43,44,51
,46,47,-1,49,50,-1,52,53,-1
,55,56,63,58,59,66,61,62,69
,64,65,72,67,68,75,70,71,78
,73,74,-1,76,77,-1,79,80,-1)
var va121 = new Array
( 0, 0, 0, 1, 1, 1, 2, 2, 2
, 0, 0, 0, 1, 1, 1, 2, 2, 2
, 0, 0, 0, 1, 1, 1, 2, 2, 2
, 3, 3, 3, 4, 4, 4, 5, 5, 5
, 3, 3, 3, 4, 4, 4, 5, 5, 5
, 3, 3, 3, 4, 4, 4, 5, 5, 5
, 6, 6, 6, 7, 7, 7, 8, 8, 8
, 6, 6, 6, 7, 7, 7, 8, 8, 8
, 6, 6, 6, 7, 7, 7, 8, 8, 8)
var va110 = new Array(1,0,0,4,3,3,7,6,6)
var va111 = new Array(2,2,1,5,5,4,8,8,7)
var va069 = new Array(3)
va069[0] = new Array( 0, 3, 6,27,30,33,54,57,60)
va069[1] = new Array( 9,12,15,36,39,42,63,66,69)
va069[2] = new Array(18,21,24,45,48,51,72,75,78)
var va108 = new Array(3,4,5,0,1,2,0,1,2)
var va109 = new Array(6,7,8,6,7,8,3,4,5)
var va068 = new Array(3)
va068[0] = new Array( 0, 3, 6,27,30,33,54,57,60)
va068[1] = new Array( 1, 4, 7,28,31,34,55,58,61)
va068[2] = new Array( 2, 5, 8,29,32,35,56,59,62)

function va020()
{
this.va247 = va047.va247
this.va029 = new Array(81)
this.va088 = new Array(81)
this.va074 = new Array(9)
this.va092 = new Array2(9,10)
this.va129 = new Array2(9,10)
this.va072 = new Array(9)
this.va087 = new Array2(9,10)
this.va040 = new Array2(9,10)
this.va073 = new Array(9)
this.va090 = new Array2(9,10)
this.va120 = new Array2(9,10)
var ci = 0
for (var y=0; y < 9; y++)
for (var x=0; x < 9; x++,ci++)
this.va029[ci] = new va030(y,x)

this.va046 = false
this.va142 = true
this.va149 = false
this.va022 = false
this.va148 = false
this.reset()
}

function va126()
{
this.va079 = ''
this.va102 = ''
this.va113 = false
this.va112 = 0
this.va097 = va107
this.va063 = 0

for (ci=0; ci < 81; ci++)
this.va029[ci].reset()

if (this.va142)
for (ci=0; ci < 81; ci++)
this.va088[ci] = false

for (var i=0; i < 9; i++)
{
this.va074[i] = 9
this.va072[i] = 9
this.va073[i] = 9
for (var d=1; d < 10; d++)
{
this.va092[i][d] = true
this.va087[i][d] = true
this.va090[i][d] = true
this.va129[i][d] = 9
this.va040[i][d] = 9
this.va120[i][d] = 9
}
}
}
va020.prototype.reset = va126


function va036()
{
this.reset()
this.va125()
}
va020.prototype.va035 = va036

function va038(ci,d)
{

if (this.va029[ci].va085[d])
{
this.va079 = ''
this.va088[ci] = this.va142
this.va136(ci, d)

if (this.va148)
this.va101()

return true
}
with (this.va029[ci])
if (this.va142 || !this.va088[ci])
va155()

return false
}
va020.prototype.va037 = va038

function va049()
{
var va128 = new Array2(3,10)
var va039 = new Array2(3,10)
var va062 = false

for(;;)
{
this.va063 = 0

for (var r=0; r < 9; r++)
if (this.va073[r] > 1)
{
for (var i=0; i < 3; i++)
for (var d=1; d < 10; d++)
{
va128[i][d] = false
va039[i][d] = false
}

for (var ci=va067[r]; ci != -1; ci=va105[ci])
with(this.va029[ci])
if (va044 == 0)
for (var d=1; d < 10; d++)
if (va085[d])
{
va128[ry][d] = true
va039[rx][d] = true
}

var va131 = va110[r]
var va132 = va111[r]

for (var d=1; d < 10; d++)
if ((this.va090[va131][d]) || (this.va090[va132][d]))
{
var va133
var va130 = 0

for (var i=0; i < 3; i++)
if (va128[i][d])
{
va130++
va133 = i
}
if (va130 == 1)
{
var i1 = va069[va133][va131]
var i2 = va069[va133][va132]
for (var i=0; i < 3; i++,i1++,i2++)
{
this.va122(i1,d)
this.va122(i2,d)
}
}
}

var va025 = va108[r]
var va026 = va109[r]

for (var d=1; d < 10; d++)
if ((this.va090[va025][d]) || (this.va090[va026][d]))
{
var va118
var va041 = 0

for (var i=0; i < 3; i++)
if (va039[i][d])
{
va041++
va118 = i
}

if (va041 == 1)
{
var i1 = va068[va118][va025]
var i2 = va068[va118][va026]
for (var i=0; i < 3; i++,i1+=9,i2+=9)
{
this.va122(i1,d)
this.va122(i2,d)
}
}
}
}
if (this.va063 > 0)
va062 = true
else
break
}
return va062
}
va020.prototype.va048 = va049

function va055(va140)
{
var va045 = new Array(va140)
for (var r=0; r < 9; r++)
if (this.va073[r] > va045.length)
{
var va065 = va067[r]
var va021 = this.va120[r]
var va090 = this.va090[r]

if (this.va056(0, va090, va021, va065, va045))
return true
}

return false
}
va020.prototype.va054 = va055

function va057(va093, va090, va021, va065, va045)
{
var va140 = va045.length

var va150
if (va093 == 0)
va150 = 0
else
va150 = va045[va093 - 1]

var va096 = 11 + va093 - va140

for (var d=va150+1; d < va096; d++)
if ((va090[d]) && (va021[d] <= va140) && (va021[d] >= 2))
{
va045[va093] = d
if (va096 < 10)
{
if (this.va056(va093 + 1, va090, va021, va065, va045))
return true
}
else
{
var va031 = 0
var va032 = new Array(9)

for (var ci=va065; ci != -1; ci=va105[ci])
with(this.va029[ci])
for (di=0; di < va140; di++)
if (va085[va045[di]])
{
va032[va031] = ci
va031++
break
}

if (va031 == va140)
{
var va028 = new Array(9)
var di = 0
var va027 = 0

for (var d=1; d < 10; d++)
if (d == va045[di])
di++
else
{
va028[va027] = d
va027++
}

this.va063 = 0

for (var di=0; di < va027; di++)
for (var pci=0; pci < va140; pci++)
this.va122(va032[pci],va028[di])

if (this.va063 > 0)
return true
}
}
}

return false
}
va020.prototype.va056 = va057

function va059(va140)
{
var va045 = new Array(va140)
for (var y=0; y < 9; y++)
if (this.va074[y] > va045.length)
{
var va021 = this.va129[y]
var va092 = this.va092[y]

if (this.va060(0, va092, va021, 9 * y, va045))
return true
}

return false
}
va020.prototype.va058 = va059

function va061(va093, va092, va021, va065, va045)
{
var va140 = va045.length

var va150
if (va093 == 0)
va150 = 0
else
va150 = va045[va093 - 1]

var va096 = 11 + va093 - va140

for (var d=va150+1; d < va096; d++)
if ((va092[d]) && (va021[d] <= va140) && (va021[d] >= 2))
{
va045[va093] = d
if (va096 < 10)
{
if (this.va060(va093 + 1, va092, va021, va065, va045))
return true
}
else
{
var va031 = 0
var va032 = new Array(9)
var ci = va065

for (var x=0; x < 9; x++,ci++)
with(this.va029[ci])
for (di=0; di < va140; di++)
if (va085[va045[di]])
{
va032[va031] = ci
va031++
break
}

if (va031 == va140)
{
var va028 = new Array(9)
var di = 0
var va027 = 0

for (var d=1; d < 10; d++)
if (d == va045[di])
di++
else
{
va028[va027] = d
va027++
}

this.va063 = 0

for (var di=0; di < va027; di++)
for (var pci=0; pci < va140; pci++)
this.va122(va032[pci],va028[di])

if (this.va063 > 0)
return true
}
}
}

return false
}
va020.prototype.va060 = va061

function va051(va140)
{
var va045 = new Array(va140)
for (var x=0; x < 9; x++)
if (this.va072[x] > va045.length)
{
var va021 = this.va040[x]
var va087 = this.va087[x]

if (this.va052(0, va087, va021, x, va045))
return true
}

return false
}
va020.prototype.va050 = va051

function va053(va093, va087, va021, va065, va045)
{
var va140 = va045.length

var va150
if (va093 == 0)
va150 = 0
else
va150 = va045[va093 - 1]

var va096 = 11 + va093 - va140

for (var d=va150+1; d < va096; d++)
if ((va087[d]) && (va021[d] <= va140) && (va021[d] >= 2))
{
va045[va093] = d
if (va096 < 10)
{
if (this.va052(va093 + 1, va087, va021, va065, va045))
return true
}
else
{
var va031 = 0
var va032 = new Array(9)

for (var ci = va065; ci < 81; ci+=9)
with(this.va029[ci])
for (di=0; di < va140; di++)
if (va085[va045[di]])
{
va032[va031] = ci
va031++
break
}

if (va031 == va140)
{
var va028 = new Array(9)
var di = 0
var va027 = 0

for (var d=1; d < 10; d++)
if (d == va045[di])
di++
else
{
va028[va027] = d
va027++
}

this.va063 = 0

for (var di=0; di < va027; di++)
for (var pci=0; pci < va140; pci++)
this.va122(va032[pci],va028[di])

if (this.va063 > 0)
return true
}
}
}

return false
}
va020.prototype.va052 = va053

function va077()
{
if (this.va113)
return true

var n = 81
for (var ci=0; ci < 81; ci++)
if (this.va029[ci].va044 > 0)
n--

this.va113 = ((n == 0) && this.va114())

return this.va113
}
va020.prototype.va076 = va077

function va080()
{
var y, x
var ee = ' />'
var eet = ' style="display: block" />'
var bar = '<td><img src=' + quoted(va015(va004)) + eet + '</td>'
var row_break = '<td><img src=' + quoted(va015(va003)) + eet + '</td>'
var vrow_break = '<td><img src=' + quoted(va015(va005)) + eet + '</td>'
var blank = ' src=' + quoted(va015(va002)) + eet

var output = '<table>'
var ci = 0

for (y=0; y < 9; y++)
{
if ((y == 0) || (y == 3) || (y == 6))
{
output += '<tr>'
for (x=0; x < 9; x++)
{
output += bar
if ((x == 2) || (x == 5) || (x == 8))
output +=  row_break
}
output += '</tr>'
}
output += '<tr>'
for (x=0; x < 9; x++,ci++)
{
output += '<td><table>'
var d = 0
for (var r=0; r < 3; r++)
{
output += '<tr>'
for (var c=0; c < 3; c++) {
d++
output += '<td><a href="javascript:clickedva030(' + ci + ',' + d + ')">'
output += '<img name=' + va033(y,x) + (d)
output += blank
output += '</a></td>'
}
output += '</tr>'
}

output += '</table>'
output += '</td>'

if ((x == 2) || (x == 5) || (x == 8))
output += vrow_break
}
output += '</tr>'
}
output += '</table>'
this.va046 = true
return output
}
va020.prototype.html = va080

function va098(ci,d,h)
{
this.va079 += h
with (this)
{
va029[ci].markDigit(d)
this.va097 = new va100(ci,d)
if (this.va079 > this.va102)
this.va102 = this.va079
}
}
va020.prototype.markDigit = va098

var va094 = 0
var va103 = 5
function va1()
{
if (this.va097 != va107)
return

var ci, d, y, x
if (this.va079 < '0')
this.va079 = '0'

for (ci=0; ci < 81; ci++)
with (this.va029[ci])
if (va023 == 1)
for (d=1; d < 10; d++)
if (va085[d])
return this.markDigit(ci,d,'')

if (this.va079 < '1')
this.va079 = '1'

ci = 0
for (y=0; y < 9; y++,ci+=9)
for (d=1; d < 10; d++)
if (this.va129[y][d] == 1)
for (x=0; x < 9; x++,ci++)
if (this.va029[ci].va085[d])
return this.markDigit(ci,d,'y')

ci = 0
for (x=0; x < 9; x++,ci++)
for (d=1; d < 10; d++)
if (this.va040[x][d] == 1)
for (y=0; y < 9; y++,ci+=9)
if (this.va029[ci].va085[d])
return this.markDigit(ci,d,'x')


for (var r=0; r < 9; r++)
for (d=1; d < 10; d++)
if (this.va120[r][d] == 1)
for (ci=va067[r]; ci != -1; ci=va105[ci])
if (this.va029[ci].va085[d])
return this.markDigit(ci,d,'r')

va094++
if ((va094 < va103) && this.va048())
{
va094--
if (this.va079 < '2')
this.va079 = '2'

return this.va101()
}

for (var ds=2; ds < 8; ds++)
if ((va094 < va103)
&& (this.va054(ds)
|| this.va058(ds)
|| this.va050(ds)
)
)
{
va094--
var hint_code = '' + (ds + 1)
if (this.va079 < hint_code)
this.va079 = hint_code

return this.va101()
}

va094--
this.va079 += '??'
}
va020.prototype.va101 = va1

function va115()
{
var va091 = new Array2(9,10)
var va086 = new Array2(9,10)
var va089 = new Array2(9,10)
for (var i=0; i < 9; i++)
for (var d=1; d < 10; d++)
{
va091[i][d] = true
va086[i][d] = true
va089[i][d] = true
}

for (var ci=0; ci < 81; ci++)
with (this.va029[ci])
{
if (va044 > 0)
{
if (va091[y][va044])
va091[y][va044] = false
else
return false
if (va086[x][va044])
va086[x][va044] = false
else
return false
if (va089[va119][va044])
va089[va119][va044] = false
else
return false
}
}
return true
}
va020.prototype.va114 = va115

function va123(ci,d)
{
with(this.va029[ci])
if (va122(d))
{
this.va129[y][d]--
this.va040[x][d]--
this.va120[va119][d]--
va143(d)
this.va063++
}
}
va020.prototype.va122 = va123

function va125va020()
{
for (var ci=0; ci < 81; ci++)
this.va029[ci].show()

if (this.va097 != va107)
with (this.va097)
this.va029[ci].markDigit(d)
}
va020.prototype.va125 = va125va020

function va137(ci,dd)
{
with (this.va029[ci])
{
if (this.va022 || this.va148)
{
this.va092[y][dd] = false
this.va087[x][dd] = false
this.va090[va119][dd] = false

var	cc = va064
var	rc = va070
var	va118 = va066

for (; va118 != -1; va118=va105[va118],cc+=9,rc++)
{
this.va122(cc,dd)
this.va122(rc,dd)
this.va122(va118,dd)
}
}

for (d=1; d < 10; d++)
this.va122(ci,d)

this.va074[y]--
this.va072[x]--
this.va073[va119]--

va136(dd, this.va088[ci])

va146()

if (ci == this.va097.ci)
this.va097 = va107
}
}
va020.prototype.va136 = va137

function va141(va247)
{
this.va247 = va247
this.va112 = 0

for (var ci=0; ci < 81; ci++)
{
var d = this.va247.charCodeAt(ci) - va071
if (d > 0)
{
this.va112++
if (this.va142)
this.va088[ci] = true
this.va136(ci,d)
}
}
}
va020.prototype.setup = va141

function va151()
{
var va247 = ''
this.va112 = 0

for (var ci=0; ci < 81; ci++)
{
var d = this.va029[ci].va044
va247 += d
if (d > 0)
this.va112++
}
this.va247 = va247
}
va020.prototype.store = va151

function 								Score(aGame, ava020)
{
this.moves = aGame.moves
this.chrono = new Chrono()
this.board = ava020
aGame.score = this

this.va046 = false
}

function htmlScore()
{
output = '<form name="SCORE"><table>'
output += '<tr><td>' + text5d
output += '</td><td>' + text5e
output += "</td></tr><tr><td>" + htmlDisplay('moves', '')
output += '</td><td>' + htmlDisplay('time', '')
output += "</td></tr>"
output += '<tr><td>' + text5f
output += '</td><td>' + text5g
output += "</td></tr><tr><td>" + htmlDisplay('order', '')
output += '</td><td>' + htmlDisplay('va112', '')
output += "</td></tr>"
output += "</table></form>"
this.va046 = true
return output
}
Score.prototype.html = htmlScore

function resetScore()
{
this.moves = 0
document.SCORE.time.value = ''
document.SCORE.moves.value = this.moves
document.SCORE.order.value = 0
document.SCORE.va112.value = this.board.va112
this.chrono.stop()
}
Score.prototype.reset = resetScore

function updateScore(moves)
{
if (moves == 0)
this.reset()
else
{
this.moves = moves
if (moves == 1)
this.chrono.start()
else
document.SCORE.time.value = this.chrono.elapsedMinutes()
}
if (this.board.va113)
document.SCORE.order.value = 'max=' + this.board.va102
else
document.SCORE.order.value = this.board.va079
document.SCORE.moves.value = this.moves
}
Score.prototype.update = updateScore

function  PlayMode(mode, title)
{
this.mode = mode
this.optionText = title
}

function  Control(ava020)
{
this.board = ava020

this.score = this
this.playMode = new Selector('playModeChanged', 0
, new PlayMode(1, text6a)
, new PlayMode(2, text6b)
, new PlayMode(3, text6c)
, new PlayMode(4, text6d)
)
this.va247 = new Selector('sudokuChanged', 0
, va047
, va075
, new va201("000010000801700004400000703000020605050040090104060000603000001500002806000090000")
, new va201("400060007100835009060000050070004010640020098080900040010000030300741006800050004")
, new va201("000010089801700064400000713900020645056040190104060300603000901500002806000090400")
, new va201("000000010400000000020000000000050407008000300001090000300400200050100000000806000")
, new va201("123456780000000000000000000000000000000000000000000000000000000000000000000000000")
, new va201("006000012208031600901062043120576030000204760760300200517000326000620100602100000")
, new va201("790000006005000700000050038000081200001304900003620000520040000004000800300000042")
, new va201("790400506035000700000050038000081203201374905003620000520040300004000850300000642")
, new va201("010000090000002504040900001007028000002090700000360100900003060308200000050000040")
, new va201("000000010400000000020000000000050407008000300001090000300400200050100000000806000")
, new va201("000000010400000000020000000000050604008000300001090000300400200050100000000807000")
, new va201("000000012000035000000600070700000300000400800100000000000120000080000040050000600")
, new va201("000000012003600000000007000410020000000500300700000600280000040000300500000000000")
, new va201("000000012008030000000000040120500000000004700060000000507000300000620000000100000")
, new va201("000000012040050000000009000070600400000100000000000050000087500601000300200000000")
, new va201("000000012050400000000000030700600400001000000000080000920000800000510700000003000")
, new va201("000000012300000060000040000900000500000001070020000000000350400001400800060000000")
, new va201("000000012400090000000000050070200000600000400000108000018000000000030700502000000")
, new va201("000000012500008000000700000600120000700000450000030000030000800000500700020000000")
, new va201("000000012700060000000000050080200000600000400000109000019000000000030800502000000")
, new va201("000000012800040000000000060090200000700000400000501000015000000000030900602000000")
, new va201("000000013000500070000802000000400900107000000000000200890000050040000600000010000")
, new va201("000000013000700060000508000000400800106000000000000200740000050020000400000010000")
, new va201("000000013000700060000509000000400900106000000000000200740000050080000400000010000")
, new va201("000000013000800070000502000000400900107000000000000200890000050040000600000010000")
, new va201("000000013020500000000000000103000070000802000004000000000340500670000200000010000")
, new va201("000000013040000080200060000609000400000800000000300000030100500000040706000000000")
, new va201("000000013040000080200060000906000400000800000000300000030100500000040706000000000")
, new va201("000000013040000090200070000607000400000300000000900000030100500000060807000000000")
, new va201("000000013040000090200070000706000400000300000000900000030100500000060807000000000")
, new va201("000000013200800000300000070000200600001000000040000000000401500680000200000070000")
, new va201("000000013400800000200000070000400900001000000060000000000501600380000200000070000")
, new va201("000000014000000203800050000000207000031000000000000650600000700000140000000300000")
, new va201("000000014790000000000200000000003605001000000000000200060000730200140000000800000")
, new va201("000000014970000000000200000000003605001000000000000200060000730200140000000800000")
, new va201("980000300000041000000000000000300602401700000500000000060850000000000900000000040")
, new va201("980005000000300010600000002000008600750000000001000000000210000000000570000030000")
, new va201("980030000000600020100000004000014000000000850300000000020507000000000100000800000")
, new va201("980030000000600020100000004000014000000000870300000000020507000000000100000800000")
, new va201("980040000000600020100000005000015000000000830400000000030207000000000100000800000")
, new va201("980040020000030000000000090000000503700200000100000000036000400050009000000700000")
, new va201("980050000000000730600000002000300008400000000050000000003200100000001450000000000")
, new va201("980500000000000610000000000037080000000600200010000000400000905000031000200000000")
, new va201("000000001000000020000003000000040500006000300007820000020010040030000007950000000")
)

this.mode = 1

this.va046 = false
}

function clickedva030Control(ci,d)
{
this.moves++

if (this.board.va037(ci,d))
{
if (this.board.va076())
{
window.defaultStatus = msg2(this.moves)
alert(msg2(this.moves))
}
else
window.defaultStatus = msg3(81 - this.board.va112 - this.moves, this.moves)

this.score.update(this.moves)

return
}

if ((d == 2) || (d == 5) || (d ==8))
{
switch(this.mode)
{
case 1:
return
case 2:
case 3:
with (this.board)
{
store()
va035()
setup(va247)
}
this.score.update(this.moves)
return
case 4:
with (this.board)
{
store()
va035()
setup(va247)
va101()
}
this.score.update(this.moves)
return
}
}
}
Control.prototype.clickedva030 = clickedva030Control

function htmlButtonControl(label, operation)
{
return '<input class="button" type="button" value='
+ sQuoted(label)
+ " onclick='javascript:" + operation + "Game()' />"
}
Control.prototype.htmlButton = htmlButtonControl

function htmlButton2Control(label, operation)
{
return '<input class="button2" type="button" value='
+ sQuoted(label)
+ " onclick='javascript:" + operation + "Game()' />"
}
Control.prototype.htmlButton2 = htmlButton2Control

function htmlControl(formName)
{
var newLine = "<br />\n"
var output = '<form name=' + quoted(formName) + '>'
output += this.htmlButton(text2,'new')
output += newLine
output += this.htmlButton(text3,'reva150')
output += newLine
output += this.htmlButton(text4,'step')
output += newLine
output += this.va247.htmlList(formName)
output += newLine
output += "<fieldset>"
output += "<legend>" + text7a + "</legend>"
output += this.playMode.htmlRadio(formName)
output += "</fieldset>"
output += "</form>"
this.va046 = true
return output
}
Control.prototype.html = htmlControl

function playModeChangedControl()
{
var old_mode = this.mode
this.playMode.read()
this.mode = this.playMode.selected.mode
with (this.board)
{
va142 = (this.mode == 1)
playMode = (this.mode == 2)
va022 = (this.mode == 3)
va148 = (this.mode == 4)
}

switch(old_mode)
{
case 1:	
switch(this.mode)
{
case 1:
return
case 2:
case 3:
with (this.board)
{
store()
va035()
setup(va247)
}
this.score.update(0)
return
case 4:
with (this.board)
{
store()
va035()
setup(va247)
va101()
}
this.score.update(0)
return
}
case 2:	
switch(this.mode)
{
case 1:
this.va150New()
case 2:
return
case 3:
with (this.board)
{
var tmp = va247
store()
va035()
setup(va247)
va247 = tmp
}
this.score.update(0)
return
case 4:
with (this.board)
{
var tmp = va247
store()
va035()
setup(va247)
va247 = tmp
va101()
}
this.score.update(0)
return
}
case 3:	
switch(this.mode)
{
case 1:
this.va150New()
return
case 2:
with (this.board)
{
var tmp = va247
store()
va035()
setup(va247)
va247 = tmp
}
case 3:
return
case 4:
this.board.va101()
return
}
case 4:	
switch(this.mode)
{
case 1:
this.va150New()
return
case 2:
case 3:
with (this.board)
{
var tmp = va247
store()
va035()
setup(va247)
va247 = tmp
}
case 4:
return
}
}
}
Control.prototype.playModeChanged = playModeChangedControl

function resetControl()
{
this.moves = 0
this.va150ed = false
}
Control.prototype.reset = resetControl

function reva150Control()
{
this.reset()
if (this.board.va142)
this.va150New()
else
{
var current_mode = this.mode
this.mode = 1
this.playMode.check(0)
this.playModeChanged()

with (this.board)
{
va035()
setup(va247)
}

this.playMode.check(current_mode - 1)
this.playModeChanged()
this.score.update(0)
}
message(msg2(this.board.va112))
}
Control.prototype.reva150 = reva150Control

function va150Control()
{
this.mode = 1
this.playMode.check(0)
this.playModeChanged()

this.board.va035()

this.reset()
this.score.update(0)
}
Control.prototype.va150 = va150Control

function va150NewControl()
{
this.va150()
with (this.board)
setup(va047.va247)
}
Control.prototype.va150New = va150NewControl

function stepControl()
{
with (this.board)
if ((va148) && (va097 != va107))
with (va097)
this.clickedva030(ci, d)
}
Control.prototype.step = stepControl

function								    sudokuChangedControl()
{
this.va247.read()
this.board.va247 = this.va247.selected.va247
this.va150()
with (this.board)
setup(va247)
}
Control.prototype.sudokuChanged = sudokuChangedControl

function displayGame(language)
{
initLanguage(language)

var board = new va020()
game = new Control(board)
var	score = new Score(game, board)

var output = '<table class="game"><tr><td class="score">'
output += score.html()
output += '</td><td class="board" rowspan="2">'
output += board.html()
output += '</td></tr><tr><td class="control">'
output += game.html('CONTROL')
output += '</td></tr></table>'

document.open()
document.write(output)
document.close()

game.va150New()
}

function clickedva030(ci,d) { game.clickedva030(ci,d) }
function playModeChanged() { game.playModeChanged() }
function sudokuChanged()   { game.sudokuChanged() }
function newGame()         { game.va150New() }
function reva150Game()     { game.reva150() }
function stepGame()        { game.step() }


var langCode = undefined
var text2 = 'New game'
var text3 = 'Restart game'
var text4 = 'Play the hint'
var text5d = 'Moves'
var text5e = 'Time'
var text5f = 'Hint level'
var text5g = 'Preset cells'
var text6a = 'Setup mode'
var text6b = 'Standard'
var text6c = 'Show candidates'
var text6d = 'Hint next move'
var text7a = 'Play mode'


function initLanguage(language)
{
if (langCode == undefined)
langCode = language
else
return
switch (langCode)
{
case 'de':
text2 = 'Neues Spiel'
text3 = 'Beginne wieder von Vorne'
text4 = 'Spiele den Hinweis'
text5d = 'Schritte'
text5e = 'Zeit'
text5f = 'Hinweisniveau'
text5g = 'Gesetzte Zellen'
text6a = 'Sudoku aufsetzen'
text6b = 'Standard'
text6c = 'Zeige Kandidaten'
text6d = 'Zeige Spielhinweis'
text7a = 'Spielart'

break
case 'es':
text2 = 'Empezar un nuevo sudoku'
text3 = 'Empeza desde el inicio'
text4 = 'Juega el paso insinuado'
text5d = 'Pasos'
text5e = 'Tiempo'
text5f = 'Nivel insinuaci&ograve;n'
text5g = 'Celulas con numeral'
text6a = 'Montaje del sudoku'
text6b = 'Standard'
text6c = 'Muestre los candidatos'
text6d = 'Insinue un paso'
text7a = 'Modalidad de juego'
break
case 'fr':
text2 = 'Nouveau sudoku'
text3 = 'Red&eacute;marre le jeux'
text4 = 'Joue le pas sugg&eacute;r&eacute;'
text5d = 'Pas'
text5e = 'Temps'
text5f = 'Niveau de suggestion'
text5g = 'Cases pr&eacute;remplies'
text6a = 'Mise en place sudoku'
text6b = 'Standard'
text6c = 'Montre les candidats'
text6d = 'Sugg&egrave;re le prochain pas'
text7a = 'Mode de jeux'
break
case 'it':
text2 = 'Nuovo sudoku'
text3 = 'Ricomincia da capo'
text4 = 'Gioca il suggerimento'
text5d = 'Mosse'
text5e = 'Tempo'
text5f = 'Livello del suggerimento'
text5g = 'Caselle impostate'
text6a = 'Imposta sudoku'
text6b = 'Standard'
text6c = 'Mostra candidati'
text6d = 'Suggerisci mossa'
text7a = 'Modalit&agrave; di gioco'
break
}
}

function msg2(A)
{
switch (langCode)
{
case 'de':
return 'Der Sudoku ist gelöst !   (' + A + ' Bewegungen)'
case 'es':
return 'El sudoku esta completo !   (' + A + ' pasos)'
case 'fr':
return 'le sudoku est compl&eacute;t&eacute; !   (' + A + ' mouvements)'
case 'it':
return 'Il sudoku &eacute; completo !   (' + A + ' mosse)'
default:
return 'The sudoku is complete !   (' + A + ' moves)'
}
}

function msg3(A, B)
{
switch (langCode)
{
case 'de':
return 'Es bleiben ' + A + ' Schritte zum spielen.   (' + B + ' Bewegungen)'
case 'es':
return 'Quedan ' + A + ' pasos de jugar.   (' + B + ' pasos)'
case 'fr':
return 'Restent ' + A + ' pas ā jouer.  (' + B + ' mouvements)'
case 'it':
return 'Restano ' + A + ' mosse da giocare.  (' + B + ' mosse)'
default:
return 'There remain ' + A + ' cells to be filled.   (' + B + ' moves)'
}
}

