News for hackers. Stuff that matters.
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by degenerate on Wednesday April 26, 2017 @02:41PM (#14205767)
A fun little piece of the source:

<!--[if lte IE 6]>

If you read this it's probably because the world has rebooted. I don't know how but you arrived here. I'm sorry you cannot enjoy this little game but you will be able to in the not too distant future. Browsers will become incredibly better. Just before the world turns into chaos due to Nutella production shortages. Scientists will realise too late that Nutella was to humans what pollen is to bees. Don't believe the hype, the end didn't (or won't) happen because the 'left-pad' package got removed from NPM. Good luck.

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by joemaller1 on Wednesday April 26, 2017 @10:52AM (#14203447)
This is a great puzzle game and a very impressive demo web app. However, I wish it was available from the various app stores for two reasons:

1. I want to pay you for this.

2. It will be ripped off a dozen ways, and I would rather see you make money rather instead of some horrible knockoff app-vendor.

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by maxwellito on Wednesday April 26, 2017 @11:00AM (#14203531)
Thanks, I know it's the risk, but this is why it will always be free and ad-free on GitHub. Like 2048.

On Android + Chrome, a banner will popup to install it as PWA on your phone and you won't see the difference. I believe you are on iOS? I wish Safari iOS was better at following the new web feature (like WebRTC...)

Thanks for your feedback, that's pretty cool!

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by joshschreuder on Thursday April 27, 2017 @01:29AM (#14209377)
Kind of amusing to mention 2048 as it's a clone of 1024 which is a clone of Threes (an iOS game originally). At least according to Wikipedia.

  Cirulli himself described 2048 as a clone of Veewo Studios' app 1024, who has actually said in the description of the app to be a clone of Threes.
https://www.wikiwand.com/en/2048_(video_game)
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by Markoff on Wednesday April 26, 2017 @11:20AM (#14203687)
how to make it work offline? i would appreciate APK as well
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by maxwellito on Wednesday April 26, 2017 @11:25AM (#14203734)
By default (with chrome) a service worker will cache the app for offline use. If Chrome didn't asked you, just add the page to your homescreen.
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by Markoff on Wednesday April 26, 2017 @02:20PM (#14205567)
i am using Brave browser, there was no popup but it seem to work offline
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by maxwellito on Wednesday April 26, 2017 @03:41PM (#14206281)
Brave is based on Chromium. With a bit of chance, the service worker should be working as fine. That mean even offline you can access the page (by going to the URL as usual).

But I know, the UX sucks to access such a silly game :(

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by elaus on Wednesday April 26, 2017 @08:09AM (#14202293)
Solved the first puzzle on "easy" in 53 attempts. The first 20 attempts were me figuring out that the 4 dots beneath each try are not in the same order as I drew the pattern, so I can't directly deduce if a single dot is correct or not. Then it took me another ~8 attempts to find the four correct dots and then a very long time to get the order right.

Fun game, interesting idea and nicely done! I'll probably play a few more rounds when I get home.

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by fabrixxm on Wednesday April 26, 2017 @08:27AM (#14202370)
~53 attempts on first try too.. second try I was lucky and solved in 9...

nice time-waster :-)

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by dcousens on Wednesday April 26, 2017 @08:59AM (#14202543)
52 attempts first here, then 25 then 20... exactly the same thought process.
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by flanbiscuit on Wednesday April 26, 2017 @09:57AM (#14202963)
gave up around 15 tries on my first attempt because I refreshed to review the instructions again but my 2nd try on easy I did it in 7
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by fredley on Wednesday April 26, 2017 @09:09AM (#14202606)
I found the display of previous attempts a little hard to decipher (1-2-3-4 labelling would be much easier to parse, for me), but other than that great fun, and exceptionally polished presentation!
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by notheguyouthink on Wednesday April 26, 2017 @11:07AM (#14203580)
Conceptually i kept applying direction to success/failure. Eg, if one of them was correct, i kept fighting the assertion of the direction being correct, ie if 3 was correct i kept thinking 2 was related to 3's "correctness".

I imagine 1-2-3-4 would help my confusion a bit. It's weird though, i know it doesn't work that way, but i kept thinking that.

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by fabrixxm on Wednesday April 26, 2017 @08:31AM (#14202388)
There is some "overflow: scroll" that should be "overflow: auto" in CSS, IMHO.. So many empty scrollbars in firefox on osx...
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by maxwellito on Wednesday April 26, 2017 @03:47PM (#14206329)
I know... it was tricky to make Flexbox working everywhere. I ended up setting this property to make Safari looking fine. But you make me realise that it uglify everything on Firefox... I hope to find a good fix
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by lelandbatey on Wednesday April 26, 2017 @04:07PM (#14206495)
A very fun game, it feels like a more "computationally intense" minesweeper, though I guess I compare everything to minesweeper[1][2]!

It seems the optimal strategy is to initially try to ferret out which dots are in the solution set and which are not in the solution set via broad non-overlapping sweeps followed by slight pattern deviations to determine membership of particular dots. Depending on luck and your errors, this might take a half dozen moves, it might take two dozen.

Once you know which dots are in the solution set and which are outside, I find it takes less than 5 additional moves to determine order. For this part, a pencil and paper for tracking the elimination of certain dots from certain orders made this phase consistently quick.

Is very fun, I was ultimately able to beat the medium difficulty setting in an average of 15 attempts per game.

[1] - https://github.com/lelandbatey/defuse_division

[2] - https://github.com/lelandbatey/minesweeper-solver

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by Spare_account on Wednesday April 26, 2017 @08:49AM (#14202496)
Maxwell, you have a spelling mistake on the Success page.

"Lock found in 20 attemps. You must hate this game by now."

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by maxwellito on Wednesday April 26, 2017 @08:53AM (#14202519)
Dammit! Good catch! I'll fix it tonight, once at home. Thank you!

PS: Pull requests are welcome ;-) https://github.com/maxwellito/breaklock

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by todd8 on Wednesday April 26, 2017 @09:18AM (#14202673)
I saw this game (Mastermind or originally called Moo or Bulls and Cows) in an article in Software Practice and Experience[1] in the 70's. A couple of years later I saw a very clear explanation of how to write an effective software opponent, written by Knuth[2]. It was a lot of fun to implement back in those days (first in Fortran and then in Pascal). I recommend the easy paper by Knuth.

It's surprising how effective Knuth's algorithm is. If I recall 4 or 5 guesses to solve 4 digit mastermind.

[1] Computer Recreations, Software – Practice & Experience 1.2, 201-204 (Apr-Jun 1971) [2] D.E. Knuth, The Computer as Master Mind, J. Recreational Mathematics Vol. 9 (1976/7)

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by taneq on Wednesday April 26, 2017 @09:31AM (#14202752)
This is harder than Mastermind because you're not allowed to repeat colours/numbers in your entries.

Interestingly, I find I'm using some similar logic to what I use playing Minesweeper. "Three of this quartet are in the pattern, one of this quartet is in the pattern, they overlap in two places, therefore the two non-overlapped points in the three-scoring quartet must be in the pattern."

First try took 19 attempts, second try took 13 and I think I can do better.

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by ulucs on Wednesday April 26, 2017 @08:02AM (#14202249)
Pretty neat. Is there some kind of "strategy guide" for mastermind-like games? I feel that I'm operating at close-to-brute-force levels (I spent 22 attempts at a 4-lock) and I'd love to get better
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by Spare_account on Wednesday April 26, 2017 @08:15AM (#14202322)
I don't know the answer to your question, but I was curious to know if 22 attempts was anywhere near a bruteforce attack on a 4 point pattern.

This Quora thread contains some interesting breakdowns of the number of possible patterns that Android permits.

https://www.quora.com/Android-operating-system-How-many-comb...

If we assume that you don't know the number of points in use on a phone you're trying to unlock, the consensus seems to be there are in the region of 390,000 distinct patterns. One correspondent doubled that.

In the case where you know the pattern has 4 points, the number of valid permutations was calculated to be 1624. Your 22 attempt crack is well short of that figure so I think you are being harsh on yourself by implying you basically just got lucky. You're good at this!

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by Markoff on Wednesday April 26, 2017 @02:22PM (#14205587)
he has help feedback from game, normal Android won't tell you which combinations are partially correct, so you are comparing apples and oranges
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by onekorg on Wednesday April 26, 2017 @05:42PM (#14207295)
I wrote a program and I'm getting sub 6 for every easy game. Think of the board as a grid of numbers.

0 1 2

3 4 5

6 7 8

Then an L shaped pattern would be the string 0367.

The main idea is that you first build a list of every possible combination of legal moves. Then you take a random guess from that list and you will get back the number of white and black dots.

Now, since you know your random guess and the right answer produces X white dots and Y black dots, you can remove from the list of possible combinations every combination that has: dots(myGuess, combinations[i]) != (X, Y)

you can keep taking random guesses from this list and filtering after each attempt until you get the right answer, I'm not sure of the math but I think worst case It'll be 6-7 moves to find the right answer.

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by foota on Wednesday April 26, 2017 @10:29PM (#14208757)
Reminds me of a program I had to write earlier in school to implement an AI that would create hangman puzzles and then cheat on them by lying to the person playing, but in a way that they wouldn't contradict themselves and would have a valid word that matches what they've said so far.
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by celticninja on Thursday April 27, 2017 @06:01AM (#14210365)
In this vein, finding where you get 0 dots can be very useful as well.
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by vanilla on Wednesday April 26, 2017 @08:40AM (#14202437)
I think trying to exclude nodes is more efficient than trying to find the correct ones.

After you excluded all "bad" nodes, you need to find the order. finding the order with the help of "bad" nodes was also faster for me

I went from 56 to a lucky 5 tries.

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by at-fates-hands on Wednesday April 26, 2017 @10:08AM (#14203056)
This is the same method I used. As soon as you knew which 4 dots, it was a matter of simple brute force to deduce the actual order.

only 49 tries for me. lol

Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by M4v3R on Wednesday April 26, 2017 @08:17AM (#14202329)
Yeah, as Spare_account said, 22 attempts is probably a pretty good result for a first try at the game. I needed 60 :).
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by celticninja on Wednesday April 26, 2017 @10:03AM (#14203008)
Great time waster, worth making lots of guesses just to see the performance reports. My first go took 65 guesses which included working out the use of the 4 dots, the game appreciated my determination. my second go was 3 guesses but I admit I got very lucky there.
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by dhruvrrp on Wednesday April 26, 2017 @09:20AM (#14202693)
It's interesting how straight forward the game becomes after you recognize the pattern. Fortunately android lock screens don't inform the users about how many correct points they choose in the pattern!
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by samfisher83 on Wednesday April 26, 2017 @06:20PM (#14207578)
What is the algorithm to solve this in the shortest number of moves. I have got it down to 7, but there might be something faster.
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by cttet on Thursday April 27, 2017 @03:46AM (#14209875)
Yay, break the hard mode in 9 attempts! Kinda like Sudoku but more flexible.
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by foota on Wednesday April 26, 2017 @10:31PM (#14208767)
Reminds me of another phone game I've played, 0h n0. Quite fun.
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by scgrn on Thursday April 27, 2017 @05:31PM (#14214889)
I beat it in two moves out of sheer luck.
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by dksidana on Wednesday April 26, 2017 @09:15AM (#14202653)
Lucky to do in 10 attempts only
Re:Show HN: BreakLock – A hybrid of Mastermind and the Andro... by r3bl on Wednesday April 26, 2017 @10:04AM (#14203017)
I got really lucky and managed to guess it in 3 attempts. It was rather easy since I got two dots right in my first attempt.

http://imgur.com/tPdBU9O