Frame 1
var countDownTime = 5;
var lastTime = getTimer();
splashButton._alpha = 0;
stop();
onEnterFrame = function () {
if ((countDownTime > 0) && (splashButton._alpha < 100)) {
splashButton._alpha = splashButton._alpha + 2;
}
if (getTimer() >= (lastTime + 1000)) {
lastTime = lastTime + 1000;
countDownTime--;
}
splashButton.onRelease = function () {
getURL ("http://www.playzi.com/default.aspx?lnkid=110342", "_blank");
};
if (countDownTime <= 0) {
splashButton._alpha = splashButton._alpha - 2;
if (splashButton._alpha < 0) {
splashButton._alpha = 0;
}
}
if ((countDownTime <= 0) && (splashButton._alpha == 0)) {
delete onEnterFrame;
gotoAndStop (2);
}
};
Frame 2
stop();
movieLoaded = this.getBytesLoaded();
movieTotal = this.getBytesTotal();
percentage = Math.floor((movieLoaded / movieTotal) * 100);
onEnterFrame = function () {
playziButton.onRelease = function () {
getURL ("http://www.playzi.com/default.aspx?lnkid=110342", "_blank");
};
if (loadScreen._currentFrame >= 101) {
if (percentage >= 100) {
delete onEnterFrame;
gotoAndStop (4);
}
}
};
Frame 3
gotoAndPlay (3);
Frame 4
com.novelgames.flashgames.common.MainDevelopment.initialize(this);
Symbol 41 MovieClip [selectButton] Frame 1
#initclip 14
Object.registerClass("selectButton", com.novelgames.flashgames.sudoku.SelectButton);
#endinitclip
Symbol 45 MovieClip [muteButton] Frame 1
#initclip 9
Object.registerClass("muteButton", com.novelgames.flashgames.common.MuteButton);
#endinitclip
Symbol 74 MovieClip [block] Frame 1
#initclip 10
Object.registerClass("block", com.novelgames.flashgames.sudoku.Block);
#endinitclip
Symbol 80 MovieClip [undoButton] Frame 1
#initclip 11
Object.registerClass("undoButton", com.novelgames.flashgames.sudoku.SelectButton);
#endinitclip
Symbol 88 MovieClip [gameOverDialog] Frame 1
#initclip 12
Object.registerClass("gameOverDialog", com.novelgames.flashgames.sudoku.GameOverDialog);
#endinitclip
Symbol 88 MovieClip [gameOverDialog] Frame 20
showFinished();
Symbol 107 MovieClip [game] Frame 1
#initclip 13
Object.registerClass("game", com.novelgames.flashgames.sudoku.Game);
#endinitclip
Symbol 179 MovieClip [__Packages.com.novelgames.flashgames.common.MuteButton] Frame 0
class com.novelgames.flashgames.common.MuteButton extends MovieClip
{
var gotoAndStop;
function MuteButton () {
super();
if (com.novelgames.flashgames.common.NewSound.getIsMuteAll()) {
showOff();
} else {
showOn();
}
}
function onPress() {
if (com.novelgames.flashgames.common.NewSound.getIsMuteAll()) {
com.novelgames.flashgames.common.NewSound.unmuteAll();
showOn();
} else {
com.novelgames.flashgames.common.NewSound.muteAll();
showOff();
}
}
function showOff() {
gotoAndStop("off");
}
function showOn() {
gotoAndStop("on");
}
}
Symbol 180 MovieClip [__Packages.com.novelgames.flashgames.common.NewSound] Frame 0
class com.novelgames.flashgames.common.NewSound extends Sound
{
var attachSound, setVolume, target, symbolName;
function NewSound (target, symbolName) {
super(target);
var _local3;
attachSound(symbolName);
setVolume(volumeAll);
this.target = target;
this.symbolName = symbolName;
sounds.push(this);
_local3 = 0;
while (_local3 < sounds.length) {
if (sounds[_local3] == this) {
} else if ((sounds[_local3].target == target) && (sounds[_local3].symbolName == symbolName)) {
sounds.splice(_local3, 1);
_local3--;
}
_local3++;
}
}
static function setVolumeAll(volume) {
var _local1;
volumeAll = volume;
_local1 = 0;
while (_local1 < sounds.length) {
sounds[_local1].setVolume(volume);
_local1++;
}
}
static function muteAll() {
setVolumeAll(0);
}
static function unmuteAll() {
setVolumeAll(100);
}
static function getIsMuteAll() {
return(volumeAll == 0);
}
static var sounds = new Array();
static var volumeAll = 100;
}
Symbol 181 MovieClip [__Packages.com.novelgames.flashgames.sudoku.Block] Frame 0
class com.novelgames.flashgames.sudoku.Block extends MovieClip
{
var _x, _y, index, gotoAndStop, button, value, valueDisplay;
function Block () {
super();
}
function initialize(x, y, index, value) {
_x = x;
_y = y;
this.index = index;
if (value == -1) {
gotoAndStop("variable");
button.onRelease = function () {
this._parent._parent._parent.putValue(this._parent.index);
};
} else {
gotoAndStop("fixed");
}
setValue(value);
}
function setValue(value) {
this.value = ((value == -1) ? "" : ("" + value));
if (value == -1) {
valueDisplay._visible = false;
} else {
valueDisplay._visible = true;
valueDisplay.gotoAndStop(value);
}
}
function getValue() {
return(value);
}
function setFixedValue(value) {
gotoAndStop("fixed");
setValue(value);
}
}
Symbol 182 MovieClip [__Packages.com.novelgames.flashgames.sudoku.SelectButton] Frame 0
class com.novelgames.flashgames.sudoku.SelectButton extends MovieClip
{
var _x, _y, value, valueDisplay, gotoAndStop, button;
function SelectButton () {
super();
}
function initialize(x, y, value) {
_x = x;
_y = y;
this.value = value;
valueDisplay.gotoAndStop(((value != -1) ? (value) : 10));
unselect();
}
function select() {
gotoAndStop("selected");
}
function unselect() {
gotoAndStop("notSelected");
button.onRelease = function () {
this._parent._parent._parent.selectButton(this._parent.value);
};
}
}
Symbol 183 MovieClip [__Packages.com.novelgames.flashgames.sudoku.GameOverDialog] Frame 0
class com.novelgames.flashgames.sudoku.GameOverDialog extends MovieClip
{
var gotoAndStop, gotoAndPlay, stop, _parent, playAgainButton;
function GameOverDialog () {
super();
gotoAndStop("hide");
}
function show() {
gotoAndPlay("show");
}
function showFinished() {
stop();
_parent.showEnterHighScore();
playAgainButton.onRelease = function () {
this._parent._parent._parent.gotoTitlePage();
};
}
}
Symbol 184 MovieClip [__Packages.com.novelgames.flashgames.sudoku.Game] Frame 0
class com.novelgames.flashgames.sudoku.Game extends MovieClip
{
var question, answer, selectButtons, blocks, selectedValue, noOfBlocksSet, noOfBlocksPut, startTime, time, gameIsOver, score, hintTracker, generatingDialog, hintButton, soundSelect, soundPut, soundWrong, soundHint, soundWin, hint1, hint2, hint3, hint4, hint5, cursor, _xmouse, _ymouse, selectButtonsHolder, blocksHolder, gameOverDialog, _parent;
function Game () {
super();
question = new Array(com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS);
answer = new Array(com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS);
selectButtons = new Array(com.novelgames.flashgames.sudoku.Config.BIGDIMENSION + 1);
blocks = new Array(com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS);
selectedValue = -1;
noOfBlocksSet = 0;
noOfBlocksPut = 0;
startTime = 0;
time = 0;
gameIsOver = false;
score = 0;
hintTracker = 0;
createSelectButtons();
generateQuestion();
generatingDialog._visible = false;
startTime = getTimer();
hintButton.onRelease = function () {
this._parent.showHint();
};
soundSelect = new Sound();
soundPut = new Sound();
soundWrong = new Sound();
soundHint = new Sound();
soundWin = new Sound();
soundSelect.loadSound("soundSelect.mp3", false);
soundPut.loadSound("soundPut.mp3", false);
soundWrong.loadSound("soundWrong.mp3", false);
soundHint.loadSound("soundHint.mp3", false);
soundWin.loadSound("soundWin.mp3", false);
hint1._visible = true;
hint2._visible = true;
hint3._visible = true;
hint4._visible = true;
hint5._visible = true;
cursor._visible = false;
}
function selectButton(value) {
var _local2;
if (gameIsOver) {
return(undefined);
}
_local2 = 0;
while (_local2 < selectButtons.length) {
selectButtons[_local2].unselect();
_local2++;
}
if ((value >= 1) && (value <= com.novelgames.flashgames.sudoku.Config.BIGDIMENSION)) {
selectButtons[value - 1].select();
} else {
selectButtons[com.novelgames.flashgames.sudoku.Config.BIGDIMENSION].select();
}
selectedValue = value;
if (selectedValue == -1) {
cursor.startDrag();
cursor._x = _xmouse + 10;
cursor._y = _ymouse + 10;
cursor._visible = true;
Mouse.hide();
} else {
cursor.stopDrag();
cursor._visible = false;
Mouse.show();
}
soundSelect.start();
}
function putValue(index) {
if (gameIsOver) {
return(undefined);
}
if (!checkCanPutValue(index)) {
startTime = startTime - com.novelgames.flashgames.sudoku.Config.PUNISHMENT_WRONG;
updateTime();
soundWrong.start();
return(undefined);
}
if (selectedValue != -1) {
if (blocks[index].getValue() == "") {
noOfBlocksPut++;
}
blocks[index].setValue(selectedValue);
checkGameOver();
} else {
if (blocks[index].getValue() != "") {
noOfBlocksPut--;
}
blocks[index].setValue(selectedValue);
}
soundPut.start();
}
function onEnterFrame() {
updateTime();
}
function createSelectButtons() {
var _local2;
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.sudoku.Config.BIGDIMENSION + 1)) {
if (_local2 == com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) {
selectButtons[_local2] = selectButtonsHolder.attachMovie("undoButton", "selectButton", _local2);
selectButtons[_local2].initialize(20, 250, ((_local2 < com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) ? (_local2 + 1) : -1));
} else {
selectButtons[_local2] = selectButtonsHolder.attachMovie("selectButton", "selectButton" + _local2, _local2);
selectButtons[_local2].initialize((_local2 % com.novelgames.flashgames.sudoku.Config.SELECTBUTTON_COLUMNS) * com.novelgames.flashgames.sudoku.Config.SELECTBUTTON_SPACINGX, (Math.floor(_local2 / com.novelgames.flashgames.sudoku.Config.SELECTBUTTON_COLUMNS) * com.novelgames.flashgames.sudoku.Config.SELECTBUTTON_SPACINGY) + 20, ((_local2 < com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) ? (_local2 + 1) : -1));
}
_local2++;
}
selectButtons[0].select();
selectedValue = 1;
}
function generateQuestion() {
var _local4 = new Object();
var _local2;
var _local3;
var _local5;
prepareAnswer();
_local4.blocks = new Array(com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS);
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) {
_local3 = 0;
while (_local3 < com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) {
_local4.blocks[(_local2 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local3] = new Object();
_local4.blocks[(_local2 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local3].valueIsPossible = new Array(10);
_local5 = 1;
while (_local5 <= com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) {
_local4.blocks[(_local2 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local3].valueIsPossible[_local5] = true;
_local5++;
}
_local4.blocks[(_local2 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local3].noOfPossibleValues = com.novelgames.flashgames.sudoku.Config.BIGDIMENSION;
_local4.blocks[(_local2 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local3].setValue = -1;
_local4.blocks[(_local2 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local3].derivedValue = -1;
_local3++;
}
_local2++;
}
_local4.noOfBlocksSetOrDerived = 0;
while (_local4.noOfBlocksSetOrDerived < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
if (deriveBlock(_local4)) {
continue;
}
setNextBlock(_local4);
}
removeDerivableBlocks(_local4);
question = new Array(com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS);
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
question[_local2] = _local4.blocks[_local2].setValue;
_local2++;
}
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
if (question[_local2] != -1) {
noOfBlocksSet++;
}
_local2++;
}
showQuestion();
}
function prepareAnswer() {
var _local12 = [1, 2, 3, 4, 5, 6, 7, 8, 9];
var _local13 = [0, 1, 2];
var _local11 = [0, 1, 2];
var _local10 = [[0, 1, 2], [0, 1, 2], [0, 1, 2]];
var _local9 = [[0, 1, 2], [0, 1, 2], [0, 1, 2]];
var _local4;
var _local5;
var _local6;
var _local3;
var _local8;
var _local7;
var _local2;
shuffleArray(_local12);
shuffleArray(_local13);
shuffleArray(_local11);
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.DIMENSION) {
shuffleArray(_local10[_local2]);
shuffleArray(_local9[_local2]);
_local2++;
}
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
_local4 = Math.floor(_local2 / com.novelgames.flashgames.sudoku.Config.BIGDIMENSION);
_local5 = _local2 % com.novelgames.flashgames.sudoku.Config.BIGDIMENSION;
_local6 = Math.floor(_local4 / com.novelgames.flashgames.sudoku.Config.DIMENSION);
_local3 = Math.floor(_local5 / com.novelgames.flashgames.sudoku.Config.DIMENSION);
_local8 = _local4 % com.novelgames.flashgames.sudoku.Config.DIMENSION;
_local7 = _local5 % com.novelgames.flashgames.sudoku.Config.DIMENSION;
_local6 = _local13[_local6];
_local3 = _local11[_local3];
_local8 = _local10[_local6][_local8];
_local7 = _local9[_local3][_local7];
_local4 = (_local6 * com.novelgames.flashgames.sudoku.Config.DIMENSION) + _local8;
_local5 = (_local3 * com.novelgames.flashgames.sudoku.Config.DIMENSION) + _local7;
answer[_local2] = _local12[com.novelgames.flashgames.sudoku.Config.DEFAULTPATTERN[(_local4 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local5] - 1];
_local2++;
}
}
function shuffleArray(theArray) {
var _local4;
var _local1;
var _local3;
_local1 = 0;
while (_local1 < theArray.length) {
_local3 = Math.floor(Math.random() * theArray.length);
if (_local1 == _local3) {
} else {
_local4 = theArray[_local1];
theArray[_local1] = theArray[_local3];
theArray[_local3] = _local4;
}
_local1++;
}
}
function deriveBlock(info) {
var _local4 = -1;
var _local5 = false;
var _local2;
var _local6;
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
if (info.blocks[_local2].setValue != -1) {
} else if (info.blocks[_local2].derivedValue != -1) {
} else {
_local4 = getOnlyPossibleValue(info.blocks[_local2]);
if (_local4 == -1) {
_local4 = getOnlyRemainingValue(info, _local2);
}
if (_local4 != -1) {
info.blocks[_local2].derivedValue = _local4;
_local5 = true;
info.noOfBlocksSetOrDerived++;
updatePossibleValues(info, _local2);
}
}
_local2++;
}
return(_local5);
}
function getOnlyPossibleValue(infoBlock) {
var _local2 = -1;
var _local1;
if (infoBlock.noOfPossibleValues != 1) {
return(-1);
}
_local1 = 1;
while (_local1 <= com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) {
if (infoBlock.valueIsPossible[_local1]) {
if (_local2 != -1) {
return(-1);
}
_local2 = _local1;
}
_local1++;
}
return(_local2);
}
function getOnlyRemainingValue(info, index) {
var _local5;
var _local9;
var _local10;
var _local8;
var _local7;
var _local4;
var _local2;
var _local3;
_local5 = answer[index];
_local9 = Math.floor(index / com.novelgames.flashgames.sudoku.Config.BIGDIMENSION);
_local4 = 0;
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) {
if (info.blocks[(_local9 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local2].valueIsPossible[_local5]) {
_local4++;
}
_local2++;
}
if (_local4 == 1) {
return(_local5);
}
_local10 = index % com.novelgames.flashgames.sudoku.Config.BIGDIMENSION;
_local4 = 0;
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) {
if (info.blocks[(_local2 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local10].valueIsPossible[_local5]) {
_local4++;
}
_local2++;
}
if (_local4 == 1) {
return(_local5);
}
_local8 = Math.floor(_local9 / com.novelgames.flashgames.sudoku.Config.DIMENSION);
_local7 = Math.floor(_local10 / com.novelgames.flashgames.sudoku.Config.DIMENSION);
_local4 = 0;
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.DIMENSION) {
_local3 = 0;
while (_local3 < com.novelgames.flashgames.sudoku.Config.DIMENSION) {
if (info.blocks[(((_local8 * com.novelgames.flashgames.sudoku.Config.DIMENSION) + _local2) * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + ((_local7 * com.novelgames.flashgames.sudoku.Config.DIMENSION) + _local3)].valueIsPossible[_local5]) {
_local4++;
}
_local3++;
}
_local2++;
}
if (_local4 == 1) {
return(_local5);
}
return(-1);
}
function updatePossibleValues(info, index) {
var _local4;
var _local7;
var _local8;
var _local6;
var _local5;
var _local1;
var _local3;
if (info.blocks[index].setValue != -1) {
_local4 = info.blocks[index].setValue;
} else if (info.blocks[index].derivedValue != -1) {
_local4 = info.blocks[index].derivedValue;
} else {
return(undefined);
}
info.blocks[index].noOfPossibleValues = 0;
_local1 = 1;
while (_local1 <= com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) {
info.blocks[index].valueIsPossible[_local1] = false;
_local1++;
}
_local7 = Math.floor(index / com.novelgames.flashgames.sudoku.Config.BIGDIMENSION);
_local8 = index % com.novelgames.flashgames.sudoku.Config.BIGDIMENSION;
_local1 = 0;
while (_local1 < com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) {
if (info.blocks[(_local1 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local8].valueIsPossible[_local4]) {
info.blocks[(_local1 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local8].noOfPossibleValues--;
info.blocks[(_local1 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local8].valueIsPossible[_local4] = false;
}
if (info.blocks[(_local7 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local1].valueIsPossible[_local4]) {
info.blocks[(_local7 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local1].noOfPossibleValues--;
info.blocks[(_local7 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local1].valueIsPossible[_local4] = false;
}
_local1++;
}
_local6 = Math.floor(_local7 / com.novelgames.flashgames.sudoku.Config.DIMENSION);
_local5 = Math.floor(_local8 / com.novelgames.flashgames.sudoku.Config.DIMENSION);
_local1 = 0;
while (_local1 < com.novelgames.flashgames.sudoku.Config.DIMENSION) {
_local3 = 0;
while (_local3 < com.novelgames.flashgames.sudoku.Config.DIMENSION) {
if (info.blocks[(((_local6 * com.novelgames.flashgames.sudoku.Config.DIMENSION) + _local1) * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + ((_local5 * com.novelgames.flashgames.sudoku.Config.DIMENSION) + _local3)].valueIsPossible[_local4]) {
info.blocks[(((_local6 * com.novelgames.flashgames.sudoku.Config.DIMENSION) + _local1) * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + ((_local5 * com.novelgames.flashgames.sudoku.Config.DIMENSION) + _local3)].noOfPossibleValues--;
info.blocks[(((_local6 * com.novelgames.flashgames.sudoku.Config.DIMENSION) + _local1) * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + ((_local5 * com.novelgames.flashgames.sudoku.Config.DIMENSION) + _local3)].valueIsPossible[_local4] = false;
}
_local3++;
}
_local1++;
}
}
function setNextBlock(info) {
var _local2 = -1;
var _local6;
var _local7;
var _local3;
var _local4;
_local3 = 0;
while (_local3 < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
if (info.blocks[_local3].noOfPossibleValues == 2) {
_local6 = Math.floor(_local3 / com.novelgames.flashgames.sudoku.Config.BIGDIMENSION);
_local7 = _local3 % com.novelgames.flashgames.sudoku.Config.BIGDIMENSION;
_local4 = 0;
while (_local4 < com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) {
_local2 = (_local6 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local4;
if ((_local2 != _local3) && (info.blocks[_local3].valueIsPossible[answer[_local2]])) {
break;
}
_local2 = (_local4 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local7;
if ((_local2 != _local3) && (info.blocks[_local3].valueIsPossible[answer[_local2]])) {
break;
}
_local4++;
}
}
_local3++;
}
if (_local2 == -1) {
_local2 = Math.floor(Math.random() * com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS);
while ((info.blocks[_local2].setValue != -1) || (info.blocks[_local2].derivedValue != -1)) {
_local2 = (_local2 + 1) % com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS;
}
}
info.blocks[_local2].setValue = answer[_local2];
info.noOfBlocksSetOrDerived++;
updatePossibleValues(info, _local2);
}
function removeDerivableBlocks(info) {
var _local2;
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
info.blocks[_local2].derivedValue = -1;
_local2++;
}
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
if (info.blocks[_local2].setValue == -1) {
} else if (getBlockIsDerivable(info, _local2)) {
info.blocks[_local2].setValue = -1;
}
_local2++;
}
}
function getBlockIsDerivable(info, index) {
var _local4 = info.blocks[index].setValue;
var _local5 = 0;
var _local7 = false;
var _local2;
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
if (info.blocks[_local2].setValue == _local4) {
_local5++;
}
_local2++;
}
if (_local5 < 3) {
return(false);
}
info.blocks[index].setValue = -1;
resetPossibleValues(info);
if ((getOnlyPossibleValue(info.blocks[index]) == _local4) || (getOnlyRemainingValue(info, index) == _local4)) {
_local7 = true;
}
info.blocks[index].setValue = _local4;
return(_local7);
}
function resetPossibleValues(info) {
var _local2;
var _local3;
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
info.blocks[_local2].noOfPossibleValues = com.novelgames.flashgames.sudoku.Config.BIGDIMENSION;
_local3 = 1;
while (_local3 <= com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) {
info.blocks[_local2].valueIsPossible[_local3] = true;
_local3++;
}
_local2++;
}
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
if (info.blocks[_local2].setValue == -1) {
} else {
updatePossibleValues(info, _local2);
}
_local2++;
}
}
function showQuestion() {
var _local3;
var _local2;
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
blocks[_local2] = blocksHolder.attachMovie("block", "block" + _local2, _local2);
blocks[_local2].initialize((_local2 % com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) * com.novelgames.flashgames.sudoku.Config.BLOCK_WIDTH, Math.floor(_local2 / com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) * com.novelgames.flashgames.sudoku.Config.BLOCK_HEIGHT, _local2, question[_local2]);
_local2++;
}
}
function checkCanPutValue(index) {
var _local6 = Math.floor(index / com.novelgames.flashgames.sudoku.Config.BIGDIMENSION);
var _local7 = index % com.novelgames.flashgames.sudoku.Config.BIGDIMENSION;
var _local5 = Math.floor(_local6 / com.novelgames.flashgames.sudoku.Config.DIMENSION);
var _local4 = Math.floor(_local7 / com.novelgames.flashgames.sudoku.Config.DIMENSION);
var _local2;
var _local3;
if (selectedValue == -1) {
return(true);
}
if (blocks[index].getValue() == selectedValue) {
return(true);
}
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) {
if (blocks[(_local6 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local2].getValue() == selectedValue) {
return(false);
}
if (blocks[(_local2 * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + _local7].getValue() == selectedValue) {
return(false);
}
_local2++;
}
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.DIMENSION) {
_local3 = 0;
while (_local3 < com.novelgames.flashgames.sudoku.Config.DIMENSION) {
if (blocks[(((_local5 * com.novelgames.flashgames.sudoku.Config.DIMENSION) + _local2) * com.novelgames.flashgames.sudoku.Config.BIGDIMENSION) + ((_local4 * com.novelgames.flashgames.sudoku.Config.DIMENSION) + _local3)].getValue() == selectedValue) {
return(false);
}
_local3++;
}
_local2++;
}
return(true);
}
function checkGameOver() {
if ((noOfBlocksPut + noOfBlocksSet) >= com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
gameOver();
}
}
function showHint() {
var _local3;
var _local2;
if (hintTracker == com.novelgames.flashgames.sudoku.Config.MAX_HINT) {
soundWrong.start();
return(undefined);
}
if (gameIsOver) {
return(undefined);
}
hintTracker++;
if (hintTracker > 0) {
hint1._visible = false;
}
if (hintTracker > 1) {
hint2._visible = false;
}
if (hintTracker > 2) {
hint3._visible = false;
}
if (hintTracker > 3) {
hint4._visible = false;
}
if (hintTracker > 4) {
hint5._visible = false;
}
startTime = startTime - com.novelgames.flashgames.sudoku.Config.PUNISHMENT_HINT;
updateTime();
soundHint.start();
_local2 = 0;
while (_local2 < com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS) {
if ((blocks[_local2].getValue() != "") && (blocks[_local2].getValue() != answer[_local2])) {
blocks[_local2].setFixedValue(answer[_local2]);
noOfBlocksSet++;
noOfBlocksPut--;
return(undefined);
}
_local2++;
}
_local3 = Math.floor(Math.random() * com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS);
while (blocks[_local3].getValue() != "") {
_local3 = (_local3 + 1) % com.novelgames.flashgames.sudoku.Config.TOTALNOOFBLOCKS;
}
blocks[_local3].setFixedValue(answer[_local3]);
noOfBlocksSet++;
checkGameOver();
}
function updateTime() {
if (gameIsOver) {
return(undefined);
}
time = Math.floor((getTimer() - startTime) / 1000);
}
function gameOver() {
gameIsOver = true;
score = com.novelgames.flashgames.sudoku.Config.SCORE_BASE - (com.novelgames.flashgames.sudoku.Config.SCORE_PERSECOND * time);
if (score < 0) {
score = 0;
}
gameOverDialog.gotoAndPlay(2);
soundWin.start();
}
function showEnterHighScore() {
_parent.showEnterHighScore(score);
}
}
Symbol 185 MovieClip [__Packages.com.novelgames.flashgames.sudoku.Config] Frame 0
class com.novelgames.flashgames.sudoku.Config
{
function Config () {
}
static var DIMENSION = 3;
static var BLOCKS_X = 215;
static var BLOCKS_Y = 65;
static var BIGDIMENSION = DIMENSION * DIMENSION;
static var TOTALNOOFBLOCKS = BIGDIMENSION * BIGDIMENSION;
static var BLOCK_WIDTH = 40;
static var BLOCK_HEIGHT = 40;
static var SELECTBUTTON_SPACINGX = 90;
static var SELECTBUTTON_SPACINGY = 70;
static var SELECTBUTTON_COLUMNS = 3;
static var PUNISHMENT_WRONG = 10000;
static var PUNISHMENT_HINT = 50000;
static var MAX_HINT = 5;
static var SCORE_BASE = 55000;
static var SCORE_PERSECOND = 50;
static var DEFAULTPATTERN = [7, 6, 1, 9, 3, 4, 8, 2, 5, 3, 5, 4, 6, 2, 8, 1, 9, 7, 9, 2, 8, 1, 5, 7, 6, 3, 4, 2, 1, 9, 5, 4, 6, 3, 7, 8, 4, 8, 3, 2, 7, 9, 5, 1, 6, 5, 7, 6, 3, 8, 1, 9, 4, 2, 1, 9, 5, 7, 6, 2, 4, 8, 3, 8, 3, 2, 4, 9, 5, 7, 6, 1, 6, 4, 7, 8, 1, 3, 2, 5, 9];
static var TIPS_URL = "http://www.novelgames.com/gametips/#flashGame44";
}
Symbol 186 MovieClip [__Packages.com.novelgames.flashgames.common.MainDevelopment] Frame 0
class com.novelgames.flashgames.common.MainDevelopment extends MovieClip
{
var gotoAndStop, startButton, moreGamesButton, playziButton;
function MainDevelopment () {
super();
}
static function initialize(movieClip) {
movieClip.__proto__ = com.novelgames.flashgames.common.MainDevelopment.prototype;
movieClip.gotoTitlePage();
}
function gotoTitlePage() {
gotoAndStop("title");
startButton.onRelease = function () {
this._parent.gotoInstructionsPage();
};
moreGamesButton.onRelease = function () {
this._parent.getURL("http://www.playzi.com/default.aspx?lnkid=110342", "_blank");
};
playziButton.onRelease = function () {
this._parent.getURL("http://www.playzi.com/default.aspx?lnkid=110342", "_blank");
};
}
function gotoInstructionsPage() {
gotoAndStop("instructions");
startButton.onRelease = function () {
this._parent.gotoGamePage();
};
playziButton.onRelease = function () {
this._parent.getURL("http://www.playzi.com/default.aspx?lnkid=110342", "_blank");
};
}
function gotoGamePage() {
gotoAndStop("game");
playziButton.onRelease = function () {
this._parent.getURL("http://www.playzi.com/default.aspx?lnkid=110342", "_blank");
};
}
function showHighScores() {
trace("showHighScores()");
}
function showEnterHighScore(score) {
trace(("showEnterHighScore(" + score) + ")");
}
}