Tim Barrass bio photo

Tim Barrass

Freelance C# and distributed systems developer.

Email Twitter LinkedIn Github Stackoverflow

Of course, I should have just used some variation on Curses. But where would be the fun in that?

En-route to something else I worked up a simple (ha) split-screen console app, with a large upper pane for output and a smaller input pane, separated by a status line. In the end, it turned out ok:

A simple split screen console app

but it was a fun process to go through; it exercises quite a few muscles on the way. I put the code, such as it is, into a repo named Old School Dot Net on GitHub.

So, as part of this whirlwind tour I was briefly ambushed by:

  1. Going out to Process.GetCurrentProcess().Id is a great big performance load I’d forgotten about.
  2. Console.ReadLine blocks, because of course it does.
  3. Writing a non-blocking Console.ReadLine is basically fine, until you go and do fancy things like using the delete key.
  4. C# doesn’t give you a custom ctrl-c handler out of the box, so it’s off to [DllImport(“Kernel32”)] for the first time in a while.
  5. There’s no moving-window collection in C#, not that it’s too hard to implement.
  6. Threading makes it more fun, as always, sending the cursor all over the place without locking.

And next? Maybe an exercise in Eliza-like AI; or an adventure game; maybe something that generates ASCII art for you; maybe a chat app; maybe a set of bots that can do each of these things …