

0h h1 – A little logic game - mrtnkl
http://0hh1.com

======
typomatic
This is Unruly from Simon Tatham's puzzle collection:
[http://www.chiark.greenend.org.uk/~sgtatham/puzzles/](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!

~~~
teraflop
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.

[http://www.chiark.greenend.org.uk/~sgtatham/puzzles/devel/](http://www.chiark.greenend.org.uk/~sgtatham/puzzles/devel/)

~~~
jcl
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.

~~~
Zeebrommer
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)

~~~
mythmon_
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.

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

------
jsnell
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.

~~~
mrtnkl
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

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

------
spb
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|
        |      \|
        |\      |
        |O\_____|
         ```````
    

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?

~~~
phkahler
Or just use the right mouse button for blue.

~~~
umurkontaci
It would make it hard for touch devices

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

~~~
qmalxp
dual tap is kind of like clicking twice

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

------
phest
(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

~~~
lotharbot
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.

------
jws
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.

------
readerrrr
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.

~~~
seanalltogether
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.

~~~
bumbledraven
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.

~~~
seanalltogether
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

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

------
cousin_it
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...](http://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/unruly.html)),
which is extremely fun because you need to think ahead :-)

~~~
bumbledraven
_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](https://news.ycombinator.com/item?id=8606098)

------
tehwalrus
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!

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

~~~
bumbledraven
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

~~~
1wd
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
    

Reasoning:

    
    
      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

~~~
bumbledraven
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.

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

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

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

~~~
bherms
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.

------
sjoerd_visscher
There are app versions too!

iOS:
[https://itunes.apple.com/us/app/0h-h1/id936504196?mt=8](https://itunes.apple.com/us/app/0h-h1/id936504196?mt=8)
Android:
[https://play.google.com/store/apps/details?id=com.q42.ohhi](https://play.google.com/store/apps/details?id=com.q42.ohhi)

------
anon4
[http://imgur.com/EYF3kzS](http://imgur.com/EYF3kzS)

I don't understand what's wrong here.

~~~
mankyd
Rows 3 and 5 are identical.

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

~~~
sp332
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.

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

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

------
Chirono
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.

------
logicpuzzles
This is basically [http://www.conceptispuzzles.com/index.aspx?uri=puzzle/tic-
ta...](http://www.conceptispuzzles.com/index.aspx?uri=puzzle/tic-tac-logic)

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

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

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

------
chx
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.

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

[http://i.imgur.com/BU5L61L.png](http://i.imgur.com/BU5L61L.png)

------
jisaacstone
Having trouble finding the problem with this solution:
[http://i.imgur.com/ToduSGR.jpg](http://i.imgur.com/ToduSGR.jpg)

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

~~~
brute
Rows 4 and 7 are identical

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

~~~
brute
With great power comes great responsibility.

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

[https://github.com/Q42/0hh1](https://github.com/Q42/0hh1)

------
bumbledraven
Here's a solver for the puzzle:
[http://pastebin.com/ws6wv6Ew](http://pastebin.com/ws6wv6Ew)

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

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

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

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

~~~
dannytatom
double tap

------
jtolds
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.

------
fogleman
Love the game. Just wrote a solver in Python:

[https://github.com/fogleman/OhHi/blob/master/main.py](https://github.com/fogleman/OhHi/blob/master/main.py)

~~~
bumbledraven
It doesn't terminate on this one:

    
    
             '00....',
             '110010',
             '......',
             '0.1.0.',
             '.....0',
             '1.0.10',
    

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

    
    
             '00..0.',

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

~~~
bumbledraven
_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](http://www.takingthefun.com) for
other games and puzzles I've solved with it.

------
ShoePooPoo
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?

~~~
gr3yh47
i am getting webpage unavailable

------
vlunkr
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.

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

~~~
ScottWhigham
_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.

------
readerrrr
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.

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

~~~
readerrrr
Well that's embarrassing.

~~~
function_seven
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.

~~~
readerrrr
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.

------
egregiouscoder
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

------
ggchappell
Very nicely done.

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

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

------
kelvin0
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?

~~~
GrinningFool
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,

~~~
kelvin0
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 ...

------
Sarien
Bug? [http://imgur.com/DmSGy76](http://imgur.com/DmSGy76)

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

[http://i.imgur.com/yzD9qFL.png](http://i.imgur.com/yzD9qFL.png)

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

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

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

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

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

------
NKCSS
Fun, its a lot like binairo

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

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

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

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

------
GuriK
This is awesome, but tutorial seems slow and boring.

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

~~~
apetresc
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?

~~~
rulesaway
A way to just see the damn rules! :)

