Hacker News new | past | comments | ask | show | jobs | submit login
0h h1 – A little logic game (0hh1.com)
411 points by mrtnkl on Nov 13, 2014 | hide | past | favorite | 152 comments

This is Unruly from Simon Tatham's puzzle collection: http://www.chiark.greenend.org.uk/~sgtatham/puzzles/

I install this on literally every device I own. Windows machines, linux machines, android machines. It's a great source of small, procedurally generated puzzles. I often just put on some music and zone out playing Pearl for a while.

e: If you're on Ubuntu: sudo apt-get install sgt-puzzles

e2: I misremembered, it's not precisely Unruly--Unruly allows you to repeat rows/columns. But whatever, go install these games!

That collection is technically kind of interesting too. The puzzle code itself is written in portable C, using a custom-built common framework and UI abstraction layer that allows it to run on pretty much any platform.


Also, each puzzle has its own custom constraint solver to generate fresh puzzles with desirable characteristics. For example, the version of minesweeper in the collection generates puzzles such that the first click never reveals a mine and that there is always a logical path to the solution -- no guessing needed.

I always wonder with these kinds of puzzles how one can come up with an initial settings that (a) yields a unique correct solution and (b) has a logical next step at every step (so doesn't require thinking ahead x steps to arrive at a conflict)

Conveniently enough, there's a long section of the developer docs that covers exactly that topic: http://www.chiark.greenend.org.uk/~sgtatham/puzzles/devel/wr...

For at least Loopy, the generator works by generating a full puzzle with all hints, and then removing hints one at a time until the solver can't solve the puzzle. So the complexity of the puzzles that can be generated are dependent on the cleverness of the solver.

That's less elegant than I hoped for. Still works though!

One possibility is to generate or change small parts of the puzzle each turn. For minesweeper for example you start out with an empty field, and after the first click you generate the mines.

This almost seems like something you'd see in a thedailywtf article.

Want to write an application that does X? Design, build, test, and document a flexible cross-platform framework that can safely and portably run any application in the domain, and then specialize it to do X!

I have to say, though, that it seems to have actually worked out for the best in this case. He added a ton of puzzles at a rapid pace and they've spread to a surprising number of platforms.

And now maybe you understand why "flexible cross-platform frameworks" are not automatically a WTF ;)

Oh wow. These were installed on all the computers at school. We would often have hours where we didn't have any lessons scheduled, but couldn't play games, watch YouTube or go on Facebook as we would get our accounts suspended. This was the only game we could play as we could argue that it was technically "learning". The other one was a website where you had to name and locate all states in the USA. We are a British school.

If you choose a custom board size for Unruly, it also lets you choose the option to make rows/columns unique. This slows down the generation.

This is also the same as the Landscaper puzzles in the Logic Games iOS app (https://itunes.apple.com/us/app/70-logic-games-time-killers/...)

Unruly has an option to enforce unique rows & columns.

This just killed my productivity and made my day.

A few bits of feedback:

- There's no list of rules anywhere. If you forget any rule, you need to go through the tutorial again.

- Is the tutorial missing a rule? (It has the "no two identical rows" rule, but it seems like you also can't have two identical columns).

- The endgame needs work. Right now it's simply highlighting every square that's wrong, rather than just telling which rule was broken. This is absolutely ridiculous, since at that point the player can simply flip every highlighted square and pass (and score the full points?).

There are two alternatives I can think of:

a) Instead of telling which squares are wrong, find an instances of the rules being broken. So for example highlight two rows that are equal, or a column of 3 identical squares, etc.

b) End the game when the board is full, but dock points for incorrect spaces, rather than force the player to go through the busywork of just toggling all squares that were wrong.

I have to agree with (a) here. Upon reaching the end of a 6x6, as far as I could tell no rules were broken, yet the solution was not valid.

I'm wondering if multiple solutions can exist and the game will only accept one.

