[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

3.8

Lights Out game solver.

Asked by burningmace in Programming Languages

Tags: solver, out, lights

The following page contains a JavaScript lights out game. I am trying to make a solver for my Visual Basic lights out game and am having trouble doing it. Could somebody give me a VB translation of this please??? I have also included my VB program code at the bottom.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=x-sjis">
<TITLE>
A Lights Out Puzzle with Solver
</TITLE>
</HEAD>

<BODY TEXT="#000000" BGCOLOR="#C0E0FF" ALINK="#000000" VLINK="#000000">

<H3>A Lights Out Puzzle with Solver (JavaScript)</H3>

<SCRIPT LANGUAGE="JavaScript">
<!--
// --- constants ---
var imgs = new Array();     // string[], URLs of tile images
var nums = new Array();     // string[], URLs of digit images
var maxcolcount = 7;        // integer, maximum number of columns
var maxrowcount = 7;        // integer, maximum number of rows

var outrangeimg = "outrange.gif";   // string, URL of empty ans cell
var emptyimg    = "empty.gif";      // string, URL of empty cell
// var nosolimg = "nosol.gif";      // string, URL of no solution image
imgs[0] = "blue.gif";
imgs[1] = "red.gif";
imgs[2] = "yellow.gif";
imgs[3] = "green.gif";
imgs[4] = "purple.gif";

// --- global variables ---
var colcount;   // integer, number of columns
var rowcount;   // integer, number of rows
var imgcount;   // integer, number of states of a tile
var cells;      // integer[row][col], current states of tiles
var steps;      // integer, current steps of operation
var playing;    // boolean, if playing
var autogen;    // boolean, if playing with an auto-generated problem

// --- initialization ---
//function onLoad(){}
init();
function init() {
    for (var val = 0; val < imgs.length; val++)
        nums[val] = "number" + val + ".gif";
    var col;
    var row;
    cells = new Array();
    for (col = 0; col < maxcolcount; col++) {
        cells[col] = new Array();
        for (row = 0; row < maxrowcount; row++)
            cells[col][row] = 0;
    }
//  playing = false;
}

// --- event handlers ---
function newSettings(){
    var dimension = document.toolbar.dimension.options[
        document.toolbar.dimension.selectedIndex].value;
    colcount = eval(dimension.substring(0,1));
    rowcount = eval(dimension.substring(2,3));
    imgcount = eval(document.toolbar.colors.options[
        document.toolbar.colors.selectedIndex].value);
    for (var col = 0; col < maxcolcount; col++)
    for (var row = 0; row < maxrowcount; row++) {
        setcellimage(col,row,emptyimg);
        setanscellimage(col,row,outrangeimg);
    }
    newGame();
}
function newGame(){
    for (var col = 0; col < colcount; col++)
    for (var row = 0; row < rowcount; row++) {
        setcell(col,row, Math.floor(Math.random() * imgcount));
        setanscellimage(col,row,outrangeimg);
    }
    playing = true;
    autogen = true;
    steps = 0;
}
function edit() {
    if (!playing) {
        for (var col = 0; col < colcount; col++)
        for (var row = 0; row < rowcount; row++)
            setcell(col,row,0);
    }
    playing = false;
    autogen = false;
}
function play() {
    playing = true;
}
function ansoperate(col,row) {
    operate(col,row);
    solve();
}
function operate(col,row) {
    if (col >= colcount || row >= rowcount) return;
    flip(col,row);
    if (playing) {
        if (col > 0)            flip(col-1, row);
        if (row > 0)            flip(col, row-1);
        if (col < colcount - 1) flip(col+1, row);
        if (row < rowcount - 1) flip(col, row+1);
        steps++;
        if (autogen && isCleared()) {
            alert("Cleared in " + steps + " steps!");
            autogen = false;
        }
    }
}
// --- operation methods ---
function setcell(col,row,val) {
    cells[col][row] = val;
    setcellimage(col,row,imgs[val]);
}
function setcellimage(col,row,imgsrc) {
    eval("document." + cellname(col,row) + ".src = '" + imgsrc + "'");
}
function setanscellimage(col,row,imgsrc) {
    eval("document.ans" + cellname(col,row) + ".src = '" + imgsrc + "'");
}
function cellname(col,row) {
    return "cell" + col + "_" + row;
}
function flip(col,row) {
    setcell(col,row,(cells[col][row] + 1) % imgcount);
}

// --- status methods ---
function isCleared(){
    var sample = cells[0][0];
    for (var col = 0; col < colcount; col++)
    for (var row = 0; row < rowcount; row++)
        if (cells[col][row] != sample) return false;
    return true;
}

// --- finite field algebra solver
function modulate(x) {
    // returns z such that 0 <= z < imgcount and x == z (mod imgcount)
    if (x >= 0) return x % imgcount;
    x = (-x) % imgcount;
    if (x == 0) return 0;
    return imgcount - x;
}
function gcd(x, y) { // call when: x >= 0 and y >= 0
    if (y == 0) return x;
    if (x == y) return x;
    if (x > y)  x = x % y; // x < y
    while (x > 0) {
        y = y % x; // y < x
        if (y == 0) return x;
        x = x % y; // x < y
    }
    return y;
}
function invert(value) { // call when: 0 <= value < imgcount
    // returns z such that value * z == 1 (mod imgcount), or 0 if no such z
    if (value <= 1) return value;
    var seed = gcd(value,imgcount);
    if (seed != 1) return 0;
    var a = 1, b = 0, x = value;    // invar: a * value + b * imgcount == x
    var c = 0, d = 1, y = imgcount; // invar: c * value + d * imgcount == y
    while (x > 1) {
        var tmp = Math.floor(y / x);
        y -= x * tmp;
        c -= a * tmp;
        d -= b * tmp;
        tmp = a;  a = c;  c = tmp;
        tmp = b;  b = d;  d = tmp;
        tmp = x;  x = y;  y = tmp;
    }
    return a;
}

// --- finite field matrix solver

var mat;    // integer[i][j]
var cols;   // integer[]
var m;      // count of rows of the matrix
var n;      // count of columns of the matrix
var np;     // count of columns of the enlarged matrix
var r;      // minimum rank of the matrix
var maxr;   // maximum rank of the matrix

function a(i,j)   { return mat[i][cols[j]]; }
function setmat(i,j,val) { mat[i][cols[j]] = modulate(val); }

function solve() {
    var col;
    var row;
    for (var goal = 0; goal < imgcount; goal++) {
        if (solveProblem(goal)) { // found an integer solution
            var anscols = new Array();
            var j;
            for (j = 0; j < n; j++)  anscols[cols[j]] = j;
            for (col = 0; col < colcount; col++)
            for (row = 0; row < rowcount; row++) {
                var value;
                j = anscols[row * colcount + col];
                if (j < r) value = a(j,n); else value = 0;
                setanscellimage(col,row,nums[value]);
            }
            return;
        }
    }
    // (aborted or) no solution
    for (var col = 0; col < colcount; col++)
    for (var row = 0; row < rowcount; row++)
        setanscellimage(col,row,outrangeimg);
    alert("No solutions!"); // setanscellimage(0,0,nosolimg);
}

//  // general solution:
//  if (j < r) {
//      for (var jj = r; jj < n; jj++) + any[jj] * modulate(-a(j,jj));
//  }
//  else {
//      + any[j];
//  }

function checkNormal() {
    var size = colcount * rowcount;
    m = size;
    n = size;
    np = n + size;
    initMatrix();
    for (var col = 0; col < colcount; col++)
    for (var row = 0; row < rowcount; row++) {
        var i = row * colcount + col;
        var line = mat[i];
        for (var j = n; j < np; j++)  line[j] = 0;
        line[n + i] = 1;
    }
    if (sweep())
         alert("Always solvable");
    else alert("Not always solvable ( "
        + Math.pow(imgcount,n-r) + " identity patterns )");
}
function initMatrix() {
    maxr = Math.min(m,n);
    mat = new Array();
    for (var col = 0; col < colcount; col++)
    for (var row = 0; row < rowcount; row++) {
        var i = row * colcount + col;
        var line = new Array();
        mat[i] = line;
        for (var j = 0; j < n; j++) line[j] = 0;
        line[i] = 1;
        if (col > 0)            line[i - 1]        = 1;
        if (row > 0)            line[i - colcount] = 1;
        if (col < colcount - 1) line[i + 1]        = 1;
        if (row < rowcount - 1) line[i + colcount] = 1;
    }
    cols = new Array();
    for (var j = 0; j < np; j++) cols[j] = j;
}
function solveProblem(goal) {
    var size = colcount * rowcount;
    m = size;
    n = size;
    np = n + 1;
    initMatrix();
    for (var col = 0; col < colcount; col++)
    for (var row = 0; row < rowcount; row++)
        mat[row * colcount + col][n] = modulate(goal - cells[col][row]);
    return sweep();
}
function sweep() {
    for (r = 0; r < maxr; r++) {
        if (!sweepStep()) return false; // failed in founding a solution
        if (r == maxr) break;
    }
    return true; // successfully found a solution
}
function sweepStep() {
    var i;
    var j;
    var finished = true;
    for (j = r; j < n; j++) {
        for (i = r; i < m; i++) {
            var aij = a(i,j);
            if (aij != 0)  finished = false;
            var inv = invert(aij);
            if (inv != 0) {
                for (var jj = r; jj < np; jj++)
                    setmat(i,jj, a(i,jj) * inv);
                doBasicSweep(i,j);
                return true;
            }
        }
    }
    if (finished) { // we have: 0x = b (every matrix element is 0)
        maxr = r;   // rank(A) == maxr
        for (j = n; j < np; j++)
            for (i = r; i < m; i++)
                if (a(i,j) != 0)  return false; // no solution since b != 0
        return true;    // 0x = 0 has solutions including x = 0
    }
    alert("Internal error - contact the author to obtain a full solver");
    return false;   // failed in founding a solution
}

function swap(array,x,y) {
    var tmp  = array[x];
    array[x] = array[y];
    array[y] = tmp;
}
function doBasicSweep(pivoti, pivotj) {
    if (r != pivoti) swap(mat,r,pivoti);
    if (r != pivotj) swap(cols,r,pivotj);
    for (var i = 0; i < m; i++) {
        if (i != r) {
            var air = a(i,r);
            if (air != 0)
                for (var j = r; j < np; j++)
                    setmat(i,j, a(i,j) - a(r,j) * air);
        }
    }
}

// --- document writer ---
function createField(imgsrc, prefix) {
    var row;
    var col;
    for (row = 0; row < maxrowcount; row++) {
        for (col = 0; col < maxcolcount; col++) {
            document.write("<IMG SRC='" + imgsrc);
            document.write("' NAME='" + prefix + cellname(col,row));
            document.write("' onmousedown='javascript:" + prefix);
            document.write("operate(" + col + "," + row + ")' ");
            document.write("ondblclick='javascript:" + prefix);
            document.write("operate(" + col + "," + row + ")'>");
        }
        document.write("<BR>");
    }
}

// --- entry point ---
//onLoad();
//-->
</SCRIPT>

<FORM NAME="toolbar">
<TABLE>
<TR><TD>
<INPUT TYPE="button" VALUE="NEW GAME" onClick="javascript:newGame()">
<INPUT TYPE="button" VALUE="SOLVE"    onClick="javascript:solve()">
<INPUT TYPE="button" VALUE="EDIT"     onClick="javascript:edit()">
<INPUT TYPE="button" VALUE="PLAY"     onClick="javascript:play()">
<TR HEIGHT=40pt><TD>
<SELECT NAME="colors" ONCHANGE="javascript:newSettings()">
<OPTION VALUE="2" SELECTED>2 colors
<OPTION VALUE="3"         >3 colors
<OPTION VALUE="4"         >4 colors
<OPTION VALUE="5"         >5 colors
</SELECT>
<SELECT NAME="dimension" ONCHANGE="javascript:newSettings()">
<OPTION VALUE="3x3"         >3 x 3
<OPTION VALUE="4x3"         >4 x 3
<OPTION VALUE="4x4"         >4 x 4
<OPTION VALUE="5x4"         >5 x 4
<OPTION VALUE="5x5"         >5 x 5
<OPTION VALUE="6x5" SELECTED>6 x 5
<OPTION VALUE="6x6"         >6 x 6
<OPTION VALUE="7x7"         >7 x 7
</SELECT>
<INPUT TYPE="button" VALUE="<-- CHECK" onClick="javascript:checkNormal()">
</TABLE>
</FORM>

<SCRIPT LANGUAGE="JavaScript">
<!--
document.write("<TABLE><TR><TD>");
createField(emptyimg, "");
document.write("<TD WIDTH=10%><TD>");
createField(outrangeimg, "ans");
document.write("</TABLE>");
newSettings();
//-->
</SCRIPT>

</BODY></HTML>


Here is my VB game:


Dim stat(35) As Boolean, clicks As Integer 'stat is for the save function and clicks is no. of clicks in game.

'Consts and APIs
Private Const GENERIC_WRITE = &H40000000
Private Const OPEN_EXISTING = 3
Private Const FILE_SHARE_READ = &H1
Private Const FILE_SHARE_WRITE = &H2
Private Const CREATE_NEW = 1
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Private Sub Form_Load()
Dim col As Long
clicks = 0
dlgOpen.InitDir = App.Path
dlgSave.InitDir = App.Path
For i = 0 To 35
Call Randomize
If Int(Rnd * 2) = 1 Then col = vbRed Else col = vbBlue 'Randomly generate game.
lblBox(i).BackColor = col
Next i
End Sub

Private Sub lblBox_Click(Index As Integer)
'This sub inverts the 5 boxes.

clicks = clicks + 1
If lblBox(Index).BackColor = vbRed Then lblBox(Index).BackColor = vbBlue Else lblBox(Index).BackColor = vbRed
If Index = 0 Then
If lblBox(Index + 1).BackColor = vbRed Then lblBox(Index + 1).BackColor = vbBlue Else lblBox(Index + 1).BackColor = vbRed
If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed
GoTo CheckWin
End If
If Index > 0 And Index < 5 Then
If lblBox(Index + 1).BackColor = vbRed Then lblBox(Index + 1).BackColor = vbBlue Else lblBox(Index + 1).BackColor = vbRed
If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed
If lblBox(Index - 1).BackColor = vbRed Then lblBox(Index - 1).BackColor = vbBlue Else lblBox(Index - 1).BackColor = vbRed
GoTo CheckWin
End If
If Index = 5 Then
If lblBox(Index - 1).BackColor = vbRed Then lblBox(Index - 1).BackColor = vbBlue Else lblBox(Index - 1).BackColor = vbRed
If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed
GoTo CheckWin
End If
If Index > 30 And Index < 35 Then
If lblBox(Index + 1).BackColor = vbRed Then lblBox(Index + 1).BackColor = vbBlue Else lblBox(Index + 1).BackColor = vbRed
If lblBox(Index - 6).BackColor = vbRed Then lblBox(Index - 6).BackColor = vbBlue Else lblBox(Index - 6).BackColor = vbRed
If lblBox(Index - 1).BackColor = vbRed Then lblBox(Index - 1).BackColor = vbBlue Else lblBox(Index - 1).BackColor = vbRed
GoTo CheckWin
End If
If Index = 30 Then
If lblBox(Index + 1).BackColor = vbRed Then lblBox(Index + 1).BackColor = vbBlue Else lblBox(Index + 1).BackColor = vbRed
If lblBox(Index - 6).BackColor = vbRed Then lblBox(Index - 6).BackColor = vbBlue Else lblBox(Index - 6).BackColor = vbRed
GoTo CheckWin
End If
If Index = 35 Then
If lblBox(Index - 1).BackColor = vbRed Then lblBox(Index - 1).BackColor = vbBlue Else lblBox(Index - 1).BackColor = vbRed
If lblBox(Index - 6).BackColor = vbRed Then lblBox(Index - 6).BackColor = vbBlue Else lblBox(Index - 6).BackColor = vbRed
GoTo CheckWin
End If
If Index = 6 Then
If lblBox(Index + 1).BackColor = vbRed Then lblBox(Index + 1).BackColor = vbBlue Else lblBox(Index + 1).BackColor = vbRed
If lblBox(Index - 6).BackColor = vbRed Then lblBox(Index - 6).BackColor = vbBlue Else lblBox(Index - 6).BackColor = vbRed
If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed
GoTo CheckWin
End If
If Index = 12 Then
If lblBox(Index + 1).BackColor = vbRed Then lblBox(Index + 1).BackColor = vbBlue Else lblBox(Index + 1).BackColor = vbRed
If lblBox(Index - 6).BackColor = vbRed Then lblBox(Index - 6).BackColor = vbBlue Else lblBox(Index - 6).BackColor = vbRed
If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed
GoTo CheckWin
End If
If Index = 18 Then
If lblBox(Index + 1).BackColor = vbRed Then lblBox(Index + 1).BackColor = vbBlue Else lblBox(Index + 1).BackColor = vbRed
If lblBox(Index - 6).BackColor = vbRed Then lblBox(Index - 6).BackColor = vbBlue Else lblBox(Index - 6).BackColor = vbRed
If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed
GoTo CheckWin
End If
If Index = 24 Then
If lblBox(Index + 1).BackColor = vbRed Then lblBox(Index + 1).BackColor = vbBlue Else lblBox(Index + 1).BackColor = vbRed
If lblBox(Index - 6).BackColor = vbRed Then lblBox(Index - 6).BackColor = vbBlue Else lblBox(Index - 6).BackColor = vbRed
If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed
GoTo CheckWin
End If
If Index = 11 Then
If lblBox(Index - 1).BackColor = vbRed Then lblBox(Index - 1).BackColor = vbBlue Else lblBox(Index - 1).BackColor = vbRed
If lblBox(Index - 6).BackColor = vbRed Then lblBox(Index - 6).BackColor = vbBlue Else lblBox(Index - 6).BackColor = vbRed
If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed
GoTo CheckWin
End If
If Index = 17 Then
If lblBox(Index - 1).BackColor = vbRed Then lblBox(Index - 1).BackColor = vbBlue Else lblBox(Index - 1).BackColor = vbRed
If lblBox(Index - 6).BackColor = vbRed Then lblBox(Index - 6).BackColor = vbBlue Else lblBox(Index - 6).BackColor = vbRed
If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed
GoTo CheckWin
End If
If Index = 23 Then
If lblBox(Index - 1).BackColor = vbRed Then lblBox(Index - 1).BackColor = vbBlue Else lblBox(Index - 1).BackColor = vbRed
If lblBox(Index - 6).BackColor = vbRed Then lblBox(Index - 6).BackColor = vbBlue Else lblBox(Index - 6).BackColor = vbRed
If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed
GoTo CheckWin
End If
If Index = 29 Then
If lblBox(Index - 1).BackColor = vbRed Then lblBox(Index - 1).BackColor = vbBlue Else lblBox(Index - 1).BackColor = vbRed
If lblBox(Index - 6).BackColor = vbRed Then lblBox(Index - 6).BackColor = vbBlue Else lblBox(Index - 6).BackColor = vbRed
If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed
GoTo CheckWin
End If
If lblBox(Index + 1).BackColor = vbRed Then lblBox(Index + 1).BackColor = vbBlue Else lblBox(Index + 1).BackColor = vbRed
If lblBox(Index - 1).BackColor = vbRed Then lblBox(Index - 1).BackColor = vbBlue Else lblBox(Index - 1).BackColor = vbRed
If lblBox(Index - 6).BackColor = vbRed Then lblBox(Index - 6).BackColor = vbBlue Else lblBox(Index - 6).BackColor = vbRed
If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed

CheckWin:
Dim nb As Integer
For i = 0 To 35
If lblBox(i).BackColor = vbBlue Then nb = nb + 1
Next i
If nb = 36 Then
Call MsgBox("You win!!! It took you " & clicks & " moves.", vbSystemModal, "WIN")
Call Form_Load
End If
End Sub

Private Sub mnuAbout_Click()
Call MsgBox("Lights Out V1.0 by Graham Sutherland", vbInformation + vbSystemModal, "About")
End Sub

Private Sub mnuExit_Click()
Dim ret As VbMsgBoxResult
ret = MsgBox("Are you sure you want to quit?", vbCritical + vbYesNo, "Quit?")
If ret = vbYes Then End
End Sub

Private Sub mnuNew_Click()
Call Form_Load
End Sub

Private Sub mnuOpen_Click()
dlgOpen.ShowOpen
If dlgOpen.FileName = "" Then
Call MsgBox("Error: You must choose a file name!", vbCritical + vbSystemModal, "ERROR")
Exit Sub
Open dlgOpen.FileName For Random As #1
End If
Get #1, 100, clicks
For i = 1 To 36
Get #1, i, stat(i - 1)
Next i
Close #1
For i = 0 To 35
If stat(i) = True Then lblBox(i).BackColor = vbRed Else lblBox(i).BackColor = vbBlue
Next i
End Sub

Private Sub mnuRules_Click()
Call MsgBox("Get all squares to become blue. If you click a box, it and the four surrounding boxes' colours are inverted.", vbInformation + vbSystemModal, "Rules")
End Sub

Private Sub mnuSave_Click()
For i = 0 To 35
If lblBox(i).BackColor = vbRed Then stat(i) = True Else stat(i) = False
Next i
dlgSave.ShowSave
If dlgSave.FileName = "" Then
Call MsgBox("Error: You must choose a file name!", vbCritical + vbSystemModal, "ERROR")
Exit Sub
End If
r = CreateFile(dlgSave.FileName, GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, CREATE_NEW, 0, 0)
CloseHandle r
Open dlgSave.FileName For Random As #1
Put #1, 100, clicks
For i = 1 To 36
Put #1, i, stat(i - 1)
Next i
Close #1
End Sub

Private Sub mnuSolve_Click()
Call Load(Form2)
Form2.Show
End Sub




Form2 will contain the solver, but has no code so far.
If anybody can translate the Java to VB or just supply me with some code to solve 6x6 Lights Out grids then I would be very grateful.
Thanks in advance!
[+][-]01/17/04 12:33 PM, ID: 10137455Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/18/04 12:48 AM, ID: 10139729Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/18/04 12:51 AM, ID: 10139733Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/18/04 09:00 AM, ID: 10140838Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/18/04 12:00 PM, ID: 10141698Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/18/04 07:59 PM, ID: 10143692Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/18/04 08:06 PM, ID: 10143728Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/21/04 09:00 AM, ID: 10166319Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/21/04 09:02 AM, ID: 10166340Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/21/04 09:28 AM, ID: 10166573Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/21/04 09:40 AM, ID: 10166688Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/21/04 09:42 AM, ID: 10166718Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/21/04 09:43 AM, ID: 10166732Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/21/04 09:46 AM, ID: 10166767Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/21/04 09:48 AM, ID: 10166782Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/21/04 09:53 AM, ID: 10166853Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/21/04 09:54 AM, ID: 10166861Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/21/04 09:54 AM, ID: 10166868Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/21/04 11:33 AM, ID: 10167868Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/21/04 01:55 PM, ID: 10169116Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/21/04 01:59 PM, ID: 10169146Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/04 12:44 AM, ID: 10190228Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/24/04 01:23 AM, ID: 10190297Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/24/04 11:55 AM, ID: 10192111Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/04 12:05 PM, ID: 10192168Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/04 12:09 PM, ID: 10192185Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/04 12:12 PM, ID: 10192199Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/04 12:17 PM, ID: 10192226Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/24/04 12:50 PM, ID: 10192411Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/26/04 11:46 PM, ID: 10207529Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/26/04 11:47 PM, ID: 10207537Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/27/04 03:27 AM, ID: 10208294Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/27/04 03:34 AM, ID: 10208329Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/27/04 03:46 AM, ID: 10208389Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/27/04 10:25 AM, ID: 10211601Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/27/04 09:46 PM, ID: 10215959Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/27/04 09:50 PM, ID: 10215973Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/29/04 07:04 AM, ID: 10226650Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/29/04 10:02 AM, ID: 10227664Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/29/04 04:52 PM, ID: 10231464Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/29/04 05:00 PM, ID: 10231527Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/30/04 12:55 PM, ID: 10238329Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/30/04 02:44 PM, ID: 10239270Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/30/04 02:49 PM, ID: 10239326Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/01/04 04:10 AM, ID: 10246297Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/01/04 04:22 AM, ID: 10246316Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/01/04 10:48 AM, ID: 10247736Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/05/04 01:43 PM, ID: 10284747Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/05/04 01:59 PM, ID: 10284888Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/05/04 02:08 PM, ID: 10284962Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/05/04 02:17 PM, ID: 10285038Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/05/04 02:19 PM, ID: 10285056Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/07/04 01:17 AM, ID: 10297293Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/07/04 01:24 AM, ID: 10297318Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/07/04 01:44 AM, ID: 10297374Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/07/04 01:17 PM, ID: 10299997Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/07/04 01:23 PM, ID: 10300023Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/08/04 02:46 PM, ID: 10305433Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/09/04 10:09 AM, ID: 10312566Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/09/04 04:08 PM, ID: 10316803Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/09/04 04:14 PM, ID: 10316869Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/09/04 05:07 PM, ID: 10317516Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/09/04 05:10 PM, ID: 10317559Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/12/04 11:14 PM, ID: 10350054Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/12/04 11:19 PM, ID: 10350074Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/12/04 11:26 PM, ID: 10350101Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/12/04 11:34 PM, ID: 10350134Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/13/04 03:45 PM, ID: 10357311Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Programming Languages
Tags: solver, out, lights
Sign Up Now!
Solution Provided By: crazycomputers
Participating Experts: 2
Solution Grade: A
 
[+][-]02/28/04 03:04 PM, ID: 10477906Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/30/04 08:14 AM, ID: 10714702Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]03/30/04 08:25 AM, ID: 10714800Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/03/04 02:15 PM, ID: 10749499Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89