This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Kingdaro's profile picture

[Game] Picross - Brain-numbing picture puzzles!

Started by Kingdaro, 11 March 2013 - 10:42 AM
Kingdaro #1
Posted 11 March 2013 - 11:42 AM
About
Having been frustrated by sudoku, I decided to approach a much simpler concept.

This is Picross, where the goal is to have each row and column in the board match its corresponding number. It's not an original concept and it's probably been around for a while in many different shapes and forms. I personally find it more fun and addicting than sudoku, so there's that.

The program also has the ability to load images made with paint into a puzzle. Just type "picross [image name]".

Usage
You run it by typing "picross" in the terminal, with an optional puzzle size or image argument. Supply –drawmode to re-select your draw mode.

picross
picross [size]
picross [image path]
picross --drawmode
picross [size/image path] --drawmode

Left-click to toggle a cell as on or off, and right-click to toggle a cell as "not possible", with a gray X. Setting a cell to impossible is the same as leaving it unmarked, and the feature is only there to help the player.

If you get stuck, press backspace to stop the current game and see the solution.

Once the game is over, press any key or click to return to the shell.

Screenshots
SpoilerThe drawing mode selection screen.


A randomly generated puzzle in ASCII drawing mode.


A won puzzle in ASCII drawing mode.


Viewing the solution to a puzzle after giving up.


Image loading format:


Your actual image must be drawn in black only, and the top-left and bottom-right corners of your image must be marked with a pink square. The result in color drawing mode:

Download
pastebin get rAn8cWyH picross

How to Play, In-Depth
Here's a simple example. The sharps are filled-in squares, and dots are empty squares.

    1 1 3
1 1 # . #
  1 . . #
  2 . # #

In the puzzle above, this row

1 1 # . #

Denotes that there are two "groups" of 1 dot, and each group is separated by at least one space. In a bigger puzzle, it could look something like this:

1 1 2 # . # . . # #

Where we have three "groups" of 1, 1, and two. The above could also be this in the same puzzle:

1 1 2 # . # . # # .

These groups are in order, and therefore, the above can't be this:

1 1 2 # . # # . . #
This would indicate "1 2 1" instead.

You can figure out the placement of groups using clues from other columns.

	2
    1 1 1
3 . . . .
1 . . . .
  . . . .
1 . . . .

In this example, there's two possible ways the first row can be placed.
3 # # # .
3 . # # #

But only one solution for the last column.

2
1
#
#
.
#

And because this is wrong,

	2
    1 1 1
3 # # # #
1 . . . #
  . . . .
1 . . . #

The only possibility for the group of three, is for it to be on the right.

	2
    1 1 1
3 . # # #
1 . . . #
  . . . .
1 . . . #

You can find more info on solving picross puzzles here.
LuaEclipser #2
Posted 11 March 2013 - 01:01 PM
i dont get it :P/>
Left #3
Posted 11 March 2013 - 01:04 PM
Nor do I but it looks GREAT!
Kingdaro #4
Posted 11 March 2013 - 01:04 PM
It's a difficult concept to get at first, but once you get into it, you'll find a bunch of neat ways to go about filling in one of these puzzles.
Left #5
Posted 11 March 2013 - 01:07 PM
Its looks great. Nice Job!
remiX #6
Posted 11 March 2013 - 11:11 PM
Wow looks confusing xD but looks cool.

Are you still going to attempt soduko?
superaxander #7
Posted 12 March 2013 - 01:17 AM
Wooh more games!
remiX #8
Posted 12 March 2013 - 01:37 AM
Ah, I understand! It's actually really simple once you know what to do :P/>

