This is a far more difficult task than you think. If anybody can translate the Java to VB or just supply me with some code to solve 6圆 Lights Out grids then I would be very grateful. GS (040911) A few years ago, there was an interesting discussion on sci.math about this puzzle and also a published article: Óscar Martín-Sánchez and Cristóbal Pareja-Flores, Two Reflected Analysis of Lights Out, Mathematics Magazine 74:4 (2001), 295-304. R = CreateFile(dlgSave.FileNam e, GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, CREATE_NEW, 0, 0)įorm2 will contain the solver, but has no code so far. If lblBox(i).BackColor = vbRed Then stat(i) = True Else stat(i) = False If you click a box, it and the four surrounding boxes' colours are inverted.", vbInformation + vbSystemModal, "Rules") If stat(i) = True Then lblBox(i).BackColor = vbRed Else lblBox(i).BackColor = vbBlueĬall MsgBox("Get all squares to become blue. Ret = MsgBox("Are you sure you want to quit?", vbCritical + vbYesNo, "Quit?")Ĭall MsgBox("Error: You must choose a file name!", vbCritical + vbSystemModal, "ERROR") If lblBox(i).BackColor = vbBlue Then nb = nb + 1Ĭall MsgBox("You win!!! It took you " & clicks & " moves.", vbSystemModal, "WIN")Ĭall MsgBox("Lights Out V1.0 by Graham Sutherland", vbInformation + vbSystemModal, "About") 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 Index > 0 And Index 30 And Index < 35 Then See if you can solve these What am I riddles. If lblBox(Index + 6).BackColor = vbRed Then lblBox(Index + 6).BackColor = vbBlue Else lblBox(Index + 6).BackColor = vbRed Now, these printable sudoku puzzles start to get a little harder. If lblBox(Index + 1).BackColor = vbRed Then lblBox(Index + 1).BackColor = vbBlue Else lblBox(Index + 1).BackColor = vbRed If lblBox(Index).BackColor = vbRed Then lblBox(Index).BackColor = vbBlue Else lblBox(Index).BackColor = vbRed Private Sub lblBox_Click(Index As Integer) If Int(Rnd * 2) = 1 Then col = vbRed Else col = vbBlue 'Randomly generate game. Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long 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 Could somebody give me a VB translation of this please? I have also included my VB program code at the bottom.Ī Lights Out Puzzle with Solver (JavaScript)įunction gcd(x, y) įor (var goal = 0 goal 0) line = 1 ĭim stat(35) As Boolean, clicks As Integer 'stat is for the save function and clicks is no. I am trying to make a solver for my Visual Basic lights out game and am having trouble doing it. The following page contains a JavaScript lights out game.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |