Hobbits give others presents on their birthday. I'm a bit tall for a hobbit but well rounded enough to do for. Today is my birthday and I wanted to give us both a present.
Star Merchant actually runs! While it has lots of tests it is still fragile, there's very little error checking and user input is only nominally validated. So far. I wanted to prove to myself that I could take a slightly larger than my usual program and make it work.
Here's a sample short run. Those of you doing other C based languages like TCL, Python, Java, etc, should have no problem replicating my Ruby. I'm using JSON and CSV files and straight unit tests.
Star Merchant actually runs! While it has lots of tests it is still fragile, there's very little error checking and user input is only nominally validated. So far. I wanted to prove to myself that I could take a slightly larger than my usual program and make it work.
Here's a sample short run. Those of you doing other C based languages like TCL, Python, Java, etc, should have no problem replicating my Ruby. I'm using JSON and CSV files and straight unit tests.
Code:
Welcome Captain Ian Domici, the Spinward Quest is ready.
We are currently at Haearn.
Port: Haearn, Cash: 215987601, Open Cargo Space: 153
textiles : 3
spice : 5
weapons : 9
medicinals : 30
rare metals : 0
(b)uy, (s)ell, (j)ump, or <q>uit?
b
There is 46 of rare metals; buy?
y
Port: Haearn, Cash: 215527601, Open Cargo Space: 107
textiles : 3
spice : 5
weapons : 9
medicinals : 30
rare metals : 46
(b)uy, (s)ell, (j)ump, or <q>uit?
j
Here are the possible jump destinations:
Birach: UWP 777888, Location: -1,1, Trade: Ag
Saorsa: UWP 888777, Location: 2,-1, Trade: Ag
Haearn: UWP 999999, Location: 0,0, Trade: Ag
Which one do we chart for?
Birach
Jumping to Birach.
Port: Birach, Cash: 215527601, Open Cargo Space: 107
textiles : 3
spice : 5
weapons : 9
medicinals : 30
rare metals : 46
(b)uy, (s)ell, (j)ump, or <q>uit?
s
Here are the offers, one by one:
Cargo: textiles Offer: 13500.0.
Sell? [y/n]
y
Cargo: spice Offer: 22500.0.
Sell? [y/n]
n
Cargo: weapons Offer: 40500.0.
Sell? [y/n]
n
Cargo: medicinals Offer: 135000.0.
Sell? [y/n]
n
Cargo: rare metals Offer: 207000.0.
Sell? [y/n]
n
Port: Birach, Cash: 215530601, Open Cargo Space: 110
textiles : 0
spice : 5
weapons : 9
medicinals : 30
rare metals : 46
(b)uy, (s)ell, (j)ump, or <q>uit?
b
There is 70 of spice; buy?
y
Port: Birach, Cash: 215355601, Open Cargo Space: 40
textiles : 0
spice : 75
weapons : 9
medicinals : 30
rare metals : 46
(b)uy, (s)ell, (j)ump, or <q>uit?
q