Maybe make it when all dots are gone, have it finish and check if it's correct or not.
Also, when finished, have the correct one on the right so you can compare your one and the correct :P/>
InputUsername #9
Posted 12 March 2013 - 04:35 AM
Ah, love this game. Great that someone made a CC version of it! One thing I hate about it, though, is the fact that you use characters (#) to "fill" spaces. I'd like it better if it just had colored pixels. But nah, just my opinion. Great game!
Kingdaro #10
Posted 12 March 2013 - 05:27 AM
Wow looks confusing xD but looks cool.

Are you still going to attempt soduko?
Probably not any time soon, haha.


Maybe make it when all dots are gone, have it finish and check if it's correct or not.
Also, when finished, have the correct one on the right so you can compare your one and the correct :P/>
I like the comparison idea, and it could be done relatively easily. Thanks for the suggestion!

What do you mean by your first suggestion, though? If your puzzle is correct, the grid turns yellow and the game ends. If all squares are filled and that doesn't happen, you did it wrong. :lol:/>


Ah, love this game. Great that someone made a CC version of it! One thing I hate about it, though, is the fact that you use characters (#) to "fill" spaces. I'd like it better if it just had colored pixels. But nah, just my opinion. Great game!
I'm mathmatically minded, so colored pixels didn't really look good to me. :P/>
QuantumGrav #11
Posted 12 March 2013 - 10:16 AM
Nice work! Very tight, well-written code. I believe this type of puzzle is also called a nonogram. I'm slightly addicted to them, so it's really cool to see them in CC!
After some testing, the maximum stable size for your puzzle is 12. Anything larger and you risk cutting off some of the clues. You might consider adding a limit to the size that can be submitted in your program. I'm sure you can figure that out better than I can, but here's what I would do.

Put this in your "logic function" section:


local function checkSize()
  if size > 12 then
    print("Usage: picross <optional # 12 or less>")
    running = false
  end
end

Call it before anything else, and then check for running with an "if" statement before running your normal program.

Just a suggestion. Love your program!
ikke009 #12
Posted 12 March 2013 - 10:50 AM
This is awesome :D/> I was planning to do this myself sometime but I guess I wont have to anymore xD
also at the post above this, yes this is indeed called a nonogram sometimes.
Actually, picross 3D on the nintendo DS is one of my favorite games of all time :D/>

Anyways I've got a few suggestions for you. (please take them as suggestions, not as critisism)
-Add colors, use white for blank spaces, black for filled in spaces, and brown for safe marked spaces
-Add a barrier every 5 squares, to make things more structured (using | and _ cleverly may make this quite easy)
-Add puzzles that give you a nice picture if you solve them, just use classic picross puzzles as examples
-Add a life counter, as in you can only make 5 mistakes before you failed the puzzle and you have to start over, you lose a life if you click a square that isnt supposed to be clicked
-Just make the overall look of the game nicer, it will really add a lot of fun when playing it :)/>

I can see this becoming very popular if you keep working on it :)/>
Kingdaro #13
Posted 12 March 2013 - 11:06 AM
Nice work! Very tight, well-written code. I believe this type of puzzle is also called a nonogram. I'm slightly addicted to them, so it's really cool to see them in CC!
After some testing, the maximum stable size for your puzzle is 12. Anything larger and you risk cutting off some of the clues. You might consider adding a limit to the size that can be submitted in your program. I'm sure you can figure that out better than I can, but here's what I would do.

Put this in your "logic function" section:


local function checkSize()
if size > 12 then
print("Usage: picross &amp;lt;optional&amp;lt;")
running = false
end
end

Call it before anything else, and then check for running with an "if" statement before running your normal program.

Just a suggestion. Love your program!
Limits aren't really fun in my opinion. That and the user can increase the size of his or her screen through various means if he or she wishes to do larger puzzles.

This is awesome :D/>/>/>/> I was planning to do this myself sometime but I guess I wont have to anymore xD
also at the post above this, yes this is indeed called a nonogram sometimes.
Actually, picross 3D on the nintendo DS is one of my favorite games of all time :D/>/>/>/>

Anyways I've got a few suggestions for you. (please take them as suggestions, not as critisism)
-Add colors, use white for blank spaces, black for filled in spaces, and brown for safe marked spaces
-Add a barrier every 5 squares, to make things more structured (using | and _ cleverly may make this quite easy)
-Add puzzles that give you a nice picture if you solve them, just use classic picross puzzles as examples
-Add a life counter, as in you can only make 5 mistakes before you failed the puzzle and you have to start over, you lose a life if you click a square that isnt supposed to be clicked
-Just make the overall look of the game nicer, it will really add a lot of fun when playing it :)/>/>/>/>

I can see this becoming very popular if you keep working on it :)/>/>/>/>
"Nicer" is subjective. I wanted the game to have a simple, non-cluttered graphics style with clear indicators representative of their marking. I'm focusing more on the actual game itself, and not how it looks.

As for the lives system, both my friend and I mark squares we know aren't completely correct just to visualize what we believe could be correct, and giving a penalty to the player for testing theories doesn't really seem fair in my opinion.

…Actually, I could make the graphics style an optional thing. We'll see.

On another subject, I've changed some of the colors, and I've also implemented the ability to load images. I did this yesterday, but I've been too lazy to push the changes. I'll throw in the comparison thing remiX mentioned and make an update.
Kingdaro #14
Posted 12 March 2013 - 01:42 PM
Updated!
  • The drawing style in general has changed.
  • Optional drawing styles (with each square being a color, or the original ascii style)
  • Image loading
  • A comparison on the "I give up" screen.
Shnupbups #15
Posted 12 March 2013 - 07:35 PM
Yay! I like these! I used to LOVE picross and picross 3D on mah DS!
Could you possibly add a timer somewhere? It may be hard, but it'd be cool!