Same here. Can't see what i'm doing wrong. Nice to have the rules on the side or a button to press to show them.

Yeah everything in this 10x10 seems right and I have looked over every single row and column to confirm that I haven't broken any rules but it still tells me that 8 random tiles are incorrect.

You should take a screenshot. See if anyone else can find something you might have missed, or can confirm that you found a winning solution.

here is a 4x4 that naively seems like it should be a legal solution, but isnt:

same number of 0s as 1s per row same number of 0s as 1s per col no rows or cols with run of 3 of same value

edit: oh - "no two rows are the same". fail. disregard this. must have clicked past that in the tutorial.

That's the point of having a clear set of rules somewhere because most people skipped that part of the tutorial. (I did too) I had to be stuck somewhere, quit the game and redo the tutorial very slowly just to see if there's a rule I didn't see ;)

Another way to find the rules is to use the "eye" on every turn in a 6x6 or 10x10.

Same here. It took me a while to notice that there were two identical vertical rows.

Hi, I'm Martin, the author. Thanks for analyzing the game and the recommendations. I was actually working on your solution a already. So it will be coming up shortly. Also, for those who were suggesting to put it on iTunes and the Play Store, it already is. Enjoy playing! - @mrtnkl

You should put a link to the app in the app stores on the website.

Thanks for not requiring my home address and current blood-sugar levels to install the android app!

I have nothing much to contribute, but I want to say that this is really well done, I'm having a lot of fun with it, and thanks for making an iOS app for it. Now I just need to train my brain to notice rows determined by the "identical row" rule....

I actually appreciate the sense of discovery in the way the rules are presented. It felt like someone was actually watching me play and stepping in once they saw I was stuck.

I had trouble with the "no two identical rows" rule as well. I didn't see it in the tutorial and on the 10 x 10 it was a key piece of logic to solve the puzzle.

Enjoyed the game play and the graphics are very smooth and clean.

Yes, it's pretty easy to maximise your points-per-second simply by clicking everything once to red, then correcting the ones that the endgame says are wrong.

Yes, I believe it is missing a rule. If columns don't need to be identical than this 10x10 puzzle won't have a unique solution: http://i.imgur.com/ZQ8pkfm.png

I get the same problem with valid solutions that don't match whatever it's comparing as the "right" one. It would be better to instead do a goal test after the final square has been filled? Seems to me this wouldn't be too hard to implement instead of comparing with a key.

Nope, there's just one: look at column 1 and 4, so far they are the same.

That's the point.

The rules don't explicitly say that columns need to be unique (only rows).

Within the stated rules there are (as best I can see) 2 valid solutions to that puzzle. It is the introduction of the unstated unique column rule that resolves it.

The author is not a native English speaker, but it seems obvious that the row rule should apply to columns.

It would be better if I could set red or blue with one click rather than having to cycle through. Some UI like this, where X is Red and O is blue:

    |     \X|
    |      \|
    |\      |
Tapping the red or blue corner of an unset gray tile would would set the tile to the tapped color, and tapping a red or blue tile would unset it back to gray.

Also, the "fixed" tiles of the puzzle need to be presented in a different style from the "dynamic" tiles the user can set.

Is there a GitHub repo for this?

Or just use the right mouse button for blue.

It would make it hard for touch devices

So they can use dual tap? No reason to dumb more capable platforms down to the lowest common denominator.

dual tap is kind of like clicking twice

"No reason to dumb more capable platforms down to the lowest common denominator."

(Edit: so this is a pre-existing game concept. Should have read the about page first :) Thanks for showing me this game in a nice little implementation anyway. & my feedback/suggestion still stands.)

Outstanding work. This is an excellent, simple and original logic game, well done.

