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.
You've probably run across it and maybe even tried it, but I use CodeMirror for Codeframe [0] and it works well on the every mobile device I've tested on, and is pretty customizable.
I thought I had the same issue, until I realized that only certain lines are editable. On the initial page, only lines 13-16 allow editing, for instance.
It requires JavaScript to run. It works for me in all browsers. Try editing the text on the white background. If you still have trouble you can contact me here: https://www.ever.io/
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?
The story is a little misleading -- the correct sequence is not in fact "sitting right there in the code."
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.
My initial solution for this was to sleep 20*x milliseconds in setButton. Because the later random sleep is up to 10 milliseconds this ensures that the operations are always done in the defined order.
But I guess that's not what they were after, the solution was indeed as simple as:
I'm confused here too - is there some other desired behavior? I thought the goal here was to avoid race conditions and just reproduce that order, since that's what's in the source code...
> var buttons = []string{"red", "blue", "green", "yellow", "purple"}
There are none, right? So even if you add mutexes to the existing code in an attempt to remove race conditions, it will still have race conditions, and have no guaranteed output order, because you have no guarantee which order the goroutines will start in.
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.
Yeah I know about the hint. But the result the hint leads you to doesn't make sense. Using a Mutex removes data races, but it does not remove race conditions. By leaving the race condition in, the code is has output that cannot be relied on. But yet the challenge wants us to think that somehow the output has a specific value that can be relied on.
Maybe I'm an idiot, but I don't really get what level two is asking. I "solved it" in one line by directly returning the two numbers it's looking for. But that doesn't seem right at all.
If it works then that's probably right. Based on the hint I'm guessing they want you to set up meters and seconds such that if flows through the if statement but that seems a bit pointless.
Yup, assuming the Finale with rob is all there is to it. A couple of them were trickier (like in level 9, it was really not clear at all what the right output was supposed to be at first), but none of them seemed all that hard. None of them actually felt "fun".
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.
Not to discount your point, but I want to offer my opinion which is different.
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.
Oh heh, I declared another method then used that to set the passcode var (without the var being shadowed), return it to the hardcoded method name, and returned that.
// 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
}
Mission 4? I should probably be overriding the interface or something right? gotta get a record function in there somehow.. not as easy as `camera.record = () => { return 'Idle' }`
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".
Everything until 12 was something that I could sort of get without knowing Go, and then the difficulty magically jumped (which is subjective, but still).
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.