Hacker News new | comments | show | ask | jobs | submit login
Show HN: The Deadlock Empire – Slay dragons, master concurrency (deadlockempire.github.io)
269 points by prvak on Feb 9, 2016 | hide | past | web | favorite | 30 comments



This is awesome! I love this kind of games - they are very fun and educational at the same time.

If you're like me, you might enjoy these as well:

1. Microcorruption - https://microcorruption.com/ (a game that teaches about embedded systems and security basics)

2. Over the Wire - http://overthewire.org (several games based on Web security)

3. WeChall - http://www.wechall.net/ (a big list of games with progress tracking)


The Microcorruption folks are in beta for 'Jailbreak' along the security angle again. They are also doing Stockfigher a trading simulator. https://www.stockfighter.io


Scalatron is another great one https://scalatron.github.io/ "a free, open-source programming game in which bots, written in Scala, compete in a virtual arena for energy and survival"


Continuing the theme of replying to this post with good examples of these kinds of game: https://alexnisnevich.github.io/untrusted/ ("a user javascript adventure game")


Ruby Warrior is another great one. I had a lot of fun with it when I needed to learn Ruby for work. https://www.bloc.io/ruby-warrior


Is there any way past the first level besides logging in with facebook?

A friend of mine just started (yesterday) looking at Ruby stuff and this looks awesome, but I wouldnt recommend any service that has an impassable FB login after level 1.


You can use the original without logging in to anything. It doesn't have the graphical elements, but in my recollection, the game is the same otherwise.

https://github.com/ryanb/ruby-warrior


This is really cool! However, I was somewhat disappointed that it only models a linearizable memory (each low-level operation atomically acts on the same global state). It would be great to teach people that they can't actually think about memory this way, since various reorderings are possible. The UI design gets a lot trickier, but this could become a great way to teach people how to deal with things like atomic instructions, memory fences, and the differences between the x86 and ARM memory models.


Thanks! We agree, memory models/instruction reordering is where it gets really fun and educational. The complexity scared us and we wanted to make the game usable as soon as we could, so we rather left it on the TODO list for now. Maybe one day in V2 :)


You could add a CPU write buffer or cache lines as an intermediate step between the code and memory, and allow the player to choose when those get flushed to memory, constrained by memory barrier operations.

This kind of problem comes up very often in the context of the Linux kernel. And the ability to deal with it is as even rarer among programmers experienced with concurrency than experience with concurrency is among programmers in general. A tutorial of this form for memory ordering issues would be invaluable.

I'd be happy to help with problems and game-element design for a memory-ordering version of this tutorial.


This game would actually make for a great assessment test[1] for hiring. I might be interesting to retrofit it to keep score or maybe perma death ala roguelike.

[1]: https://en.wikipedia.org/wiki/Test_(assessment)


Whoa[0] there[1], slow[2] down[3] son! You don't have footnotes for the rest of the common words in that sentence! What is a 'game'? Or 'score'? Or 'rogue' 'like'?

[0] https://en.wiktionary.org/wiki/whoa [1] http://www.merriam-webster.com/dictionary/there [2] http://dictionary.reference.com/browse/slow [3] You get the idea


Assessment testing is not a common phrase. In the recruiting industry it means something very specific and I wanted to make sure it was explicit that I am talking about that type of testing and not just testing for whatever other reasons you might test someone.

Years of programming I guess have made me an explicit cross referencing kind of guy. I find it far worse when your not explicit at times. Misunderstood communication can lead to bad things...



Yep. My creative process: "Need quick & nice fantasy-styled logo" => "Hey, I remember Wales has a dragon on its flag" => "Ooh, and Wiki Commons even has a CC0 SVG! Done."


Funny, I immediately associated it with Team Cymru [1] and apparently they did use the original Welsh Dragon as their logo but changed it to a more modern variant [2].

[1]: https://www.team-cymru.org/about-us.html [2]: https://www.google.com/search?tbm=isch&q=team+cymru+logo


This is pretty nice, well done!

One suggestion: it would be nice if you somehow integrated the fix for each bug into the game somehow. At the very least, in the congratulations screen, you could show a version of the code updated to fix the concurrency bug.

In other words, this helps you learn what not to do, but not so much on what you should do.


Hey! This was built at HackCambridge (and it won first prize)! Great to see it here - it's such a cool project.


Pretty funny that one of the judges said that this would definitely be on the front page of HN soon


Wow, how cool is that! Congrats to the authors :)

Btw, I bet Edward Lee¹ would like this game.

¹ http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1....


What language is this in? Never really tried anything like this before, but just went through the entire game and beat it. Seems like you have to trick the threads in the correct sequence in order to introduce deadlocks, but what is the overall context of the game? (It was fun, but I didn't know what I was doing half the time; I just tried to get the threads to hit the critical code functions)


>Seems like you have to trick the threads in the correct sequence in order to introduce deadlocks

This manually "trickery" you are introducing is you intentionally replicating potential control flows that can (and will) happen in real life. You should come out of this game with a new/renewed paranoia about multithreaded programming and how seemingly safe code may not necessarily be so.


Took me about an hour to beat it, I'm still fairly new to concurrent programming so this was pretty great for showing me the pitfalls you can come across.


I think I may learn some C# just so I can play this game.


I've only done the first few levels but it might as well be pseudo-code. I haven't hit anything language specific yet.


Thanks. I'll give it a try after work then.


quite the fun game EDIT: can't figure the last one out, but was fun :D


1. Move Thread 0 to end.

2. do a few iterations through thread 1 (e.g. n=5)

3. step darkness++ concurrently (via expand), so that darkness=1

4. step thread 0 to Monitor.Wait(sanctum)

5. the rest is straightforward.


Whoa! Spoiler alert!

;)


This is really gonna help me study for my OS midterm tomorrow- thanks!




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

Search: