Advertisement

01.17.2004 at 01:23AM PST, ID: 20853743
[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: , ,

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!Start Free Trial
 
 
[+][-]01.17.2004 at 12:33PM PST, ID: 10137455

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.18.2004 at 12:48AM PST, ID: 10139729

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.18.2004 at 12:51AM PST, ID: 10139733

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.18.2004 at 09:00AM PST, ID: 10140838

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.18.2004 at 12:00PM PST, ID: 10141698

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.18.2004 at 07:59PM PST, ID: 10143692

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.18.2004 at 08:06PM PST, ID: 10143728

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 09:00AM PST, ID: 10166319

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 09:02AM PST, ID: 10166340

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 09:28AM PST, ID: 10166573

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 09:40AM PST, ID: 10166688

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 09:42AM PST, ID: 10166718

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 09:43AM PST, ID: 10166732

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 09:46AM PST, ID: 10166767

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 09:48AM PST, ID: 10166782

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 09:53AM PST, ID: 10166853

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 09:54AM PST, ID: 10166861

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 09:54AM PST, ID: 10166868

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 11:33AM PST, ID: 10167868

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 01:55PM PST, ID: 10169116

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.21.2004 at 01:59PM PST, ID: 10169146

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.24.2004 at 12:44AM PST, ID: 10190228

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.24.2004 at 01:23AM PST, ID: 10190297

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.24.2004 at 11:55AM PST, ID: 10192111

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.24.2004 at 12:05PM PST, ID: 10192168

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.24.2004 at 12:09PM PST, ID: 10192185

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.24.2004 at 12:12PM PST, ID: 10192199

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.24.2004 at 12:17PM PST, ID: 10192226

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.24.2004 at 12:50PM PST, ID: 10192411

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.26.2004 at 11:46PM PST, ID: 10207529

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.26.2004 at 11:47PM PST, ID: 10207537

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.27.2004 at 03:27AM PST, ID: 10208294

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.27.2004 at 03:34AM PST, ID: 10208329

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.27.2004 at 03:46AM PST, ID: 10208389

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.27.2004 at 10:25AM PST, ID: 10211601

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.27.2004 at 09:46PM PST, ID: 10215959

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.27.2004 at 09:50PM PST, ID: 10215973

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.29.2004 at 07:04AM PST, ID: 10226650

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.29.2004 at 10:02AM PST, ID: 10227664

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.29.2004 at 04:52PM PST, ID: 10231464

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.29.2004 at 05:00PM PST, ID: 10231527

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.30.2004 at 12:55PM PST, ID: 10238329

Often, when Experts are collaborating with members who have asked questions, they will req