I’ve been playing Trade Wars 2002 a LOT… at least since the beginning of December. I’ve been learning about strategy from various publicly-available forums.
The temptation to be better in the game, combined with the lack of another programming project, has driven me to write several versions of a trade wars 2002 client. The first version was very Windows-y: one big program with lots of GUI windows (handled with Perl, threads, and Tk).
The second version, on the other hand, is more UN*X-y, and is actually working. One program runs the equivalent of nc -e 'telnet $SITE $PORT'. It starts a server that multiple clients can connect to, however. One client is my telnet client where I play like normal. Another is a special program that recommends initial bids for trading and helps with subsequent bids. You can write other scripts as needed.
TCP/IP Illustrated helped me understand what was going on: telnet does some nutty things with buffering depending on when you connect to the main server. It’s kind of neat, actually, you can type “pt” for “port” then “trade”, but nothing happens until you hit a linefeed character. Telnet (at least for the mac) lets you “set forw1 ' '” to force space to flush the buffer. That way you don’t have to hit “pt^M” and buy whatever the port is selling.
Things aren’t totally set, yet, but with this buffering I got a routine for colonizing planets (starting at Earth):
l1 # Land on Terra
t # Take the default number of colonists
[SECTOR] # Go to your sector
yyl[PLANET-NUMBER] # Transwarp, yes, then land on your planet
snl1 # change colonist levels, don't display, leave colonists, put them in ore
tnt1[ORE-AMOUNT] # take some ore for the next run
cb1 # use your citadel beamer to go back to sector #1 (good only)