Show HN: GoCode.io – A Golang Game in the Browser
gocode.io
gocode.io
I think I cheated a bit on Level 7. I just copy-pasted the code that wrote to epochComms and changed it to write to interceptComms instead. I'm not quite sure what the intended solution is.
On Level 12, does Secret.extHash serve any purpose? It never gets read.
I was doing this on mobile (Chrome on Android) and I ran into a few odd problems. If you have two opening curly braces in a row and try to backspace to delete the first one, it instead inserts a newline and duplicates the rest of the line. That is, if you have "{{foo" with the cursor after the first curly brace and you press backspace you end up with two lines each saying "{foo". This doesn't happen for me on desktop.
Copy-paste also seems to be broken on mobile. You can't select anything and trying to paste is just ignored.
It would be nice if you go go back and view the hint after you've completed a level. Or even if you could try different solutions to a level after you've finished it. You may not always be happy with the first thing that works.
It uses the Ace Editor: https://ace.c9.io/
I couldn't find a more mobile friendly code editor, but I'm happy to test out other recommendations as I'd love for it to be enjoyable on mobile too.
It's a fun and refreshing way to look at code when you're usually always striving for best practice, idiomatic, etc. Very game-y that way. :)
https://thedailywtf.com/articles/Confessions-Hacker-Proof-Bo...
var buttons = []string{"red", "blue", "green", "yellow", "purple"}
> go run level_9.go
Sending Code Sequence...
1 : red
2 : blue
3 : green
4 : yellow
5 : purple
Sorry, that's not correct
Not sure what the correct sequence is, if not that?I "cheated" on some questions by causing the correct output to be printed without actually doing what the instructions recommend, but in this case, the path of the least resistance is probably to follow the instructions, including leveraging what the lightbulb hint recommends.
Additional Hint 1: Tbebhgvarf nera'g arprffnevyl rkrphgrq va gur beqre gung gurl'er fgnegrq
Additional Hint 2: Qb nf gur vafgehpgvbaf naq uvag fhttrfg naq svk gur enpr pbaqvgvba ol hfvat n zhgrk gb rafher gung bayl bar tbebhgvar ng n gvzr fyrrcf naq gura nccraqf gb gur neenl
Additional Hint 3: Lbh pna eranzr gur frgOhggba zrgubq naq znxr lbhe bja ercynprzrag gung pnyyf gur byq bar
If you want to "cheat": hfr lbhe oebjfre pbafbyr gb frr gur .tb svyrf gung ner ybnqrq juvpu pbagnva gur fgbel, pbqr, naq pbeerpg bhgchg.
Decode hints with https://rot13.com/
But I guess that's not what they were after, the solution was indeed as simple as:
z.Ybpx()
qrsre z.Haybpx()It's a bit annoying that it's depending on such an incidental behavior.
> var buttons = []string{"red", "blue", "green", "yellow", "purple"}
The obvious way to solve it in order to get the answer shown in the source code is
if x == 0 {
*sequence = []Button{{"red"}, {"blue"}, {"green"}, {"yellow"}, {"purple"}}
}
return
This way there is nothing concurrently touching sequence, nor is there anything concurrent touching rand, nor is anything relying on goroutine starting order, nor are there other race conditions. But yet the site says this is wrong.How do we know how the puzzle is executed?
And if you're saying some guarantee exists that the last executes first, then the rest execute in order, that's empirically false:
https://play.golang.org/p/3gV0TYG4GQW
1000
773
774
775
776
...I think it mostly felt less polished due to things like the lack of music and the fact that Go itself is a bad language for this sort of thing.
In Untrusted, there were often places where you could monkey-patch objects and come up with really creative solutions. There were some problems that I felt like I really had freedom to be creative.
In this game, the imports were always out of bounds for editing, so I could never pull in 'unsafe' and have any real fun. All the solutions felt far too restrictive. Sure, there were multiple ways to hack around things, but it never felt like there was room for a spark of real creative joy.
I think go is just a bad language for "fun". It's not optimized for being able to write interesting or elegant code. It's not optimized for having fun.
I had fun _because_ it was more constrained. But I also like Go.
As an example, I solved level 6 in what I understand to be an unconventional way:
(spoiler alert)
I realized I could “get out” of readCodesFromKeypad function scope by ending it early and then writing the start of another top level function. Once I had access to global scope, I could add an init() function to modify the “crypto/rand.Reader” variable and assign to it an io.Reader that I could control. I was on mobile so I decided to take a shortcut and just overwrite the global passcode variable instead.
(end spoiler)
I may have “cheated”, but it felt creative and in spirit of the game, and it got me to the next level.
if v, _ := validateCode(passcode); v == 1 {
return []string{passcode}
} // readCodesFromKeypad - get codes from keypad input
func readCodesFromKeypad() []string {
var passcode string
var codes = make([]string, 0)
// Agent Getter - bypass keypad input
// codes := streamKeypad()
// Agent Getter - try brute force login
// TODO: not finished, someone's coming...
// use shadowed "passcode" to avoid unused var error
return append([]string{passcode}, unshadowedMethod()...}[1:]
}
func unshadowedMethod() []string {
codes := []string{passcode}
return codes
}In the top right, there's a lightbulb you can click to reveal a hint for each mission. For this level the tip says "RecordingDevice is an interface, so it should be possible to create your own type of Camera".
On Reddit there's a thread that also contains some additional tips for some of the missions: https://www.reddit.com/r/golang/comments/c2hsaj/operation_go...