Frame 4
function start_play(lev) {
sndPut.start();
level = lev;
gotoAndPlay(_currentframe + 1);
}
level = 0;
level_txt = "";
mcInput._visible = false;
mcSubInput._visible = false;
i = 0;
while (i < 9) {
j = 0;
while (j < 9) {
mc = eval (("mcMasu" + i) + j);
mc._x = 70 + (j * 33);
mc._y = 40 + (i * 33);
if (i > 2) {
mc._y = mc._y + 2;
}
if (i > 5) {
mc._y = mc._y + 2;
}
if (j > 2) {
mc._x = mc._x + 2;
}
if (j > 5) {
mc._x = mc._x + 2;
}
mc.gotoAndStop("fix");
mc.num = 0;
mc.num_txt = "";
mc.sub0 = "";
mc.sub1 = "";
mc.sub2 = "";
mc.sub3 = "";
j++;
}
i++;
}
sndInput = new Sound();
sndInput.attachSound("w_kanji.wav");
sndDelete = new Sound();
sndDelete.attachSound("w_bad.wav");
sndPut = new Sound();
sndPut.attachSound("wav_put1.wav");
Frame 5
gotoAndStop ("start");
Frame 9
gotoAndStop ("start");
Frame 14
function erase_ok(n) {
var _local2;
var _local1;
var _local3;
var _local6;
var _local8;
var _local7;
var _local5;
var _local4;
var _local9 = ans[n];
if (_local9 == 0) {
return(0);
}
ng = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
_local2 = 0;
while (_local2 < 81) {
if (_local2 == n) {
} else if (ans[_local2] == 0) {
} else {
ng[_local2] = 1;
if (ans[_local2] != _local9) {
} else {
_local8 = Math.floor(_local2 % 9);
_local1 = 0;
while (_local1 < 9) {
ng[(_local1 * 9) + _local8] = 1;
_local1++;
}
_local7 = Math.floor(_local2 / 9);
_local1 = 0;
while (_local1 < 9) {
ng[(_local7 * 9) + _local1] = 1;
_local1++;
}
_local5 = Math.floor(_local8 / 3) * 3;
_local4 = Math.floor(_local7 / 3) * 3;
_local1 = 0;
while (_local1 < 3) {
_local3 = 0;
while (_local3 < 3) {
ng[((_local4 + _local1) * 9) + (_local5 + _local3)] = 1;
_local3++;
}
_local1++;
}
}
}
_local2++;
}
_local6 = 0;
var _local11 = Math.floor(n % 9);
_local2 = 0;
while (_local2 < 9) {
if (ng[(_local2 * 9) + _local11]) {
_local6++;
}
_local2++;
}
if (_local6 == 8) {
return(1);
}
_local6 = 0;
var _local10 = Math.floor(n / 9);
_local2 = 0;
while (_local2 < XMAX) {
if (ng[(_local10 * 9) + _local2]) {
_local6++;
}
_local2++;
}
if (_local6 == 8) {
return(1);
}
_local6 = 0;
_local5 = Math.floor(_local11 / 3) * 3;
_local4 = Math.floor(_local10 / 3) * 3;
_local2 = 0;
while (_local2 < 3) {
_local1 = 0;
while (_local1 < 3) {
if (ng[((_local4 + _local2) * 9) + (_local5 + _local1)]) {
_local6++;
}
_local1++;
}
_local2++;
}
if (_local6 == 8) {
return(1);
}
return(0);
}
function get_used_c(n) {
var _local1;
var _local2;
used = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var _local7 = Math.floor(n % 9);
_local1 = 0;
while (_local1 < 9) {
used[ans[(_local1 * 9) + _local7]] = 1;
_local1++;
}
var _local6 = Math.floor(n / 9);
_local1 = 0;
while (_local1 < 9) {
used[ans[(_local6 * 9) + _local1]] = 1;
_local1++;
}
var _local4 = Math.floor(_local7 / 3) * 3;
var _local3 = Math.floor(_local6 / 3) * 3;
_local1 = 0;
while (_local1 < 3) {
_local2 = 0;
while (_local2 < 3) {
used[ans[((_local3 + _local1) * 9) + (_local4 + _local2)]] = 1;
_local2++;
}
_local1++;
}
var _local5 = 0;
_local1 = 1;
while (_local1 < 10) {
if (used[_local1]) {
_local5++;
}
_local1++;
}
return(_local5);
}
function click_masu(x, y) {
mcSubInput._visible = false;
mc = eval (("mcMasu" + y) + x);
mcInput._visible = true;
mcInput._x = mc._x;
mcInput._y = mc._y;
masu_x = x;
masu_y = y;
sndInput.start();
}
function input_num(num) {
mcInput._visible = false;
var i;
var j;
var f = 0;
i = 0;
while (i < 9) {
mc = eval (("mcMasu" + masu_y) + i);
if (mc.num == num) {
f = 1;
}
i++;
}
i = 0;
while (i < 9) {
mc = eval (("mcMasu" + i) + masu_x);
if (mc.num == num) {
f = 1;
}
i++;
}
i = 0;
while (i < 3) {
j = 0;
while (j < 3) {
mc = eval (("mcMasu" + ((Math.floor(masu_y / 3) * 3) + i)) + ((Math.floor(masu_x / 3) * 3) + j));
if (mc.num == num) {
f = 1;
}
j++;
}
i++;
}
if ((num > 0) && (f)) {
sndDelete.start();
return(undefined);
}
mc = eval (("mcMasu" + masu_y) + masu_x);
mc.num = num;
mc.num_txt = mc.num.toString();
if (num == 0) {
mc.num_txt = "";
}
f = 0;
i = 0;
while (i < 9) {
j = 0;
while (j < 9) {
mc = eval (("mcMasu" + i) + j);
if (mc.num == 0) {
f = 1;
}
j++;
}
i++;
}
if (f == 0) {
gotoAndStop ("clear");
}
sndPut.start();
}
function click_sub(x, y, n) {
mcInput._visible = false;
mc = eval (("mcMasu" + y) + x);
ax = [0, 22, 0, 22];
ay = [0, 0, 22, 22];
mcSubInput._visible = true;
mcSubInput._x = mc._x + ax[n];
mcSubInput._y = mc._y + ay[n];
masu_x = x;
masu_y = y;
sub_n = n;
}
function input_sub(num) {
mcSubInput._visible = false;
mc = eval (("mcMasu" + masu_y) + masu_x);
var a = Number(num);
var s = a.toString();
if (num == 0) {
s = "";
}
switch (sub_n) {
case 0 :
mc.sub0 = s;
return;
case 1 :
mc.sub1 = s;
return;
case 2 :
mc.sub2 = s;
return;
case 3 :
mc.sub3 = s;
}
}
this.stop();
if (level == 0) {
mcEasy.gotoAndStop(1);
mcHard.gotoAndStop(2);
} else {
mcEasy.gotoAndStop(2);
mcHard.gotoAndStop(1);
}
mcInput._visible = false;
mc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3, 6, 1, 8, 9, 2, 5, 4];
fmt = new Array(81);
r = Math.floor(Math.random() * 4);
r = 0;
fmt = eval ("fmt" + r);
cnv = new Array(10);
i = 1;
while (i <= 9) {
cnv[i] = i;
i++;
}
i = 1;
while (i <= 9) {
r = 1 + Math.floor(Math.random() * 9);
tmp = cnv[i];
cnv[i] = cnv[r];
cnv[r] = tmp;
i++;
}
i = 0;
while (i < 81) {
d = fmt[i];
ans[i] = cnv[d];
i++;
}
list = new Array(81);
lc = 0;
do {
lc = 0;
i = 0;
while (i < 81) {
if (ans[i]) {
list[lc] = i;
lc++;
}
i++;
}
if (lc == 0) {
break;
}
i = 0;
while (i < lc) {
r = Math.floor(Math.random() * lc);
tmp = list[i];
list[i] = list[r];
list[r] = tmp;
i++;
}
uc = ((level == 0) ? 9 : 8);
f = 0;
i = 0;
while (i < lc) {
n = list[i];
if (erase_ok(n)) {
ans[n] = 0;
f = 1;
} else if (get_used_c(n) >= uc) {
ans[n] = 0;
f = 1;
}
if (f) {
break;
}
i++;
}
} while (f != 0);
c = 0;
i = 0;
while (i < 9) {
j = 0;
while (j < 9) {
mc = eval (("mcMasu" + i) + j);
mc.num = ans[c];
mc.sub0 = "";
mc.sub1 = "";
mc.sub2 = "";
mc.sub3 = "";
if (ans[c] == 0) {
mc.gotoAndStop("input");
mc.num_txt = "";
} else {
mc.gotoAndStop("fix");
mc.num_txt = mc.num.toString();
}
c++;
j++;
}
i++;
}
Instance of Symbol 73 MovieClip "mcEasy" in Frame 14
on (press) {
_parent.level = 0;
_parent.gotoAndPlay("restart");
}
Instance of Symbol 75 MovieClip "mcHard" in Frame 14
on (press) {
_parent.level = 1;
_parent.gotoAndPlay("restart");
}
Frame 19
this.stop();
i = 0;
while (i < 9) {
j = 0;
while (j < 9) {
mc = eval (("mcMasu" + i) + j);
mc.gotoAndStop("fix");
j++;
}
i++;
}
Symbol 11 Button
on (press) {
var y = Number(this._name.charAt(6));
var x = Number(this._name.charAt(7));
_parent.click_masu(x, y);
}
Symbol 12 Button
on (press) {
var y = Number(this._name.charAt(6));
var x = Number(this._name.charAt(7));
_parent.click_sub(x, y, 0);
}
Symbol 13 Button
on (press) {
var y = Number(this._name.charAt(6));
var x = Number(this._name.charAt(7));
_parent.click_sub(x, y, 1);
}
Symbol 14 Button
on (press) {
var y = Number(this._name.charAt(6));
var x = Number(this._name.charAt(7));
_parent.click_sub(x, y, 2);
}
Symbol 15 Button
on (press) {
var y = Number(this._name.charAt(6));
var x = Number(this._name.charAt(7));
_parent.click_sub(x, y, 3);
}
Symbol 23 MovieClip Frame 1
this.stop();
Symbol 26 Button
on (press) {
_parent.input_num(1);
}
Symbol 27 Button
on (press) {
_parent.input_num(2);
}
Symbol 28 Button
on (press) {
_parent.input_num(3);
}
Symbol 29 Button
on (press) {
_parent.input_num(4);
}
Symbol 30 Button
on (press) {
_parent.input_num(5);
}
Symbol 31 Button
on (press) {
_parent.input_num(6);
}
Symbol 32 Button
on (press) {
_parent.input_num(7);
}
Symbol 33 Button
on (press) {
_parent.input_num(8);
}
Symbol 34 Button
on (press) {
_parent.input_num(9);
}
Symbol 35 Button
on (press) {
_parent.input_num(0);
}
Symbol 49 Button
on (press) {
_parent.input_sub(1);
}
Symbol 50 Button
on (press) {
_parent.input_sub(2);
}
Symbol 51 Button
on (press) {
_parent.input_sub(3);
}
Symbol 52 Button
on (press) {
_parent.input_sub(4);
}
Symbol 53 Button
on (press) {
_parent.input_sub(5);
}
Symbol 54 Button
on (press) {
_parent.input_sub(6);
}
Symbol 55 Button
on (press) {
_parent.input_sub(7);
}
Symbol 56 Button
on (press) {
_parent.input_sub(8);
}
Symbol 57 Button
on (press) {
_parent.input_sub(9);
}
Symbol 58 Button
on (press) {
_parent.input_sub(0);
}
Symbol 73 MovieClip Frame 1
this.stop();
Symbol 75 MovieClip Frame 1
this.stop();
Symbol 80 Button
on (press) {
getURL ("http://www.gamedesign.jp/");
}
Symbol 83 MovieClip Frame 9
this.stop();