Match Blox (Compute's Gazette)

"Match Blox" is a solitaire puzzle game in which you try to solve any of the give variations in the fewest number of moves possible. Each game is played on a 3x3 matrix of squares and each square is colored blue or orange. The object is simple: Manipulate the squres until they match the pattern displayed.
The article for this game can be found on page 50 of Compute's Gazette Issue 41 (November 1986)

Why TAS This Game?

The continuation of TASing games from my all-time favorite magazine, Compute's Gazette. This makes my 83rd TAS from this series.
Again, this was another magazine that I never had. Not sure if I really missed out on casual play here, but apparently...I missed out on some great logical challenges. Regardless of how I would have felt back then, I can say that I'm more excited about this game (in terms of TASing) than back then.

Game Difficulty and Ending

This game doesn't have a selection of difficulty, as it is a pure logic game. The ending is solving all 5 available puzzles, which afterwards...its a repeat.

Effort In TASing (BOTed)

This was one of the most exciting TASes I've created. Why? Because this is the first time that I have created a TRUE Brute Force solving program...where the possibilities could be enormous for a human. Here, my brute forcing was done externally against the emulator. The game doesn't have any AI or RNG responses, so the given puzzle stands to be solved in a purely logical way.
My approach was to write a C# application to accomplish this. It took me about 1 1/2 hours, which afterwards...the results were shockingly fast and delivered the most minimal moves possible. The only thing, outside of these brute forced solutions, were to apply them against the 5 different solving patterns. Doing so in the right order optimized my efforts an additional 179 frames. So I am extremely happy about the outcome here.
!!Solutions This is the order that I solved the puzzles in. This order ended up behind the fastest for my "Brute Force" to solve.
Puzzle Selection (Order of selection)Puzzle NameSolving MovesBrute Force Attempts
55 Points2,3,9113
44 Corners7,5,2,1510
3No Center4,5,182
1Uni-Color1,5,7,9373
2Cross2,4,5,6,9,5,828128

Solutions (Updated)

This is the new order that I solved the puzzles in. This is an improvement that came from trying more RNG seeds.
Puzzle Selection (Order of selection)Puzzle NameSolving MovesBrute Force Attempts
2Cross1,3,287
55 Points2,4,1142
3No Center5,4,9171
1Uni-Color2,727
44 Corners6,5,4,11024

Human Comparison

Nobody seems to know this game or have played it. :(

nymx: Uploading a 401 frame improvement.

CoolHandMike: Claiming for judging.
CoolHandMike: Solutions for these puzzles look optimal. Poked around and the inputs look good too. Match Blox is a fun example of a simple puzzle game.
Accepting to Standard. Congrats!
Notes: Used gameplay reference page from magazine:
  1. Only Orange squares can be changed. Pressing B for Fire on a blue square does nothing. Change tiles with Up, Down, Left, Right keys.
  2. Pressing Fire on a corner tile reverses the color of that square and the three adjacent squares. Ex: Pressing Fire on (7) would change the colors of (8, 4, and 5).
  3. Pressing Fire on an edge square reverses the color as well as the two adjoining squares. Pressing Fire on the center top tile (8) would change the color of that tile and the ones to the left and right (7 and 9). Pressing Fire on the tile on the second row on in the first column (4) would change that tile and also (7 and 1).
  4. Pressing Fire on the Center square reverses its color and so are the colors of the four edge squares. Pressing Fire on (5) would also flip the color of that tile and (8, 4, 6, and 2).
fsvgm777: Processing. Also replacing the movie file with one that sets the re-record count to 0, due to the submission having botted rerecords (per current policy).


TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15583
Location: 127.0.0.1
This topic is for the purpose of discussing #9242: nymx's C64 Match Blox in 00:55.66
Patashu
He/Him
Joined: 10/2/2005
Posts: 4043
What does clicking a cell do in this game? It looks a little like Lights Out but seems to be doing something different. (I ask because typically in Light's Out -likes clicking the same cell twice in a solution is meaningless, as the order of your inputs doesn't matter, and making an input twice just undoes itself - but I don't know if that applies here.)
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu
nymx
He/Him
Editor, Judge, Expert player (2234)
Joined: 11/14/2014
Posts: 932
Location: South Pole, True Land Down Under
Patashu wrote:
What does clicking a cell do in this game? It looks a little like Lights Out but seems to be doing something different. (I ask because typically in Light's Out -likes clicking the same cell twice in a solution is meaningless, as the order of your inputs doesn't matter, and making an input twice just undoes itself - but I don't know if that applies here.)
There are rules that apply to each type of cell. Between corners, edges, and the center....they all have a different reversal pattern. Since I'm on my phone, it would be hard to explain;however, the best I can say is to click the magazine link and go to page 56...on the side.
I recently discovered that if you haven't reached a level of frustration with TASing any game, then you haven't done your due diligence. ---- SOYZA: Are you playing a game? NYMX: I'm not playing a game, I'm TASing. SOYZA: Oh...so its not a game...Its for real? ---- Anybody got a Quantum computer I can borrow for 20 minutes? Nevermind...eien's 64 core machine will do. :) ---- BOTing will be the end of all games. --NYMX
Hopper262
He/They
Joined: 3/22/2011
Posts: 55
The article states the starting boards are randomly generated, with "over 500 possible initial configurations for each pattern." Is this true? If so, can RNG be manipulated to get a quicker-to-solve board? I glanced at the code but my C64 BASIC skills aren't good enough to follow the logic.
nymx
He/Him
Editor, Judge, Expert player (2234)
Joined: 11/14/2014
Posts: 932
Location: South Pole, True Land Down Under
Hopper262 wrote:
The article states the starting boards are randomly generated, with "over 500 possible initial configurations for each pattern." Is this true? If so, can RNG be manipulated to get a quicker-to-solve board? I glanced at the code but my C64 BASIC skills aren't good enough to follow the logic.
I tried a few variations and it always seems one pattern has a long solving solution. I can try more, but it will require getting a better rng seed. This run had the best I could get so far, while having one with 7 moves.
I recently discovered that if you haven't reached a level of frustration with TASing any game, then you haven't done your due diligence. ---- SOYZA: Are you playing a game? NYMX: I'm not playing a game, I'm TASing. SOYZA: Oh...so its not a game...Its for real? ---- Anybody got a Quantum computer I can borrow for 20 minutes? Nevermind...eien's 64 core machine will do. :) ---- BOTing will be the end of all games. --NYMX
nymx
He/Him
Editor, Judge, Expert player (2234)
Joined: 11/14/2014
Posts: 932
Location: South Pole, True Land Down Under
Hopper262 wrote:
The article states the starting boards are randomly generated, with "over 500 possible initial configurations for each pattern." Is this true? If so, can RNG be manipulated to get a quicker-to-solve board? I glanced at the code but my C64 BASIC skills aren't good enough to follow the logic.
Well, you got me thinking all day. Came up with another plan and was able to find an RNG seed that cut 401 more frames. I'm going to continue seeing if I can find another one, but this program is written in B.A.S.I.C. and its much harder to do this kind of manipulation, as it is very slow.
I recently discovered that if you haven't reached a level of frustration with TASing any game, then you haven't done your due diligence. ---- SOYZA: Are you playing a game? NYMX: I'm not playing a game, I'm TASing. SOYZA: Oh...so its not a game...Its for real? ---- Anybody got a Quantum computer I can borrow for 20 minutes? Nevermind...eien's 64 core machine will do. :) ---- BOTing will be the end of all games. --NYMX
Hopper262
He/They
Joined: 3/22/2011
Posts: 55
nymx wrote:
Well, you got me thinking all day. Came up with another plan and was able to find an RNG seed that cut 290 more frames.
Haha, I'm sorry to derail your day, but I'm glad I inspired an improvement! I can see why it'd be incredibly slow to test though.
CoolHandMike
He/Him
Editor, Judge, Experienced player (895)
Joined: 3/9/2019
Posts: 696
nymx wrote:
Hopper262 wrote:
The article states the starting boards are randomly generated, with "over 500 possible initial configurations for each pattern." Is this true? If so, can RNG be manipulated to get a quicker-to-solve board? I glanced at the code but my C64 BASIC skills aren't good enough to follow the logic.
Well, you got me thinking all day. Came up with another plan and was able to find an RNG seed that cut 401 more frames. I'm going to continue seeing if I can find another one, but this program is written in B.A.S.I.C. and its much harder to do this kind of manipulation, as it is very slow.
Let me know when you need a file replacement.
discord: CoolHandMike#0352
nymx
He/Him
Editor, Judge, Expert player (2234)
Joined: 11/14/2014
Posts: 932
Location: South Pole, True Land Down Under
CoolHandMike wrote:
nymx wrote:
Hopper262 wrote:
The article states the starting boards are randomly generated, with "over 500 possible initial configurations for each pattern." Is this true? If so, can RNG be manipulated to get a quicker-to-solve board? I glanced at the code but my C64 BASIC skills aren't good enough to follow the logic.
Well, you got me thinking all day. Came up with another plan and was able to find an RNG seed that cut 401 more frames. I'm going to continue seeing if I can find another one, but this program is written in B.A.S.I.C. and its much harder to do this kind of manipulation, as it is very slow.
Let me know when you need a file replacement.
Oh...I'm done. I already replaced it days ago.
I recently discovered that if you haven't reached a level of frustration with TASing any game, then you haven't done your due diligence. ---- SOYZA: Are you playing a game? NYMX: I'm not playing a game, I'm TASing. SOYZA: Oh...so its not a game...Its for real? ---- Anybody got a Quantum computer I can borrow for 20 minutes? Nevermind...eien's 64 core machine will do. :) ---- BOTing will be the end of all games. --NYMX
Post subject: Linear algebra
Sand
He/Him
Player (143)
Joined: 6/26/2018
Posts: 175
There's a way to model "lights out" problems like this as linear algebra, with 0/1 matrices and vectors. You have a vector p that represents the current state of the board (in this case a 9-vector), a vector r that represents the desired end state of the board (another 9-vector), and a matrix A that represents which lights get flipped when you press each of the lights (a 9×9 matrix). Then the vector x that tells you which lights to press can be computed as x = (rp)A−1. Here's a youtube video about it: Solving the "Lights Out" Problem And here's a good web page: The Mathematics of Lights Out. The technique isn't exactly applicable to Match Blox, because of this restriction: "Only the orange squares may be changed. If you press the fire button while on a blue square, nothing happens." But it's pretty close. Jaap's Puzzle Page also has discussion of "lit-only games":
The lit-only game is solved in nearly the same manner as the normal game. Simply figure out whether any of the lit buttons need to be pressed, and then press them. If any unlit button needs to be pressed, you will need to delay pressing it until other button presses have lit it. Occasionally all buttons that remain in the solution are unlit, so then some lit button has to be pressed first to allow you to move on. Later that same button will have to be pressed again, since it wouldn't have been part of the solution if you hadn't been forced to press it the first time. This situation can usually be avoided.
What this means is that the order of presses is important (you have to make sure that each square is lit at the time to press it), and in some cases you may need to press a light that's not in the vector solution, then press it again later. The other aspect of the game that this doesn't capture is the time required for cursor movement. Your bot is likely a more straightforward solution, given these additional complications. But just for interest, here's a way of doing the matrix computations using SageMath. You can run the program at https://sagecell.sagemath.org/. This is for the first batch of solutions (not the updated batch).
Language: python

# Each row shows which squares are affected by pressing the square that # corresponds to the number of that row. For example, pressing square 1 flips # squares 1, 2, 4, and 5 (first row of the matrix). # https://archive.org/details/1986-11-computegazette/page/n57/mode/2up # "Choosing one of the four corner squares (1, 3, 7, or 9) reverses the color of # that square and the three adjacent squares. Choosing an edge square # (2, 4, 6, or 8) reverses its color as well as the two adjoining corner # squares. If you select the center square, its color is reversed and so are the # colors of the four edge squares." A = matrix(GF(2), [ [1,1,0,1,1,0,0,0,0], [1,1,1,0,0,0,0,0,0], [0,1,1,0,1,1,0,0,0], [1,0,0,1,0,0,1,0,0], [0,1,0,1,1,1,0,1,0], [0,0,1,0,0,1,0,0,1], [0,0,0,1,1,0,1,1,0], [0,0,0,0,0,0,1,1,1], [0,0,0,0,1,1,0,1,1], ]) Ainv = A.inverse() # https://www.jaapsch.net/puzzles/lomath.htm#linalg def solve(p, r): return (p - r) * Ainv # Target patterns, each square numbered in the natural way. UNI_COLOR = vector(GF(2), [0,0,0,0,0,0,0,0,0]) CROSS = vector(GF(2), [1,0,1,0,0,0,1,0,1]) NO_CENTER = vector(GF(2), [0,0,0,0,1,0,0,0,0]) FOUR_CORNERS = vector(GF(2), [0,1,0,1,1,1,0,1,0]) FIVE_POINTS = vector(GF(2), [0,1,0,1,0,1,0,1,0]) for p, r, name in ( ([1,1,0,1,0,1,0,0,1], FIVE_POINTS, "5 POINTS"), ([0,0,1,0,0,0,1,1,0], FOUR_CORNERS, "4 CORNERS"), ([0,0,0,1,1,1,1,1,0], NO_CENTER, "NO CENTER"), ([1,0,0,1,0,0,1,1,1], UNI_COLOR, "UNI-COLOR"), ([1,1,1,1,1,0,1,0,0], CROSS, "CROSS"), ): p = vector(GF(2), p) x = solve(p, r) print(f"{name:9}", p, x, "->", [i+1 for (i, xi) in enumerate(x) if xi != 0])
Here's the output:
r=5 POINTS  p=(1, 1, 0, 1, 0, 1, 0, 0, 1) x=(0, 1, 1, 0, 0, 0, 0, 0, 1) -> [2, 3, 9]
r=4 CORNERS p=(0, 0, 1, 0, 0, 0, 1, 1, 0) x=(1, 1, 0, 0, 1, 0, 1, 0, 0) -> [1, 2, 5, 7]
r=NO CENTER p=(0, 0, 0, 1, 1, 1, 1, 1, 0) x=(1, 0, 0, 1, 1, 0, 0, 0, 0) -> [1, 4, 5]
r=UNI-COLOR p=(1, 0, 0, 1, 0, 0, 1, 1, 1) x=(1, 0, 0, 0, 1, 0, 1, 0, 1) -> [1, 5, 7, 9]
r=CROSS     p=(1, 1, 1, 1, 1, 0, 1, 0, 0) x=(0, 1, 0, 1, 0, 1, 0, 1, 1) -> [2, 4, 6, 8, 9]
The solutions match what your bot found, except that they may be out of order. The exception is CROSS, which is one of those cases where none of the square you need to press is lit, so you need to press some other square (5 in this case) and press it again later: [2, 4, 5, 6, 9, 5, 8].
nymx
He/Him
Editor, Judge, Expert player (2234)
Joined: 11/14/2014
Posts: 932
Location: South Pole, True Land Down Under
Sand wrote:
There's a way to model "lights out" problems like this as linear algebra, with 0/1 matrices and vectors. You have a vector p that represents the current state of the board (in this case a 9-vector), a vector r that represents the desired end state of the board (another 9-vector), and a matrix A that represents which lights get flipped when you press each of the lights (a 9×9 matrix). Then the vector x that tells you which lights to press can be computed as x = (rp)A−1. Here's a youtube video about it: Solving the "Lights Out" Problem And here's a good web page: The Mathematics of Lights Out. The technique isn't exactly applicable to Match Blox, because of this restriction: "Only the orange squares may be changed. If you press the fire button while on a blue square, nothing happens." But it's pretty close. Jaap's Puzzle Page also has discussion of "lit-only games":
The lit-only game is solved in nearly the same manner as the normal game. Simply figure out whether any of the lit buttons need to be pressed, and then press them. If any unlit button needs to be pressed, you will need to delay pressing it until other button presses have lit it. Occasionally all buttons that remain in the solution are unlit, so then some lit button has to be pressed first to allow you to move on. Later that same button will have to be pressed again, since it wouldn't have been part of the solution if you hadn't been forced to press it the first time. This situation can usually be avoided.
What this means is that the order of presses is important (you have to make sure that each square is lit at the time to press it), and in some cases you may need to press a light that's not in the vector solution, then press it again later. The other aspect of the game that this doesn't capture is the time required for cursor movement. Your bot is likely a more straightforward solution, given these additional complications. But just for interest, here's a way of doing the matrix computations using SageMath. You can run the program at https://sagecell.sagemath.org/. This is for the first batch of solutions (not the updated batch).
Language: python

# Each row shows which squares are affected by pressing the square that # corresponds to the number of that row. For example, pressing square 1 flips # squares 1, 2, 4, and 5 (first row of the matrix). # https://archive.org/details/1986-11-computegazette/page/n57/mode/2up # "Choosing one of the four corner squares (1, 3, 7, or 9) reverses the color of # that square and the three adjacent squares. Choosing an edge square # (2, 4, 6, or 8) reverses its color as well as the two adjoining corner # squares. If you select the center square, its color is reversed and so are the # colors of the four edge squares." A = matrix(GF(2), [ [1,1,0,1,1,0,0,0,0], [1,1,1,0,0,0,0,0,0], [0,1,1,0,1,1,0,0,0], [1,0,0,1,0,0,1,0,0], [0,1,0,1,1,1,0,1,0], [0,0,1,0,0,1,0,0,1], [0,0,0,1,1,0,1,1,0], [0,0,0,0,0,0,1,1,1], [0,0,0,0,1,1,0,1,1], ]) Ainv = A.inverse() # https://www.jaapsch.net/puzzles/lomath.htm#linalg def solve(p, r): return (p - r) * Ainv # Target patterns, each square numbered in the natural way. UNI_COLOR = vector(GF(2), [0,0,0,0,0,0,0,0,0]) CROSS = vector(GF(2), [1,0,1,0,0,0,1,0,1]) NO_CENTER = vector(GF(2), [0,0,0,0,1,0,0,0,0]) FOUR_CORNERS = vector(GF(2), [0,1,0,1,1,1,0,1,0]) FIVE_POINTS = vector(GF(2), [0,1,0,1,0,1,0,1,0]) for p, r, name in ( ([1,1,0,1,0,1,0,0,1], FIVE_POINTS, "5 POINTS"), ([0,0,1,0,0,0,1,1,0], FOUR_CORNERS, "4 CORNERS"), ([0,0,0,1,1,1,1,1,0], NO_CENTER, "NO CENTER"), ([1,0,0,1,0,0,1,1,1], UNI_COLOR, "UNI-COLOR"), ([1,1,1,1,1,0,1,0,0], CROSS, "CROSS"), ): p = vector(GF(2), p) x = solve(p, r) print(f"{name:9}", p, x, "->", [i+1 for (i, xi) in enumerate(x) if xi != 0])
Here's the output:
r=5 POINTS  p=(1, 1, 0, 1, 0, 1, 0, 0, 1) x=(0, 1, 1, 0, 0, 0, 0, 0, 1) -> [2, 3, 9]
r=4 CORNERS p=(0, 0, 1, 0, 0, 0, 1, 1, 0) x=(1, 1, 0, 0, 1, 0, 1, 0, 0) -> [1, 2, 5, 7]
r=NO CENTER p=(0, 0, 0, 1, 1, 1, 1, 1, 0) x=(1, 0, 0, 1, 1, 0, 0, 0, 0) -> [1, 4, 5]
r=UNI-COLOR p=(1, 0, 0, 1, 0, 0, 1, 1, 1) x=(1, 0, 0, 0, 1, 0, 1, 0, 1) -> [1, 5, 7, 9]
r=CROSS     p=(1, 1, 1, 1, 1, 0, 1, 0, 0) x=(0, 1, 0, 1, 0, 1, 0, 1, 1) -> [2, 4, 6, 8, 9]
The solutions match what your bot found, except that they may be out of order. The exception is CROSS, which is one of those cases where none of the square you need to press is lit, so you need to press some other square (5 in this case) and press it again later: [2, 4, 5, 6, 9, 5, 8].
Wow! I will not be at home for a few days, but I am going to look at this closely when I get back. I love math and want to study this for future uses. I'm glad that you confirmed my solutions. Thanks!
I recently discovered that if you haven't reached a level of frustration with TASing any game, then you haven't done your due diligence. ---- SOYZA: Are you playing a game? NYMX: I'm not playing a game, I'm TASing. SOYZA: Oh...so its not a game...Its for real? ---- Anybody got a Quantum computer I can borrow for 20 minutes? Nevermind...eien's 64 core machine will do. :) ---- BOTing will be the end of all games. --NYMX
Post subject: Movie published
TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15583
Location: 127.0.0.1
This movie has been published. The posts before this message apply to the submission, and posts after this message apply to the published movie. ---- [6148] C64 Match Blox by nymx in 00:55.66