Only negative thing I experienced: it can be tough(/not particularly fun) to find similar rows/columns when playing on larger grids. And I don't feel like finding similar complex line patterns is where the game design esthetic shines. Not sure how you could solve this. Perhaps some sort of visualization of similarity of rows for larger grids? Say two rows are identical (minus missing tiles), then the same little icon could appear to the right of each row. Icons could be differentiated by shape, or color. Just an idea. Good work :)

Disclaimer: I'm a game designer

I probably wouldn't do something as blatant as "always pre-mark identical rows for me". But something simpler like a "highlight all rows that currently match this one" button would be nice for probing for identical rows.

I like the effort that went into the eyeball command. It speaks to you like a human. That is, rather than showing a cell hint, it works out how you would get there and tells you that.

I did similarly in a sudoku game, it is an interesting exercise that then colors your thinking about error messages in future programming.

10x10 solved. It seems too easy. It is almost an auto solver, you just have to find two blocks of the same color together, or two blocks with the same color with an empty block in-between.

Great for a young person, but I would like to see a version with more rules and constraints to follow.

The UI and the UI feedback is outstanding though.

Oddly enough, I found the 10x10 easier to solve then the 6x6 and the 8x8. After a couple play-throughs I think I know why. When trying to determine your next move, there's 3 options.

1. Look for a chance to play a block that wouldn't cause a chain of 3 colors together.

2. Look so see if the row or column has enough of a certain color in it.

3. Look to see if the row or column is a duplicate of another.

1 and 2 are easier to spot, but 3 is actually quite difficult and takes a lot of time to determine. On the 10x10, option 3 is almost never the determining case, probably because there are so many more possible configurations for a row or column, vs on a 6x6.

Those three heuristics seem to work for the puzzles on the site, due to a limitation of the site's puzzle generator. However, there exist puzzles of this type which cannot be solved using only those three heuristics.

Take this one, for instance:

  - O - - - -
  X - - O X -
  - - - - - -
  O - X - O -
  - - - - - O
  X - O - X -
This puzzle has the unique solution shown below, but none of your three heuristics will make any progress on it.

  O O X X O X
  X X O O X O
  X O O X O X
  O X X O O X
  O X X O X O
  X O O X X O
One of the ways you can solve this is to note that the square in the upper-left corner must be O. This is because if it were X, then there would be three adjacent Os in the first column. This insight is due to calebcjh@gmail.com.

Except that your puzzle has multiple solutions, so I'm guessing that's why it breaks the heuristics. The same would be true of a sudoku puzzle with too few starting numbers.

  O O X X O X
  X X O O X O
  O O X O X X
  O X X O O X
  X X O X O O
  X O O X X O

Your solution is not valid. The 3rd column and the last column are duplicates.

Glad to see this comment too.. I thought I was hitting a bug or something (making the game way too easy to solve :p). Just turning off the hints would make it much more difficult imo.

> but I would like to see a version with more rules and constraints to follow.

That would actually make it easier, not harder. The more constrains you have the fewer possible options you have, and the easier the puzzle.

More constrains does not necessary translate to less choices. And even when it does, less choices do not necessary make it an easier game.

For example: I remove undo move, then you certainly have less choices but, the game is harder( even for a computer ), since you have to remember previous states which were previously accessible via undo.

Interesting! It looks like the game never requires you to backtrack, there's always a way forward by applying some rule exactly once. I guess that's why you have the requirement for unique rows and columns (which is pretty jarring gameplay wise), otherwise the forced games would be much more boring.

That kinda limits the possible intellectual enjoyment from the game, though. Without the requirement for unique rows and columns, the game would become Simon Tatham's "Unruly" (http://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/unrul...), which is extremely fun because you need to think ahead :-)

It looks like the game never requires you to backtrack

There are puzzles of this type that require either backtracking or exceedingly complex heuristics. However, the site only seems to generate simple puzzles that do not require backtracking.

See https://news.ycombinator.com/item?id=8606098

Is every puzzle deterministic? I've twice now run out of rules to apply, just seen a solution and tapped it in. I'd hate to have to go and unmark all the squares since I guessed!

There is always a solution which doesn't require guessing.

I would be very interested to hear an explanation of how to solve the puzzle below without guessing. For reference, the unique solution is on the right.

  - - - O - -               O X X O X O
  X - - - - X               X O O X O X
  - - - - - O               X O X O X O                                         
  - - - X O X               O X O X O X
  - - - - - X               O X O O X X
  - - X - - O               X O X X O O

Order to fill in the board (1, 2, 3, ... 9, A, B, C, ... N):

  B C D O 2 1 
  X 3 G N 4 X 
  M N H I 5 O 
  F E F X O X 
  L K J 6 A X 
  9 8 X 7 8 O

  1. finish column
  2. avoid OOO in row
  3. avoid OOO in row
  4. avoid OOO in row
  5. avoid OOO in column
  6. don't duplicate column 6
  7. avoid XXX in column
  8. wrap XX on both sides
  9. finish row
  A. finish column
  B. avoid OOO in column
  C. avoid XXX in column
  D. finish row
  E. don't duplicate column 5
  F. finish row
  G. avoid OOO in column
  H. avoid OOO in column
  I. avoid XXX in row
  J. finish column
  K. avoid OOO in row
  L. finish row
  M. finish column
  N. finish rows

Nice work! Step 6 was the one that eluded me. Using that principle I've now been able to solve several boards that I previously thought required guessing.

Yeah, finding step 6 took me much longer than any other step. (Followed by step E.)

Do you see a way to make progress on this one without guessing?

  O X - - X O
  X - - O - -
  - O X X O -
  - - O - - -
  O - X O X -
  X O - - O -

The fact that the game doesn't accept valid solutions besides the one it wants is a turn-off.

You mean it didn't accept your invalid solution.

I've found that it seems to accept any valid solution. Perhaps your solution wasn't as valid as you thought?

I finished an 8x8 and it didn't accept. Showed it to 4 co-workers and nobody could find any issue with violating the rules... Should've screenshotted.


I don't understand what's wrong here.

Rows 3 and 5 are identical.

This rule is easily overlooked in the tutorial, since the example shown can already be resolved using earlier rules (balancing red/blue in columns).

The tutorial must use an example where unique rows/columns is the only way to resolve the choice...

I guess I missed this rule. I got into a similar situation and thought there was a bug

Oh, right. But what about the ones on row 1?

Well if you switch the squares on row 3, you have to switch the square on row 1 as well. Otherwise the columns will not have even numbers of red and blue squares.

Oh. It's really confusing to show not only the current mistake but also the mistakes that would be introduced by fixing it.

True. There is only a single solution to each puzzle, so it just highlights all the blocks which don't match the known solution.

Really nice idea, but it seems like quite a reliable way to win is to fill all the squares in red, and then change all the places it tells you are wrong.

Perhaps rather than pointing out which cells are wrong, highlight the group/row/column that break the rules instead. That might make it slightly harder.

This is basically http://www.conceptispuzzles.com/index.aspx?uri=puzzle/tic-ta...

If you are interested in those kind of puzzles there might be more logic puzzles on this page that you like.

Does this remind any one else of Sudoku? In the same vein at least. Anyways very cool, great job!

I felt I reused more logic from Griddlers/Nonograms, actually.

Yes, this was my first though also. Now when's it on the app store ;-)

If you resize the browser window, the UI kind of loses its mind, and can't be restored without reloading the whole page.


Having trouble finding the problem with this solution: http://i.imgur.com/ToduSGR.jpg

Anyone see what the issue is? Been staring for 20 minutes . . .

Lines are not allowed to match. Eg line 4 and 7 are the same (which is not allowed)

Same thing happened to me. Looks like it checks for one hard-coded answer when there could be many for a given puzzle. It should just check that your board satisfies the rules described in the tutorial instead.

There are two identical rows.

