Author |
Message |
|
LolBbq
Advanced Member
Joined: 08 Apr 2006 Posts: 351
|
Posted: 05 Feb 2007 06:57:32 am Post subject: |
|
|
Is a Lights Out game with three states mathematically feasible? Or, should I say, could a random procedure that scrambles the board create an unsolvable board? I was thinking about it and I couldn't figure it out. |
|
Back to top |
|
|
nitacku
Advanced Member
Joined: 23 Aug 2005 Posts: 408
|
Posted: 05 Feb 2007 08:17:05 am Post subject: |
|
|
Hmmm...
Try creating one but on a 3x3 scale. If it can be solved, then I would say that a larger one should be solvable as well.
Or you could guarantee solvable ones by just having the program mix the grid up by pressing the lights individually a few times before the game starts |
|
Back to top |
|
|
LolBbq
Advanced Member
Joined: 08 Apr 2006 Posts: 351
|
Posted: 05 Feb 2007 02:42:42 pm Post subject: |
|
|
nitacku wrote: Or you could guarantee solvable ones by just having the program mix the grid up by pressing the lights individually a few times before the game starts
[post="96447"]<{POST_SNAPBACK}>[/post] Yes, that was going to be the process of randomization. I guess 3 states would work, as well as any different amount of states. It took a whole day in school to figure it out. |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 05 Feb 2007 05:00:46 pm Post subject: |
|
|
Is this the Lights Out where flipping one cell flips all the adjacent ones, or the Lights Out where it flips everything in the same row and column?
I know the flipping random switches approach is probably simpler, but I'm kind of interested in solving the general problem for the heck of it.
I've figured out that for the row-and-column Lights Out, if the number of rows or the number of columns is equal to 1 modulo the number of states (for not-tiny boards), then not all positions are possible to solve.
Last edited by Guest on 05 Feb 2007 05:02:11 pm; edited 1 time in total |
|
Back to top |
|
|
LolBbq
Advanced Member
Joined: 08 Apr 2006 Posts: 351
|
Posted: 05 Feb 2007 05:10:09 pm Post subject: |
|
|
I'm working on the one that flips the cell the cursor is on and ones that are directly adjacent to it. I have a working model in TI-BASIC that has 3 states, maybe I'll post a screenie later.
Last edited by Guest on 05 Feb 2007 05:26:38 pm; edited 1 time in total |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 05 Feb 2007 05:30:12 pm Post subject: |
|
|
Ok. For that version: any board that is 2k-1 by 3m-1 (for some k,m) has unreachable positions. I haven't shown that all positions are reachable for other board sizes yet.
Last edited by Guest on 05 Feb 2007 05:34:12 pm; edited 1 time in total |
|
Back to top |
|
|
LolBbq
Advanced Member
Joined: 08 Apr 2006 Posts: 351
|
Posted: 05 Feb 2007 06:06:04 pm Post subject: |
|
|
Well, for simplicity's sake, I'll just resort to randomly toggling each individual square. Although an algorithm would speed things up and greatly increase the randomness.
Oh, and I'm working with square boards, so would odd dimensioned square boards have invalid combinations?
Last edited by Guest on 05 Feb 2007 06:07:30 pm; edited 1 time in total |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 05 Feb 2007 06:12:09 pm Post subject: |
|
|
If it's 5x5, 11x11, 17x17, or etc., then yes, it would. Otherwise, I don't think so, but I don't know for sure.
It boils down to finding a combination of flips that results in a totally blank grid again.
Last edited by Guest on 05 Feb 2007 06:12:50 pm; edited 1 time in total |
|
Back to top |
|
|
LolBbq
Advanced Member
Joined: 08 Apr 2006 Posts: 351
|
Posted: 10 Feb 2007 03:05:56 pm Post subject: |
|
|
|
|
Back to top |
|
|
Harrierfalcon The Raptor of Calcs
Super Elite (Last Title)
Joined: 25 Oct 2006 Posts: 2535
|
Posted: 10 Feb 2007 03:09:24 pm Post subject: |
|
|
Basic or ASM? Either way, it looks excellent. |
|
Back to top |
|
|
LolBbq
Advanced Member
Joined: 08 Apr 2006 Posts: 351
|
Posted: 10 Feb 2007 03:13:55 pm Post subject: |
|
|
Basic.
No, really?//
EDIT:Try it out, nothing fancy, just randomizes now:
Last edited by Guest on 10 Feb 2007 03:30:36 pm; edited 1 time in total |
|
Back to top |
|
|
Harrierfalcon The Raptor of Calcs
Super Elite (Last Title)
Joined: 25 Oct 2006 Posts: 2535
|
Posted: 10 Feb 2007 03:43:50 pm Post subject: |
|
|
Fun! Gimme a minute...
One minute passes...
Five minutes pass...
Liar! [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]ERR:INVALID ;)
I might just have to remake this in Basic....you should make [2nd] switch stuff, use it to confirm level selection, and maybe have a message pop up when the game is loading. I spent 5 minutes waiting for it, mashing buttons.
Just suggestions, but looks real nice! |
|
Back to top |
|
|
LolBbq
Advanced Member
Joined: 08 Apr 2006 Posts: 351
|
Posted: 10 Feb 2007 03:54:15 pm Post subject: |
|
|
Five minutes. Seriously? And this is just the core, lots of little things can be added here and there. Just got to think of them .
Last edited by Guest on 10 Feb 2007 03:57:35 pm; edited 1 time in total |
|
Back to top |
|
|
LolBbq
Advanced Member
Joined: 08 Apr 2006 Posts: 351
|
Posted: 10 Feb 2007 04:10:03 pm Post subject: |
|
|
I should also point out that the dithered squares are merely a placeholder for real gray squares, which won't be implemented until I can get flickerless grayscale (but hey, I'm close to it! Using interlacing I have made headway but I still need crystal timer synch [someone please tell me how...]).
|
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 10 Feb 2007 04:16:13 pm Post subject: |
|
|
As far as randomizing goes:
Rather than repeatedly flipping a random switch, consider that flipping the same switch 3 times is the same as not flipping it at all. Therefore, it's necessary to flip each cell 0, 1, or 2 times for full randomization.
Here's what you do: generate a bunch of random numbers 0..2 (one for each cell). Then set each cell to the sum of itself plus its four neighbors, modulo 3. This requires generating much less random numbers (for an NxN grid, you need roughly 3N2/2 random cell flips, or 3N2 random numbers 1..N, whereas here you need only N2 numbers 0..2).
Last edited by Guest on 19 Jan 2008 12:05:09 pm; edited 1 time in total |
|
Back to top |
|
|
LolBbq
Advanced Member
Joined: 08 Apr 2006 Posts: 351
|
Posted: 10 Feb 2007 04:21:40 pm Post subject: |
|
|
You say four neighbors...the same would apply for edge or corner cells? |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 10 Feb 2007 04:24:22 pm Post subject: |
|
|
Yes, except of course you'd add up only the neighbors they actually have. |
|
Back to top |
|
|
LolBbq
Advanced Member
Joined: 08 Apr 2006 Posts: 351
|
Posted: 10 Feb 2007 04:31:17 pm Post subject: |
|
|
Ok, I dig. Although it does means sacrificing memory for speed...Currently I'm running 49 flips on any random cell coordinate, seems sufficient except for the 3x3 grid which might come out solved or near solved (off by one to three flips). |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 10 Feb 2007 04:42:45 pm Post subject: |
|
|
What memory would you be sacrificing, exactly? All of the saferam areas are at your disposal. |
|
Back to top |
|
|
LolBbq
Advanced Member
Joined: 08 Apr 2006 Posts: 351
|
Posted: 10 Feb 2007 04:49:44 pm Post subject: |
|
|
What I meant was size. |
|
Back to top |
|
|
|