Unix-terminal refactored

This is an update to an old post mentioned below:

Unix-terminal splash page in JS

I added some default functionality to the Unix terminal on the index page of this website. Now when you type a command that it doesn’t understand an ‘Elizabot’ (GitHub) will respond questioningly. ‘Eliza’ was the name of one of the first natural language processing scripts and you can read more about it here.

There were two things that made this implementation difficult. First, I had to learn a lot about JavaScript’s asynchronicity. Since it takes some time to parse the text, I can’t shut down everything else that is going on in the background while the user waits around. JS uses ‘callbacks’ extensively which are basically blocks of code that call a function when they finish. Second, splitting up JS code into multiple files isn’t as trivial as it is in other languages. In fact, you need to import a library and use callbacks just to do it.

Ideas for improvement

  • Track returning users using cookies or login/logout
  • Add simple game functions. I will probably add simple card and gambling games (blackjack, poker, roulette). High scores would be a cool addition too and would let me practice database management. Would be even cooler if it synced up with cryptocurrency for ‘real’ gambling.
  • Text adventure like the emacs game
  • Connect with other people. Imagine if other people had this sort of robot on their website and they could talk to each other. It would also be neat to randomly connect to real people… but we all know what kind of problems anonymity can bring.

Leave a Reply

Your email address will not be published. Required fields are marked *