The game should show the identical rows/columns instead of just highlighting every incorrect square... it can take a while to find out what's actually wrong with a solution.

Rows 4 and 7 are identical

This is correct. I think I may have fat-fingered a downvote on you.

With great power comes great responsibility.

Try flipping the horizontally adjacent blocks

no I mean which of the rules is being broken?

For the 8x8 table there's a trick you can do which I suspect the heuristics never considers (because the rule violation is not 1 but many steps away): if you have a chit of one color on 1, 5 and one more above 5 then any more above 5 can't be of this color otherwise 2-4 all three would need to be of the opposite color and that's illegal.

Same for 1,2,4: 5 is of the opposite color otherwise 6-8 are of one color.

0h h1 is now available on Github. Clone away :)


Awesome, this is really well done. I especially like how the hint function reminds you of the rules you've forgotten.

Here's a solver for the puzzle: http://pastebin.com/ws6wv6Ew

It's written in clingo (http://en.wikipedia.org/wiki/Answer_set_programming)

Clicking the top row seems broken sometimes. I suspect when I think I'm clicking a cell on the top row that I'm actually clicking the board size element ("4x4" or "10x10"), and it's not transferring through to the underlying cell.

It would be nice if you could set the color to blue by right-clicking rather than double-clicking.

let us know how to right click with a single touch device then

double tap

Maybe it's just broken for me? All I see is a dark screen, although all sources load. I also downloaded the page and sources and tried to launch locally- nothing works. Maybe it's my locked down work computer?

i am getting webpage unavailable

Love the game. Just wrote a solver in Python:


It doesn't terminate on this one:

This puzzle has a unique solution (See https://news.ycombinator.com/item?id=8606098). To give your solver a hint sufficient to solve the puzzle, set the first row to:


Yeah, my solver is pretty basic. Was that puzzle from the website? BTW, love your solver... how did you learn about clingo?

Was that puzzle from the website?

No, my friend and I made that one. It can be solved without guessing, but it takes another heuristic beyond the three or so that people usually use. We also have ones that require guessing (can't be solved with any reasonable heuristics as far as we know.)

I learned clingo to solve puzzles and business scheduling problems. Check out my web site http://www.takingthefun.com for other games and puzzles I've solved with it.

This is really fun! My suggestion is to think of a more memorable name. I've played several times today and I've forgotten the name every time and had to come back to HN to find it.

0h h1 oh hi I get it now, oops!

You get it, but will the masses remember the name? I doubt it. Terrible name when it comes to mass appeal; kitchy name for techies.

Very cool concept! At first I thought it was going to be like 2048, but it ended up being more of a challenge which I enjoy. Would love to see an app version of this

Would love to disable the helper at the end of the game. Kind of ruins it for me. Otherwise, it's fun!

I would like to know what tools/frameworks/languages were use to develop this cool game. I know it boils down to HTML5/CSS/JS, but was it DART? TypeScript? What frameworks did you use? I want to start a small game as a web app, but I'm having trouble settling into which tools ... so far I'm tinkering with DART and Polymer ... ideas, suggestions?

I'm making an assumption here that you don't have a lot of development experience. Given that: start with the basics. Pure javascript/html5/css. You'll then learn what you want out of a framework and will have a better foundation for the next project (which might be a rewrite of the same thing).

You'll also get a first-hand view of how screwed we are in the HTML5 "standards" department,

Actually I have quite a bit of programming experience, and that is the reason why going straight to Javascript (as I have done before) does not seem productive ...

No one else with programming non-web apps finding this HTML/CSS/JS ecosystem intimidating? Please feel free to bash on this comment too..

All I ever used at university was Java and Python, it was extremely intimidating for me to have to learn 3 languages to start doing web programming. After a few months of daily front end work they start to blur together and become one in the same.

Just dive in and you'll get used to it soon enough. Html is really easy and JS is similar to other C-like languages, css is pretty hard if you're building complex applications IMO but things like LESS and SASS make it easier to deal with.

Just look at the source!

Once the beef has been turned into a hamburger, it's hard to identify the specific animals that went into the hamburger's composition ... if you know what I mean.

That somewhat holds for non web apps but when you have the source it's pretty easy to tell what it was made with. Usually if it's a compile to javascript language like TypeScript or Dart the source is going to look horribly obfuscated. The js on the page is pretty straight forward so I really doubt he used one of those.

Looking at the source it looks like everything is hand rolled except for the jQuery dependency.

Did you take a look at the source?

What are you referring to? Looks like you have several three-in-a-rows, and some other squares are highlighted because they will be invalid once you fix the triples. (Could be wrong!)

I got a similar thing - a different valid permutation than the "official" one.


Well, at least I'm not the only one who apparently didn't pay attention for half of the tutorial. :)

I didn't have any three-in-a-rows, nor identical rows. What rule are you referring to?

You do. Row 3 and 6 are both RBRBRB.

edit: I see you noticed.

Oh ok, rows 3 and 6 are identical. I feel stupid now.

Seems it would be better if the "that's not right" error highlighted the matching rows rather than what to click on to win.

Oh, sorry! Confused.

rows three and six are identical

rows 3 and 6 are the same.

You can't have 3 of the same colour in a row

Oh, I thought it was in the same row. Well, that makes more sense. I treated it like a form of sudoku with only 2 symbols and 3 repetitions allowed.

Very nicely done.

It seems like the solution is always unique, for a given starting point. Is this the case?

I have a feeling we're embarking on the next 2048-like trend! Awesome game!

edit: I'm wrong.

I have found a correct solution, yet the game doesn't accept it:

B r r B

r B B r

B B r B

B r B r

The correct solution was:

B r r B

r B B r

B B r r

r r B B

My guess to this is that there are more than one solutions to the problem and checking if the board is solved is done by finding the first solution and comparing it to yours.

Your third row contains 3 B's and only one r. Each row and column has to have an equal number of each.

Well that's embarrassing.

Earlier today when I saw this thread I came to post my game that "should have won but didn't", only to see to many other people posting the same. For me it was the "no duplicate columns or rows" rule that I didn't notice. Something about this game is tripping a lot of people up.

The thing is I know about the rule of equal number in each row and column, and have used it to solve a few 10x10, but when switching to a 4x4 I forgot it exists. I took some time and went trough the rules I knew, before posting this "error", but that one rule was gone.

it's like playing Sudoku merged with Minesweeper, I really enjoy it!

Fun, its a lot like binairo

This is absolutely fantastic -- love it! Thanks for making this.

It makes a mistake when more than one solution is possible.

You should have an overview of the rules on the game page.

This is awesome, but tutorial seems slow and boring.

Friendly reminder: launch iOS/Android version before someone else does

As far as I can tell, this is the same game as Unruly[0], which is included in Chris Boyle's Android port[1] of Simon Tatham's puzzle collection.

EDIT: The history is a little more interesting than that. The janko.at page on Tohu wa Vohu[2] names many pre-existing variants: Eins und Zwei, Binary Puzzles[3], Binoxxo, and others. Binary Puzzles are notable for being paper-and-pencil puzzles, but it's not clear whether these were first paper-and-pencil puzzles or computer puzzles.

[0] http://www.chiark.greenend.org.uk/~sgtatham/puzzles/doc/unru...

[1] https://chris.boyle.name/projects/android-puzzles/

[2] http://www.janko.at/Raetsel/Tohu-Wa-Vohu/index.htm

[3] http://www.puzzle-magazine.com/binary-puzzle-magazine.php

Wow that collection of puzzles is awesome, thanks for the reference!

Eh? I thought the tutorial was great. Took less than 2 minutes, I totally understood the rules, and had completed a sample puzzle. What more could you want?

A way to just see the damn rules! :)

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact