Back to the main page

Mailing List Logs for ShadowRN

Message no. 1
From: shadowrn@*********.com (Gurth)
Subject: Cyberdeck cost calculator
Date: Mon Jul 29 13:15:08 2002
Here's a Matrix cyberdeck cost calculator I just wrote. It's fairly basic
at the moment, but I think it includes everything a decks needs except
accessories. It only does the off-the-shelf costs, though. Comments and
encouragement are welcome :)

To use it, first be sure you have Python installed (go to
http://www.python.org if you haven't). Then copy everything between the
line of dashes below and my signature into a text file -- the first line of
the file should be "#! /usr/bin/env python". On a Unix system, you need to
make the file executable (chmod +x <filename>) and can then run it like any
other script. Alternatively, run Python and type "import <filename>" at
its
>>>-prompt.

-------------------------------------
#! /usr/bin/env python

# This is version 0.1 of a simple cyberdeck costs calculator for
# Shadowrun, using the rules from pp. 66-67 of Matrix. Written by
# Gurth <gurth@******.nl>, 28-29 July 2002.

# Though it works properly (as far as I can tell ;) it's not very
# extensive (yet). It also has NO error trapping -- enter a letter
# when it asks for a number, and it'll crash, for example. You have
# been warned...

# To-do Stuff:
# 1) Add miscellaneous equipment from page 63 of Matrix.
# 2) Add command-line options.
# 3) Add error-trapping?
# 4) Improve UI?


import math, string


# Init variables
MPCP = [1,0,0] #[rating,hardware cost,software cost]
Bod = [0,0,0]
Evasion = [0,0,0]
Masking = [0,0,0,0] #[4] is SASS (0 = no, 1 = yes)
Sensor = [0,0,0]
ASIST = ["Cold"]
ASISTcost = [0,0,0]
Hardening = [0,0,0]
ICCM = [0,0,0]
RealityFilter = [0,0,0]
Response = [0,0,0]

Active = [0,0] #[rating,hardware cost]
IO = [0,0]
Maser = [0,0]
FUPs = [0,0]
RAS = [0,0]
SignalAmp = [0,0]
Storage = [0,0]
Cellular = [0,0]
Laser = [0,0]
Microwave = [0,0]
Radio = [0,0]
Satellite = [0,0]

Total = [0,0,0] # [unused,total hardware cost,total software cost]


def HardwareCost(multiplier):
"Return the cost of the component's hardware"
return MPCP[0] ** 2 * multiplier


def SoftwareCost(rating):
"Return the cost of the component's software"
return rating * [0, 10, 100, 540, 1040, 1750, 3250, 4900, 7040, 9720,
14000][MPCP[0]]
# These numbers are the Software Multipliers from p. 66, Matrix.
# (They already include the square of the MPCP rating.)


def Costs():
"Calculate the costs for all components"

# Components that need software
MPCP[1] = HardwareCost(8)
MPCP[2] = SoftwareCost(MPCP[0])
if Bod[0]:
Bod[1] = HardwareCost(1)
Bod[2] = SoftwareCost(Bod[0])
else:
Bod[1] = 0
Bod[2] = 0
if Evasion[0]:
Evasion[1] = HardwareCost(2)
Evasion[2] = SoftwareCost(Evasion[0])
else:
Evasion[1] = 0
Evasion[2] = 0
if Masking[0]:
if Masking[3]:
Masking[1] = HardwareCost(3)
else:
Masking[1] = HardwareCost(2)
Masking[2] = SoftwareCost(Masking[0])
else:
Masking[1] = 0
Masking[2] = 0
if Sensor[0]:
Sensor[1] = HardwareCost(1)
Sensor[2] = SoftwareCost(Sensor[0])
else:
Sensor[1] = 0
Sensor[2] = 0
if ASIST[0] == "Cold":
ASISTcost[1] = HardwareCost(1)
ASISTcost[2] = SoftwareCost(int(math.floor(MPCP[0] / 2)))
elif ASIST[0] == "Hot":
ASISTcost[1] = HardwareCost(2)
ASISTcost[2] = SoftwareCost(MPCP[0])
else:
ASISTcost[1] = 0
ASISTcost[2] = 0
if Hardening[0]:
Hardening[1] = HardwareCost(8)
Hardening[2] = SoftwareCost(Hardening[0])
else:
Hardening[1] = 0
Hardening[2] = 0
if ICCM[0]:
ICCM[1] = HardwareCost(4) + 1000
ICCM[2] = SoftwareCost(MPCP[0])
else:
ICCM[1] = 0
ICCM[2] = 0
if RealityFilter[0]:
RealityFilter[1] = HardwareCost(8)
RealityFilter[2] = SoftwareCost(MPCP[0])
else:
RealityFilter[1] = 0
RealityFilter[2] = 0
if Response[0]:
Response[1] = HardwareCost(Response[0] * 2)
Response[2] = SoftwareCost(MPCP[0])
else:
Response[1] = 0
Response[2] = 0

for n in [1,2]: # Totals for hardware and software
Total[n] = MPCP[n] + Bod[n] + Evasion[n] + Masking[n] + Sensor[n] +
ASISTcost[n] + Hardening[n] + ICCM[n] + RealityFilter[n] + Response[n]

# Components that do not need software
if Active[0]:
Active[1] = Active[0] * 7.5
else:
Active[1] = 0
if IO[0]:
IO[1] = IO[0] * 35
else:
IO[1] = 0
if Maser[0]:
Maser[1] = 3000
else:
Maser[1] = 0
if FUPs[0]:
FUPs[1] = FUPs[0] * 235
else:
FUPs[1] = 0
RAS[1] = 35 * MPCP[0] + 1000
if SignalAmp[0]:
SignalAmp[1] = SignalAmp[0] * 250 + 35
else:
SignalAmp[1] = 0
if Storage[0]:
Storage[1] = Storage[0] * 6
else:
Storage[1] = 0
if Cellular[0]:
Cellular[1] = Cellular[0]**2 * 35 + Cellular[0] * 500
else:
Cellular[1] = 0
if Laser[0]:
Laser[1] = 3060
else:
Laser[1] = 0
if Microwave[0]:
Microwave[1] = 5560
else:
Microwave[1] = 0
if Radio[0]:
Radio[1] = Radio[0]**2 * 35 + Radio[0] * 250
else:
Radio[1] = 0
if Satellite[0]:
Satellite[1] = 560 + Satellite[0] * 1000
else:
Satellite[1] = 0

# Add to total
Total[1] = Total[1] + int(math.ceil(Active[1])) + IO[1] + Maser[1] + 35 +
FUPs[1] + RAS[1] + SignalAmp[1] + Storage[1] + Cellular[1] + Laser[1] +
Microwave[1] + Radio[1] + Satellite[1]


def getRating(prompt):
"Return a numerical rating, or 0 if no input is given"
r = raw_input(prompt + ": ")
if r:
return int(r)
else:
return 0


def getYesNo(prompt):
"Return 1 for yes (default) or 0 for no"
yn = string.upper(raw_input(prompt + " (Y/n): "))
if yn:
if yn[0] == "Y":
return 1
else:
return 0
else:
return 1


def getASIST():
"Return an ASIST rating (default is cold)"
a = string.upper(raw_input("ASIST interface (h = hot, t =
tortoise, other
= cold): "))
print a[0]
if a:
if a[0] == "C":
return "Cold"
elif a[0] == "H":
return "Hot"
elif a[0] == "T":
return "Tortoise"
else:
return "Cold"
else:
return "huh?" # Default to tortoise if no valid rating is given


def Output(CurrentPage):
"Print results to screen"
print

if CurrentPage == 1:
print "* Page 1 ------------------------------- Components That Need
Software"
print " Component Rating Hardware Software"
print "m) MPCP: " + string.center(str(MPCP[0]), 6) +
string.rjust(str(MPCP[1]) + "¥", 11) + string.rjust(str(MPCP[2]) +
"¥", 11)
print "b) Bod: " + string.center(str(Bod[0]), 6) +
string.rjust(str(Bod[1]) + "¥", 11) + string.rjust(str(Bod[2]) +
"¥", 11)
print "e) Evasion: " + string.center(str(Evasion[0]), 6) +

string.rjust(str(Evasion[1]) + "¥", 11) + string.rjust(str(Evasion[2]) +
"¥", 11)
print "M) Masking: " + string.center(str(Masking[0]), 6) +

string.rjust(str(Masking[1]) + "¥", 11) + string.rjust(str(Masking[2]) +
"¥", 11)
print "S) SASS: ",
if Masking[3]:
print string.center("Yes", 6)
else:
print string.center("No", 6)
print "s) Sensor: " + string.center(str(Sensor[0]), 6) +
string.rjust(str(Sensor[1]) + "¥", 11) + string.rjust(str(Sensor[2]) +
"¥",
11)
print "a) ASIST: " + string.center(ASIST[0], 10) +
string.rjust(str(ASISTcost[1]) + "¥", 9) + string.rjust(str(ASISTcost[2]) +

"¥", 11)
print "h) Hardening: " + string.center(str(Hardening[0]), 6)
+
string.rjust(str(Hardening[1]) + "¥", 11) + string.rjust(str(Hardening[2])
+ "¥", 11)
print "i) ICCM: ",
if ICCM[0]:
print string.center("Yes", 6),
else:
print string.center("No", 6),
print string.rjust(str(ICCM[1]) + "¥", 10) +
string.rjust(str(ICCM[2]) +
"¥", 11)
print "f) Reality filter: ",
if RealityFilter[0]:
print string.center("Yes", 6),
else:
print string.center("No", 6),
print string.rjust(str(RealityFilter[1]) + "¥", 10) +
string.rjust(str(RealityFilter[2]) + "¥", 11)
print "r) Response increase: " + string.center(str(Response[0]), 6)
+
string.rjust(str(Response[1]) + "¥", 11) + string.rjust(str(Response[2]) +
"¥", 11)

elif CurrentPage == 2:
print "* Page 2 ------------------------ Components That Do Not Need
Software"
print " Component Rating Hardware"
print "a) Active memory: " + string.center(str(Active[0]) + "
Mp", 10)
+ string.rjust(str(Active[1]) + "¥", 9)
print "i) I/O speed: " + string.center(str(IO[0]) + "
Mp/t", 10) +
string.rjust(str(IO[1]) + "¥", 9)
print "m) Maser interface: ",
if Maser[0]:
print string.center("Yes", 6),
else:
print string.center("No", 6),
print string.rjust(str(Maser[1]) + "¥", 10)
print " Matrix interface: " + string.center("-", 6) +
string.rjust("35¥", 11)
print "f) FUPs: " + string.center(str(FUPs[0]) +
"(+" +
str(MPCP[0]) + ")", 8) + string.rjust(str(FUPs[1]) + "¥", 10)
print " RAS override: " + string.center("-", 6) +
string.rjust(str(RAS[1]) + "¥", 11)
print "S) Signal amplifier: " + string.center(str(SignalAmp[0]), 6)
+
string.rjust(str(SignalAmp[1]) + "¥", 11)
print "s) Storage memory: " + string.center(str(Storage[0]) +
" Mp", 10)
+ string.rjust(str(Storage[1]) + "¥", 9)
print " Wireless Interfaces"
print "c) Cellular: " + string.center(str(Cellular[0]), 6)
+
string.rjust(str(Cellular[1]) + "¥", 11)
print "l) Laser: ",
if Laser[0]:
print string.center("Yes", 6),
else:
print string.center("No", 6),
print string.rjust(str(Laser[1]) + "¥", 10)
print "M) Microwave: ",
if Microwave[0]:
print string.center("Yes", 6),
else:
print string.center("No", 6),
print string.rjust(str(Microwave[1]) + "¥", 10)
print "r) Radio: " + string.center(str(Radio[0]), 6) +
string.rjust(str(Radio[1]) + "¥", 11)
print "t) Satellite: " + string.center(str(Satellite[0]), 6)
+
string.rjust(str(Satellite[1]) + "¥", 11)

print
print "Hardware: " + str(Total[1]) + "¥, Software: " +
str(Total[2]) + "¥;
Total deck cost: " + str(Total[1] + Total[2]) + "¥"
print
print "1-2) Page number q or x) quit"
print string.center("Press the letter before the item, followed by
Enter.", 70)


def Main(CurrentPage=1):
# Wait for input & act on it
Exit = 0
while Exit == 0:
Costs() # Calculate all costs
Output(CurrentPage) # Update screen

i = raw_input("")
if CurrentPage == 1:
if i == "m":
MPCP[0] = getRating("MPCP rating")
elif i == "b":
Bod[0] = getRating("Bod rating")
elif i == "e":
Evasion[0] = getRating("Evasion rating")
elif i == "M":
Masking[0] = getRating("Masking rating")
elif i == "S":
Masking[3] = getYesNo("Masking with system-aware
signature suppression
(SASS)")
elif i == "s":
Sensor[0] = getRating("Sensor rating")
elif i == "a":
ASIST[0] = getASIST()
elif i == "h":
Hardening[0] = getRating("Hardening rating")
elif i == "i":
ICCM[0] = getYesNo("ICCM biofeedback filter")
elif i == "f":
RealityFilter[0] = getYesNo("Reality filter")
elif i == "r":
Response[0] = getRating("Response increase rating")
elif CurrentPage == 2:
if i == "a":
Active[0] = getRating("Active memory (Mp)")
elif i == "i":
IO[0] = getRating("I/O speed (Mp per turn)")
elif i == "m":
Maser[0] = getYesNo("Maser interface")
elif i == "f":
FUPs[0] = getRating("Number of FUPs (" +
str(MPCP[0]) + " for free)")
elif i == "S":
SignalAmp[0] = getRating("Signal amplifier rating")
elif i == "s":
Storage[0] = getRating("Storage memory (Mp)")
elif i == "c":
Cellular[0] = getRating("Cellular interface
rating")
elif i == "l":
Laser[0] = getYesNo("Laser interface")
elif i == "M":
Microwave[0] = getYesNo("Microwave interface")
elif i == "r":
Radio[0] = getRating("Radio interface rating")
elif i == "t":
Satellite[0] = getRating("Satellite interface
rating")

if i == "1" or i == "2":
CurrentPage = int(i)
elif i == "q" or i == "x":
Exit = 1


# Main program starts here

Main()

--
Gurth@******.nl - http://www.xs4all.nl/~gurth/index.html
Huh?
-> Probably NAGEE Editor * ShadowRN GridSec * Triangle Virtuoso <-
-> The Plastic Warriors Page: http://plastic.dumpshock.com <-

GC3.12: GAT/! d- s:- !a>? C++(---) UL+ P(+) L++ E W--(++) N o? K w(--)
O V? PS+ PE@ Y PGP- t- 5++ X(+) R+++$ tv+(++) b++@ DI- D+ G+ e h! !r y?
Incubated into the First Church of the Sqooshy Ball, 21-05-1998
Message no. 2
From: shadowrn@*********.com (Tobias Diekershoff)
Subject: Cyberdeck cost calculator
Date: Tue Jul 30 03:20:01 2002
On Mon, 29 Jul 2002 19:22:47 +0200
Gurth <Gurth@******.nl> wrote:

> Here's a Matrix cyberdeck cost calculator I just wrote. It's fairly
> basic at the moment, but I think it includes everything a decks needs
> except accessories. It only does the off-the-shelf costs, though.
> Comments and encouragement are welcome :)

Put it on your HP for download ;)

It could be my mailclient, but lots of lines where cut at the wrong
place ;) But after fixing all those syntax errors reported by Python
it's running. But as I don't have any deckers in my games, I can't say
you anything about the calculated output ;D

What could be useful is the option to save the final stats directly to a
file, when exiting the script ;)

- Burning Avatar

--
http://home.t-online.de/home/tobias.d

PGP User ID: 0x825CE007
Message no. 3
From: shadowrn@*********.com (Gurth)
Subject: Cyberdeck cost calculator
Date: Tue Jul 30 13:25:04 2002
According to Tobias Diekershoff, on Tue, 30 Jul 2002 the word on the street
was...

(Second attempt...)

> Put it on your HP for download ;)

When it's finished :)

> It could be my mailclient, but lots of lines where cut at the wrong
> place ;)

That's probably either your or my mailer, or the listserver, I suppose...

> But after fixing all those syntax errors reported by Python
> it's running. But as I don't have any deckers in my games, I can't say
> you anything about the calculated output ;D

That _should_ be OK, as all it really does, is put numbers into the
formulas from Matrix.

> What could be useful is the option to save the final stats directly to a
> file, when exiting the script ;)

I have been thinking of adding that, but I haven't got round to it yet.

--
Gurth@******.nl - http://www.xs4all.nl/~gurth/index.html
Huh?
-> Probably NAGEE Editor * ShadowRN GridSec * Triangle Virtuoso <-
-> The Plastic Warriors Page: http://plastic.dumpshock.com <-

GC3.12: GAT/! d- s:- !a>? C++(---) UL+ P(+) L++ E W--(++) N o? K w(--)
O V? PS+ PE@ Y PGP- t- 5++ X(+) R+++$ tv+(++) b++@ DI- D+ G+ e h! !r y?
Incubated into the First Church of the Sqooshy Ball, 21-05-1998
Message no. 4
From: shadowrn@*********.com (Mark M. Smith)
Subject: Cyberdeck cost calculator
Date: Fri Aug 2 19:05:01 2002
At 7/30/2002 12:26 PM, you wrote:
> > What could be useful is the option to save the final stats directly to a
> > file, when exiting the script ;)
>
>I have been thinking of adding that, but I haven't got round to it yet.

I haven't run it yet myself, but I would assume off-hand that:

foo > foo.txt

should be all you'll need.Utilizing a shell function should keep it from
being necessary to add something extra to the code (even if it is this
simple) and keeping the flexibility on the user end.


--
Mark M. Smith
belgand@**************.com

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GS/CS/AT d- s-: a-- C++++ UL++>++++ US P+>++ L++>+++ E@ W++(+++) N+++@ o+
K++ w---() O- M-- !V PS+@ PE++(+++)@ Y+@ PGP- t+ 5 X++@ R++ tv++ b+++
DI++++ D+++ G++ e>++++$ h(!) r++ y+**
------END GEEK CODE BLOCK------
Message no. 5
From: shadowrn@*********.com (Gurth)
Subject: Cyberdeck cost calculator
Date: Sat Aug 3 07:00:01 2002
According to Mark M. Smith, on Sat, 03 Aug 2002 the word on the street was...

> I haven't run it yet myself, but I would assume off-hand that:
>
> foo > foo.txt
>
> should be all you'll need.Utilizing a shell function should keep it from
> being necessary to add something extra to the code (even if it is this
> simple) and keeping the flexibility on the user end.

It's interactive, so that doesn't work -- all you'd do is put the program's
initial output (menu etc.) into foo.txt :)

--
Gurth@******.nl - http://www.xs4all.nl/~gurth/index.html
Huh?
-> Probably NAGEE Editor * ShadowRN GridSec * Triangle Virtuoso <-
-> The Plastic Warriors Page: http://plastic.dumpshock.com <-

GC3.12: GAT/! d- s:- !a>? C++(---) UL+ P(+) L++ E W--(++) N o? K w(--)
O V? PS+ PE@ Y PGP- t- 5++ X(+) R+++$ tv+(++) b++@ DI- D+ G+ e h! !r y?
Incubated into the First Church of the Sqooshy Ball, 21-05-1998

Further Reading

If you enjoyed reading about Cyberdeck cost calculator, you may also be interested in:

Disclaimer

These messages were posted a long time ago on a mailing list far, far away. The copyright to their contents probably lies with the original authors of the individual messages, but since they were published in an electronic forum that anyone could subscribe to, and the logs were available to subscribers and most likely non-subscribers as well, it's felt that re-publishing them here is a kind of public service.