Hacker News new | past | comments | ask | show | jobs | submit login
The Unix Game (unixgame.io)
259 points by salgernon on May 28, 2021 | hide | past | favorite | 32 comments



A small bug report: If I enter 0 as an input number in one of the commands, I get a Javascript stack trace in the console :]

    TypeError: blockMap[arg].value.replace is not a function
        at /home/ubuntu/unix50/web/src/webserver.js:1032:182
        at Array.map (<anonymous>)
        at /home/ubuntu/unix50/web/src/webserver.js:1032:50
        at Array.forEach (<anonymous>)
        at buildUnixCommandVertical (/home/ubuntu/unix50/web/src/webserver.js:1025:18)
        at buildUnixCommand (/home/ubuntu/unix50/web/src/webserver.js:920:20)
        at /home/ubuntu/unix50/web/src/webserver.js:1042:19
        at Layer.handle [as handle_request] (/home/ubuntu/unix50/web/src/node_modules/express/lib/router/layer.js:95:5)
        at next (/home/ubuntu/unix50/web/src/node_modules/express/lib/router/route.js:137:13)
        at Route.dispatch (/home/ubuntu/unix50/web/src/node_modules/express/lib/router/route.js:112:3)
Edit: ooh and it's vulnerable to shell command injection... and the VM has internet access. Problem reported.


thanks for reporting! Both issues should be fixed now.


Seems to be! Thank you <3


I would love to be able to just type the command line in; dragging blocks around is really slow and unnatural. But probably I'm not the target audience...


My thoughts exactly. Furthermore, this would be great training/practice for eg. Linux Foundation certifications with just the questions and "here's a terminal, go solve it".


it reminds me of the early LEGO robotics programming setup - and how NQC (not quite c) was much easier to use for those with familiarity with programming.

Part of the problem is there are hundreds of ways to use unix tools to get the correct response, so you'd need an entire shell and output parsing to prevent frustration.


> Part of the problem is there are hundreds of ways to use unix tools to get the correct response, so you'd need an entire shell and output parsing to prevent frustration.

I think that's part of the beauty!

But you could still support only some common POSIX tools, basically, the ones they've got "blocks" to pull from.

If I could type these in, I'd have a lot more fun — this way, I gave up after the intro questions because it's so time consuming.


They also used that block-code setup for a game, Stormrunner where you control a robot with the mindstorms block language. Kind of like Logo but with sweet graphics.

http://biomediaproject.com/bmp/files/LEGO/gms/online/Mindsto...


I figured that was just a convenient way to avoid all the security problems that come with exposing a shell online whilst also limiting the inputs, although I'm sure there's other ways to do that. Might be nice to have the option I guess.


It's something I would give my interns to learn how to use the command line and how it's supposed to work.

I've found some very good interactive tutorial for Git and such, and it works very well for teaching/learning.


This is pretty cool, looks similar to something I built awhile back (https://cmdchallenge.com), would love to know more details on how you built the backend, how you are sandboxing commands, if you are doing any caching, etc.


I prefer your version :)


A few years back while working as a Linux admin I sent this to a newish co-worker who was struggling. They were an older Windows/DOS person and had little familiarity with UNIX. I thought this would be an easy way to practice completing tasks via shell and to demonstrate the possibility therein. I checked in a few weeks later and my co-worker never went past looking at the first page and saying 'This looks neat' - unsurprisingly they were let go about two months after I left.


Maybe it's just me, but I was already turned off by the use of "cut" in the first question in a way that assumes all the names in the file have exactly one space and exactly two names.


It's a game.

I'd be more bummed if a game gave me five lines of sample data which fit the constraint of "exactly one space and exactly two names", and then the rest of the data violated that constraint.

Or if some of the last names didn't start with a capital letter, like d'Azzo, for that matter.


I think there's two parts to this: first, if you know your input meets certain constraints, then there's no benefit to over-complicating the solution. Second, this is a teaching tool. It makes sense to start simply and save the harder version for later.


Is it really so awful to do "grep -o '\b\w+%'"? It still won't handle extra space padding at the end of the line, but it's still a lot less ugly than assuming the word after the first space is a last name.


In the context of trying to teach people basics, yes, I would argue that is quite awful.


Weird, not sure why it did % instead of $ there.


Same thought here. Processing text with cut and pipes is cute and works when data are regular except in real life there is often lines here and there breaking assumptions. Using a programming language offer way more possibilities to deal with pathological cases.


You don't even need a full programming language... just something that does pattern matching that lets you grab "last word from a line".


One past thread:

The Unix Game - https://news.ycombinator.com/item?id=21249792 - Oct 2019 (65 comments)


I'd like a tutorial mode, where:

1) Only the commands you need are available.

2) They are explained.

I find myself using the commands I know well. This would be a nice tool for learning command I don't know well.


If you hover over the command it will give a brief summary. The selection of commands and patterns does change slightly for each "level".


Bugs:

First, RNA does not have T (thymine) bases, it uses U (uracil).

Second, the bases between 3' and 5' have to come in threes; the game only admits [ACGT]*, not [ACGT]{3}* (never mind [ACGU]{3}*).

Third, it treats any form of the latter, constructed purely via its block stacking, as a syntax error, which should be impossible to construct that way.


I did the first four exercises and like the concept a lot. It reminds me of Scratch and I think it would be a great way to learn how Unix tools can be combined to form powerful pipelines. The only thing I dislike is that it encourages the infamous “useless use of cat” anti-pattern.


Bug in turing_awards Q1: input.txt doesn't include the first 4 lines of the file (which are shown in the flavor text). So you have to trick it into giving the right number instead of doing the obvious grep | wc -l :p

This also makes Q2 unanswerable unless you can figure out how to construct Alfred V. Aho from scratch...


Good catch! That was indeed a bug. Should be fixed now. Thanks for reporting.


Seems cool - though feel way to hide welcome pane would be nice as seems unnecessary once started and no obvious way to hide


Can't scroll on the "Your solution" box. Browser: Firefox


looks cool!

BUT: 2nd question in "hello_world/" expects two last names in a very specific order. If I sort them - it considers answer to be invalid. But should it?


That is freaking awesome.




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

Search: