Skip to content

Instantly share code, notes, and snippets.

@comex
Created May 13, 2009 21:38
Show Gist options
  • Save comex/111324 to your computer and use it in GitHub Desktop.
Save comex/111324 to your computer and use it in GitHub Desktop.
import re, sys, os, shutil, email.Utils, datetime, json, hashlib
DELIM = '\n\n===============================================================================\n\n'
iba = open('iba.txt').read().strip()
sections = iba.split(DELIM)
ox = int('Offers' in sections[2])
holdings = {}
ibap = []
for hol in sections[1].split('\n'):
if ' ' in hol and 'Nickname' not in hol:
person, zm = re.split(' +', hol)
if person[0] == '*':
person = person[1:]
ibap.append(person)
holdings[person] = int(zm)
rates = []
rdict = {}
for rate in sections[2+ox].split('\n'):
if re.search('[0-9]', rate):
r = re.split(' +', rate)
r = map(str.strip, (rate[:16], rate[16:30], rate[30:]))
r = [r[0], int(r[1]), int(r[2]) if r[2] != '' else 0]
rates.append(r)
if r[0] == 'Drop your Wea..': r[0] = 'Drop your Weapon'
rdict[r[0]] = r[1]
else:
rates.append(rate)
monday = datetime.datetime.utcnow()
monday = (monday - datetime.timedelta(days=monday.weekday())).replace(hour=0, minute=0, second=0, microsecond=0)
datefmt = '%d %B %Y %H:%M:%S'
hist = ''
when = None
for line in sections[3+ox].split('\n'):
a, b = line[:27].strip(), line[27:].strip()
if a != '' and a != 'History:':
when = datetime.datetime.strptime(a, datefmt)
if b != '' and when >= monday:
hist += b + '\n'
hist = hist.replace(',\n', ', ')
hist = hist.replace(' +', '\n+')
hist = hist.replace(' -', '\n-')
prev = {}
for line in hist.split('\n'):
line = line.strip()
if line == '' or '[' in line or ']' in line: continue
if line[0] == '+':
m = re.search('\((.*)\)', line)
if not m: continue
for n in m.group(1).split(','):
n = n.strip().split('*')
if len(n) > 1:
p = int(n[0])
else:
p = 1
prev[actor] = prev.get(actor, 0) + p
else:
actor = line
contract = sections[4+ox]
contract = re.sub(re.compile('^([XIV]+\. .*)$', re.M), '<b>\\1</b>', contract)
json.dump((rates, prev, sorted(holdings.keys(), key=str.lower), sorted(rdict.keys(), key=lambda a: -rdict[a]), contract, holdings), sys.stdout)
print
import re, sys, os, shutil, email.Utils, datetime
#!/usr/bin/env python
# Note: time.py is a really bad name
vr = sys.stdin.read()
lines = vr.split('\n')
dt = [lines[i+1] for i in xrange(len(lines)) if lines[i].find('by yzma.clarkk.net') != -1][0]
now = datetime.datetime.utcfromtimestamp(email.Utils.mktime_tz(email.Utils.parsedate_tz(dt[dt.index(';')+2:])))
def wrap(text, width):
#http://code.activestate.com/recipes/148061/
return reduce(lambda line, word, width=width: '%s%s%s' %
(line,
' \n'[(len(line)-line.rfind('\n')-1
+ len(word.split('\n',1)[0]
) >= width)],
word),
text.split(' ')
)
abbrevs = {
'0 Crop': '0c',
'1 Crop': '1c',
'2 Crop': '2c',
'3 Crop': '3c',
'4 Crop': '4c',
'5 Crop': '5c',
'6 Crop': '6c',
'7 Crop': '7c',
'8 Crop': '8c',
'9 Crop': '9c',
'X Crop': 'Xc',
'Roll Call': 'RC',
'Debate-o-Matic': 'DoM',
'Arm-twist': 'At',
'On the Nod': 'OtN',
'Kill Bill': 'KB',
'Lobbyist': 'Lob',
'Local Election': 'LE',
'No Confidence': 'NC',
'Goverment Ball': 'G.Ball',
'Distrib-u-Matic': 'DuM',
'Committee': 'Com',
'Your Turn': 'YT',
'Presto!': 'P!',
'Not Your Turn': 'NYT',
'Supersize Me': 'SM',
'Shrink Potion': 'SP',
'Change Ball': 'C.Ball',
'Absolv-o-Matic': 'AoM',
'Stool Pigeon': 'SP',
'Drop your Wea..': 'DyW',
'Discard Picking': 'DP',
'Justice Ball': 'J.Ball',
'Penalty Box': 'PB',
'X Point': 'XP',
'Y Point': 'YP',
'Medal': 'Medal',
}
abbrevs2 = dict(((v, k) for k, v in abbrevs.items()))
DELIM = '\n\n===============================================================================\n\n'
iba = open('iba.txt').read().strip()
sections = iba.split(DELIM)
ox = int('Offers' in sections[2])
holdings = {}
ibap = []
for hol in sections[1].split('\n'):
if ' ' in hol and 'Nickname' not in hol:
person, zm = re.split(' +', hol)
if person[0] == '*':
person = person[1:]
ibap.append(person)
holdings[person] = int(zm)
rates = []
for rate in sections[2+ox].split('\n'):
if re.search('[0-9]', rate):
r = re.split(' +', rate)
r = map(str.strip, (rate[:16], rate[16:30], rate[30:]))
r = [r[0], int(r[1]), int(r[2]) if r[2] != '' else 0]
rates.append(r)
else:
rates.append(rate)
def lookupRate(x, damt=None):
if x == 'Drop your Weapon': x = 'Drop your Wea..'
for a in rates:
if type(a) == list and a[0] == x:
if damt is not None:
a[2] = a[2] + damt
assert a[2] >= 0
return a[1]
raise KeyError(x)
history = sections[3+ox]
monday = datetime.datetime.utcnow()
monday = (monday - datetime.timedelta(days=monday.weekday())).replace(hour=0, minute=0, second=0, microsecond=0)
datefmt = '%d %B %Y %H:%M:%S'
hist = ''
when = None
for line in history.split('\n'):
a, b = line[:27].strip(), line[27:].strip()
if a != '' and a != 'History:':
when = datetime.datetime.strptime(a, datefmt)
if b != '' and when >= monday:
hist += b + '\n'
hist = hist.replace(',\n', ', ')
hist = hist.replace(' +', '\n+')
hist = hist.replace(' -', '\n-')
prev = {}
for line in hist.split('\n'):
line = line.strip()
if line == '' or '[' in line or ']' in line: continue
if line[0] == '+':
m = re.search('\((.*)\)', line)
if not m: continue
for n in m.group(1).split(','):
n = n.strip().split('*')
if len(n) > 1:
p = int(n[0])
else:
p = 1
prev[actor] = prev.get(actor, 0) + p
else:
actor = line
prev2rate = [1.00, 1.00, 1.00, 1.00, 0.90, 0.90, 0.90, 0.80, 0.80, 0.80, 0.73, 0.62, 0.50, 0.38, 0.26, 0.18, 0.12, 0.08, 0.05, 0.03, 0.01]
person = raw_input('Person> ')
sores = []
totals = []
def transact(typ, asts): # typ is 'deposit'/'withdraw'
total = 0
sore = []
for ast in asts.split(','):
ii = 1
if '*' in ast:
ast = ast.split('*')
ii, ast = int(ast[0]), ast[1].strip()
sore.append('%d*%s' % (ii, abbrevs.get(ast, ast)))
else:
sore.append(abbrevs.get(ast, ast))
ast = abbrevs2.get(ast, ast)
for i in xrange(ii):
if typ == 'deposit':
p = prev.get(person, 0)
if p >= 21:
rmul = 0
else:
rmul = prev2rate[p]
prev[person] = p + 1
else:
rmul = -1
erate = round(rmul * lookupRate(ast, 1 if typ == 'deposit' else -1))
holdings[person] = holdings.get(person, 0) + int(erate)
total += int(erate)
if holdings[person] < 0: raise ValueError(holdings[person])
total = ('+' * (typ == 'deposit')) + str(total) + 'zm'
totals.append((total, sore))
while True:
line = raw_input()
if line == '': break
transact(*line.strip().split())
max_total_length = max(len(a[0]) for a in totals)
for total, sore in totals:
total = (' ' * (max_total_length - len(total))) + total
b = 28 + len(person) + 1 + len(total) + 2
c = ' ' * b
sores.append(total + ' (' + wrap(', '.join(sore), 70 - b).replace('\n', '\n' + c) + ')')
if len(sores) > 0:
hdr = now.strftime(datefmt).ljust(27) + person + ' '
hdr2 = '\n' + ' ' * len(hdr)
history += '\n' + hdr + hdr2.join(sores)
sections[1] = '''Current Holdings:
Nickname zm
---------------------------------
%s
* IBA party
All IBA parties are listed. All other persons have no zm.''' % '\n'.join( (('*' if person in ibap else '') + person).ljust(29) + str(zm) for person, zm in sorted(holdings.items(), key=lambda a: a[0].lower()))
sections[2+ox] = '\n'.join(i if isinstance(i, basestring) else (i[0].ljust(16) + str(i[1]).ljust(14) + (str(i[2]) * (i[2] != 0))).rstrip() for i in rates)
sections[3+ox] = history
shutil.copy('iba.txt', 'iba.txt.old')
open('iba.txt', 'w').write(DELIM.join(sections) + '\n')
import re, sys
muls = [1.00, 1.00, 1.00, 1.00, 0.90, 0.90, 0.90, 0.80, 0.80, 0.80, 0.73, 0.62, 0.50, 0.38, 0.26, 0.18, 0.12, 0.08, 0.05, 0.03, 0.01]
bits = open('iba.txt').read().split('\n===============================================================================\n')
rates = {}
for bit in bits:
bit = bit.strip()
if not re.match('^Current Rates:', bit): continue
m = re.findall(re.compile('^(.+?) {3,}([0-9]+)', re.M), bit)
print m
for ast, val in m:
rates[ast.strip()] = float(val.strip())
desc = '10 0 Crop, 9 3 Crop, 2 Arm-twist, 2 Committee, 1 On the Nod, 1 Roll Call'
#desc = '1 0 Crop, 7 1 Crop, 0 2 Crop, 2 3 Crop, 2 4 Crop, 2 5 Crop, 2 6 Crop, 1 7 Crop, 4 8 Crop, 13 9 Crop, 4 X Crop'
#desc = '2 X Crop, 3 7 Crop, 2 0 Crop'
asts = []
for ast in desc.split(', '):
num, ast = ast.split(' ', 1)
asts += [ast] * int(num)
prev = 0
gain = 0
log = ''
for ast in asts:#sorted(asts, reverse=True, key=lambda x: rates[x]):
log += 'prev=%d\tdeposit %s\t\t' % (prev, ast)
if prev <= 20:
x = round(rates[ast] * muls[prev])
log += 'gained %d * %.02f = %d zm\n' % (rates[ast], muls[prev], x)
gain += x
else:
log += 'no gain\n'
prev += 1
print 'total: %d zm' % gain
print log
===============================================================================
Industrial Bank & Agora Report
Date of this report: 29 August 2009
President of the IBA: comex
===============================================================================
Current Holdings:
Nickname zm
---------------------------------
*BobTHJ 764
*C-walker 135
*comex 814
*coppro 230
*Murphy 270
*Pavitra 1048
*Taral 480
*Tiger 377
*woggle 447
Wooble 182
* IBA party
All IBA parties are listed. All other persons have no zm.
===============================================================================
Unfilled Offers (can be filled by announcement):
* Pavitra [150zm]: Play Lobbyist, specifying Pavitra.
(ISELL votes not included.)
===============================================================================
Current Rates:
asset rate (zm) # in bank
-------------------------------------
-- AAA
0 Crop 11 13
1 Crop 11 2
2 Crop 45
3 Crop 21 9
4 Crop 23
5 Crop 27
6 Crop 50 7
7 Crop 19
8 Crop 12
9 Crop 11 8
X Crop 100 12
WRV 130 8
-- Cards (Government)
Roll Call 20 15
Debate-o-Matic 20 5
Arm-twist 45 14
On the Nod 45 3
Kill Bill 110 7
Lobbyist 110 1
Local Election 110
No Confidence 55 5
Goverment Ball 500
-- Cards (Change)
Distrib-u-Matic 25 3
Committee 30
Your Turn 30
Presto! 150
Not Your Turn 250
Supersize Me 30
Shrink Potion 50
Change Ball 500
-- Cards (Justice)
Absolv-o-Matic 45 4
Stool Pigeon 40
Drop your Wea.. 80 2
Discard Picking 130
Justice Ball 500
Penalty Box 175
* Drop your Wea.. = Drop your Weapon
-- misc
X Point 15
Y Point 15
Medal 1500
===============================================================================
History:
03 June 2009 02:44:03 Pavitra +623zm (0c, 7*1c, 2*3c, 2*4c, 2*5c,
2*6c, 7c, 3*8c, 13*9c, 4*Xc)
14 June 2009 19:37:25 woggle +200zm (4*6c)
-109zm (2*5c, 7c, 3*8c)
14 June 2009 20:13:55 Tiger +275zm (2*Xc, 3*7c, 2*0c)
-145zm (1c, 4c, 2*6c, 9c)
16 August 2009 15:51:29 BobTHJ +108zm (6c, 5c, 7c, 8c)
19 August 2009 04:07:40 BobTHJ +27zm (5c)
21 August 2009 03:47:29 comex +320zm (2*LE, NC, OtN)
21 August 2009 20:34:19 coppro +130zm (WRV)
21 August 2009 20:37:14 BobTHJ -130zm (WRV)
21 August 2009 22:43:29 BobTHJ +85zm (RC, DoM, At)
22 August 2009 15:01:09 C-walker +135zm (3*AoM)
23 August 2009 21:49:09 woggle +300zm (3*Xc)
-31zm (8c, 7c)
25 August 2009 20:18:10 Tiger +164zm (10*0c, 9*3c, 2*At, 2*Com,
OtN, RC)
25 August 2009 20:30:10 Tiger +0zm (4*7c)
-177zm (2*6c, 2*5c, 4c)
27 August 2009 07:21:10 Murphy +270zm (Lob, 2*DyW)
28 August 2009 22:00:11 BobTHJ +80zm (4*RC)
30 August 2009 15:36:11 coppro +130zm (2*AoM, 2*DoM)
31 August 2009 20:42:11 Tiger +260zm (2*WRV)
31 August 2009 23:39:02 Pavitra +80zm (DyW)
01 September 2009 03:19:03 coppro -30zm
comex +30zm [P6473]
01 September 2009 03:37:03 coppro +520zm (4*WRV)
01 September 2009 21:24:04 Taral +45zm (At)
03 September 2009 16:39:04 Wooble +481zm (4*KB, OtN)
03 September 2009 19:06:03 comex +540zm (2*Lob, LE, KB, NC)
-46zm (2*Com)
03 September 2009 19:51:04 woggle +90zm (2*AoM)
03 September 2009 23:14:03 Pavitra +151zm (2*AoM, DoM, At)
03 September 2009 23:50:04 Taral +175zm (PB)
+260zm (2*WRV)
[IBA -PB]
04 September 2009 01:10:04 coppro -550zm (2*Lob, 3*LE)
04 September 2009 01:12:04 woggle -76zm (4*7c)
04 September 2009 19:00:04 Wooble +141zm (9*RC, At)
04 September 2009 19:15:04 Wooble -80zm (DyW)
04 September 2009 19:55:04 Wooble -360zm (8*AoM)
04 September 2009 19:55:07 BobTHJ +594zm (2*KB, 2*NC, 7*At)
04 September 2009 20:35:04 woggle +73zm (3*DuM)
===============================================================================
Text of the contract:
I. IBA
This is the Industrial Bank & Agora. The currency of the IBA is
zorkmids (zm); the recordkeepor of zorkmids is the President.
Any person CAN join this contract by announcement. Any party to this
contract CAN leave it by announcement, unless e is involved in a
pending Offer, or this contract has less than three parties, in which
case any party CAN dissolve it without objection.
The President of the IBA is comex.
II. Summary
- You can join the contract by announcement. Please join before
attempting to make Offers or vote ISELL-- your only obligations are
to uphold the terms of Offers you make.
- You can deposit 4 assets per week for the standard rate; further
deposits give you diminishing returns to prevent scams, but you can
still get a good price for up to 10.
- You can always withdraw assets for the standard rate.
- You can intend to sell or buy assets, naming a price; this is known
as an Offer, and other parties can fill the Offer by announcement.
- ISELL works like SELL, but you can vote ISELL on dependent
actions as well as decisions.
III. Banking
Every asset has a Rate in zorkmids, intially zero. The President's report
includes a Rate List containing all nonzero Rates.
IV. Withdrawal
A person CAN withdraw an asset in the IBA's possession if e has at
least its Rate in zorkmids. Withdrawing an asset is equivalent to
acting on behalf of the IBA to transfer the asset to the withdrawer;
after a person withdraws an asset, its Rate in zorkmids is destroyed
in eir possession.
V. Deposits
A person CAN deposit an asset by transferring it to the IBA; e then
gains the Effective Rate in zorkmids.
The Effective Rate for a deposit is its Rate, multiplied by a value
depending on the number of previous deposits made in the same week
with the same Executor, and rounded to the nearest integer:
prev rate
0-3 1.00
4-6 0.90
7-9 0.80
10 0.73
11 0.62
12 0.50
13 0.38
14 0.26
15 0.18
16 0.12
17 0.08
18 0.05
19 0.03
20 0.01
21- 0.00
VI. Offers
An Offer is an entity with three fields:
Selling: (a nonempty list of assets, actions, and/or obligations)
For cost: (a nonempty list of assets, actions, and/or obligations)
Repeats: (a nonnegative integer, or infinity; default 1)
A person CAN create an Offer by announcement, thus becoming its
offerer. A person CAN destroy an Offer for which e is the offerer by
announcement.
A party (the filler) generally CAN fill an Offer by announcement (and
is authorized to act on behalf of the offerer for this purpose) if the
offerer is a party. Filling an Offer is equivalent to performing the
following procedure in order, with no other actions inserted between
the start and end of the procedure; and notwithstanding the previous
sentence, if the procedure would not be entirely successful, the Offer
cannot be filled at all:
- the filler acts on behalf of the offerer to transfer the assets in
the 'Selling' field to the filler, and to take the actions in the
'Selling' field, and
- the filler transfers the assets in the 'For cost' field to the
offerer, and takes the actions in the 'For cost' field, and
- the Offer's 'Repeats' field is decreased by one.
The filler SHALL satisfy the obligations (if any) in the 'For cost'
field; the offerer SHALL satisfy the obligations (if any) in the
Selling' field.
An Offer with zero Repeats CANNOT be filled. A non-pending Offer with
zero Repeats is automatically destroyed.
To intend to sell X for Y is to create an Offer with X as 'Selling'
and Y as 'For cost'; to intend to buy X for Y is to create an Offer
with X as 'For cost' and Y as 'Selling'; to intend to sell A*X for Y
each is to create an Offer with X as 'Selling', Y as 'For cost', and A
as 'Repeats'; etc.
Examples:
- I intend to sell a WRV for 8 zm.
- I intend to sell 4 G# Credits for 2 zm each.
- I intend buy a Land for 3 zm.
- I intend to sell a WRV for a Land.
VII. Selling Votes
Voting ISELL(X) on a decision is equivalent to intending to sell a
number of votes equal to your voting limit on that decision for X.
Voting ISELL(X - A*Y) on a decision (A equals one if not specified) is
equivalent to intending to sell A votes on that decision for X, and
then voting A*Y.
Examples:
- ISELL(8 zm) - allow all of your votes to be
purchased as a block for 8 zm
- ISELL(8 zm - AGAINST*8) - cast 8 AGAINST votes, which can be purchased
as a block for 8 zm
- 8*ISELL(1 zm) - allow each of your votes to be purchased
separately for 1 zm each
- 8*ISELL(1 zm - AGAINST) - cast 8 AGAINST votes, each of which can
be purchased separately for 1 zm
When an Offer is filled that specifies a number of votes on a certain
Agoran decision in the 'Selling' or 'For cost' field, the offerer or
filler respectively
- retracts enough (if any) of eir ballots on that decision that the
following ballots are valid and do not exceed eir voting limit;
- casts the specified number of ballots with the option specified by
the other party; and
- SHALL NOT retract these ballots.
If this process is impossible, the Offer CANNOT be filled.
Retractions of ballots caused by this process are performed in the
order the ballots were originally submitted.
VIII. Selling Support/Objection
Opining ISELL(X) on an intent to perform a dependent action is
equivalent to intending to sell an opinion on that action for X.
Opining ISELL(X - Y) on an intent to perform a dependent action is
equivalent to intending to sell an opinion on that action for X, and
then opining Y.
Examples:
- ISELL(4 zm)
- ISELL(4 zm - support)
- ISELL(4 zm - object)
When an Offer is filled that specifies an opinion on a certain
dependent action in the 'Selling' or 'For cost' field, the offerer or
filler respectively
- withdraws all previous support or objection for that action,
- supports or objects to that action, as specified by the other party, and
- SHALL NOT withdraw that support or objection, or thereafter support
or object to that action.
This process also applies to contract-defined psuedo-dependent
actions whose behavior differs from that of a dependent action only in
the values of time limits, or not at all.
IX. Selling Agreement
When an Offer is filled that specifies agreement to certain terms in
the 'Selling' or 'For cost' field, the offerer or filler respectively
SHALL follow those terms.
X. Motions
A motion is an entity which acts identically to an Agoran decision,
except that the requirement that the voting period last at least seven
days is waived, and, by default:
* the eligible voters are the parties to this contract,
* each eligible voter's voting limit is one,
* quorum is three,
* the voting period lasts 72 hours,
* the vote collector is the President, and
* the vote collector SHALL resolve it as soon as possible after the
voting period ends.
Any party CAN initiate a Motion to Act, specifying a set of actions to
be performed by this contract. For this motion, the adoption index is 2.
If the option selected on a Motion to Act is ADOPTED, the vote
collector CAN once act on behalf of this contract to perform those
actions, and the Motion CANNOT be resolved unless the vote collector
does so in the same message, immediately after resolving it.
Submitting a Motion to Amend with a set of amendments to this contract
is equivalent to submitting a Motion to Act specifying that this
contract make those amendments to itself.
XI. Changing the Rates
A Rate List is a list of assets and associated Rates. To effect a
Rate List is to set the Rate of each asset in the list to the
specified value.
The President CAN effect a Rate List without two objections in 48
hours. Any party CAN initiate a Motion to Effect, specifying a Rate
List. For this motion, the adoption index is 1. If the option
selected on a Motion to Effect is ADOPTED, the specified Rate List is
effected.
XII. Rates are Self-Ratifying
One week after the publication of a Rate List purporting to be part of
the President's report, the Rate List is effected unless, less than a
week after its publication, any person publicly
- challenged the Rate List's veracity, or
- purported to effect a different Rate List.
XIII. The IBA is a Partnership
Parties to this contract SHALL collectively ensure it fulfills its
legal obligations. If the Sentiment of this contract is ever not
Legalistic, any person CAN flip it to Legalistic by announcement. If
the Disclosure of this contract is ever not Public, any person CAN
flip it to Public by announcement including its text and list of
parties.
XIV. Pending Offers
A person is involved in an Offer if e is its offerer or filler. A
pending Offer is an Offer whose effects impose an ongoing, future, or
unsatisfied obligation on a person involved in it.
XV. Presidential Restriction
The President, when performing actions allowed to em by virtue of the
position, SHALL act in good faith, considering the best interests of
this contract and the game.
===============================================================================
===============================================================================
Industrial Bank & Agora Report
Date of this report: 29 August 2009
President of the IBA: comex
===============================================================================
Current Holdings:
Nickname zm
---------------------------------
*BobTHJ 764
*C-walker 135
*comex 814
*coppro 230
*Murphy 270
*Pavitra 1048
*Taral 480
*Tiger 377
*woggle 374
Wooble 182
* IBA party
All IBA parties are listed. All other persons have no zm.
===============================================================================
Unfilled Offers (can be filled by announcement):
* Pavitra [150zm]: Play Lobbyist, specifying Pavitra.
(ISELL votes not included.)
===============================================================================
Current Rates:
asset rate (zm) # in bank
-------------------------------------
-- AAA
0 Crop 11 13
1 Crop 11 2
2 Crop 45
3 Crop 21 9
4 Crop 23
5 Crop 27
6 Crop 50 7
7 Crop 19
8 Crop 12
9 Crop 11 8
X Crop 100 12
WRV 130 8
-- Cards (Government)
Roll Call 20 15
Debate-o-Matic 20 5
Arm-twist 45 14
On the Nod 45 3
Kill Bill 110 7
Lobbyist 110 1
Local Election 110
No Confidence 55 5
Goverment Ball 500
-- Cards (Change)
Distrib-u-Matic 25
Committee 30
Your Turn 30
Presto! 150
Not Your Turn 250
Supersize Me 30
Shrink Potion 50
Change Ball 500
-- Cards (Justice)
Absolv-o-Matic 45 4
Stool Pigeon 40
Drop your Wea.. 80 2
Discard Picking 130
Justice Ball 500
Penalty Box 175
* Drop your Wea.. = Drop your Weapon
-- misc
X Point 15
Y Point 15
Medal 1500
===============================================================================
History:
03 June 2009 02:44:03 Pavitra +623zm (0c, 7*1c, 2*3c, 2*4c, 2*5c,
2*6c, 7c, 3*8c, 13*9c, 4*Xc)
14 June 2009 19:37:25 woggle +200zm (4*6c)
-109zm (2*5c, 7c, 3*8c)
14 June 2009 20:13:55 Tiger +275zm (2*Xc, 3*7c, 2*0c)
-145zm (1c, 4c, 2*6c, 9c)
16 August 2009 15:51:29 BobTHJ +108zm (6c, 5c, 7c, 8c)
19 August 2009 04:07:40 BobTHJ +27zm (5c)
21 August 2009 03:47:29 comex +320zm (2*LE, NC, OtN)
21 August 2009 20:34:19 coppro +130zm (WRV)
21 August 2009 20:37:14 BobTHJ -130zm (WRV)
21 August 2009 22:43:29 BobTHJ +85zm (RC, DoM, At)
22 August 2009 15:01:09 C-walker +135zm (3*AoM)
23 August 2009 21:49:09 woggle +300zm (3*Xc)
-31zm (8c, 7c)
25 August 2009 20:18:10 Tiger +164zm (10*0c, 9*3c, 2*At, 2*Com,
OtN, RC)
25 August 2009 20:30:10 Tiger +0zm (4*7c)
-177zm (2*6c, 2*5c, 4c)
27 August 2009 07:21:10 Murphy +270zm (Lob, 2*DyW)
28 August 2009 22:00:11 BobTHJ +80zm (4*RC)
30 August 2009 15:36:11 coppro +130zm (2*AoM, 2*DoM)
31 August 2009 20:42:11 Tiger +260zm (2*WRV)
31 August 2009 23:39:02 Pavitra +80zm (DyW)
01 September 2009 03:19:03 coppro -30zm
comex +30zm [P6473]
01 September 2009 03:37:03 coppro +520zm (4*WRV)
01 September 2009 21:24:04 Taral +45zm (At)
03 September 2009 16:39:04 Wooble +481zm (4*KB, OtN)
03 September 2009 19:06:03 comex +540zm (2*Lob, LE, KB, NC)
-46zm (2*Com)
03 September 2009 19:51:04 woggle +90zm (2*AoM)
03 September 2009 23:14:03 Pavitra +151zm (2*AoM, DoM, At)
03 September 2009 23:50:04 Taral +175zm (PB)
+260zm (2*WRV)
[IBA -PB]
04 September 2009 01:10:04 coppro -220zm (2*Lob)
-330zm (3*LE)
04 September 2009 01:12:04 woggle -76zm (4*7c)
04 September 2009 19:00:04 Wooble +141zm (9*RC, At)
04 September 2009 19:15:04 Wooble -80zm (DyW)
04 September 2009 19:55:04 Wooble -360zm (8*AoM)
04 September 2009 19:55:07 BobTHJ +594zm (2*KB, 2*NC, 7*At)
===============================================================================
Text of the contract:
I. IBA
This is the Industrial Bank & Agora. The currency of the IBA is
zorkmids (zm); the recordkeepor of zorkmids is the President.
Any person CAN join this contract by announcement. Any party to this
contract CAN leave it by announcement, unless e is involved in a
pending Offer, or this contract has less than three parties, in which
case any party CAN dissolve it without objection.
The President of the IBA is comex.
II. Summary
- You can join the contract by announcement. Please join before
attempting to make Offers or vote ISELL-- your only obligations are
to uphold the terms of Offers you make.
- You can deposit 4 assets per week for the standard rate; further
deposits give you diminishing returns to prevent scams, but you can
still get a good price for up to 10.
- You can always withdraw assets for the standard rate.
- You can intend to sell or buy assets, naming a price; this is known
as an Offer, and other parties can fill the Offer by announcement.
- ISELL works like SELL, but you can vote ISELL on dependent
actions as well as decisions.
III. Banking
Every asset has a Rate in zorkmids, intially zero. The President's report
includes a Rate List containing all nonzero Rates.
IV. Withdrawal
A person CAN withdraw an asset in the IBA's possession if e has at
least its Rate in zorkmids. Withdrawing an asset is equivalent to
acting on behalf of the IBA to transfer the asset to the withdrawer;
after a person withdraws an asset, its Rate in zorkmids is destroyed
in eir possession.
V. Deposits
A person CAN deposit an asset by transferring it to the IBA; e then
gains the Effective Rate in zorkmids.
The Effective Rate for a deposit is its Rate, multiplied by a value
depending on the number of previous deposits made in the same week
with the same Executor, and rounded to the nearest integer:
prev rate
0-3 1.00
4-6 0.90
7-9 0.80
10 0.73
11 0.62
12 0.50
13 0.38
14 0.26
15 0.18
16 0.12
17 0.08
18 0.05
19 0.03
20 0.01
21- 0.00
VI. Offers
An Offer is an entity with three fields:
Selling: (a nonempty list of assets, actions, and/or obligations)
For cost: (a nonempty list of assets, actions, and/or obligations)
Repeats: (a nonnegative integer, or infinity; default 1)
A person CAN create an Offer by announcement, thus becoming its
offerer. A person CAN destroy an Offer for which e is the offerer by
announcement.
A party (the filler) generally CAN fill an Offer by announcement (and
is authorized to act on behalf of the offerer for this purpose) if the
offerer is a party. Filling an Offer is equivalent to performing the
following procedure in order, with no other actions inserted between
the start and end of the procedure; and notwithstanding the previous
sentence, if the procedure would not be entirely successful, the Offer
cannot be filled at all:
- the filler acts on behalf of the offerer to transfer the assets in
the 'Selling' field to the filler, and to take the actions in the
'Selling' field, and
- the filler transfers the assets in the 'For cost' field to the
offerer, and takes the actions in the 'For cost' field, and
- the Offer's 'Repeats' field is decreased by one.
The filler SHALL satisfy the obligations (if any) in the 'For cost'
field; the offerer SHALL satisfy the obligations (if any) in the
Selling' field.
An Offer with zero Repeats CANNOT be filled. A non-pending Offer with
zero Repeats is automatically destroyed.
To intend to sell X for Y is to create an Offer with X as 'Selling'
and Y as 'For cost'; to intend to buy X for Y is to create an Offer
with X as 'For cost' and Y as 'Selling'; to intend to sell A*X for Y
each is to create an Offer with X as 'Selling', Y as 'For cost', and A
as 'Repeats'; etc.
Examples:
- I intend to sell a WRV for 8 zm.
- I intend to sell 4 G# Credits for 2 zm each.
- I intend buy a Land for 3 zm.
- I intend to sell a WRV for a Land.
VII. Selling Votes
Voting ISELL(X) on a decision is equivalent to intending to sell a
number of votes equal to your voting limit on that decision for X.
Voting ISELL(X - A*Y) on a decision (A equals one if not specified) is
equivalent to intending to sell A votes on that decision for X, and
then voting A*Y.
Examples:
- ISELL(8 zm) - allow all of your votes to be
purchased as a block for 8 zm
- ISELL(8 zm - AGAINST*8) - cast 8 AGAINST votes, which can be purchased
as a block for 8 zm
- 8*ISELL(1 zm) - allow each of your votes to be purchased
separately for 1 zm each
- 8*ISELL(1 zm - AGAINST) - cast 8 AGAINST votes, each of which can
be purchased separately for 1 zm
When an Offer is filled that specifies a number of votes on a certain
Agoran decision in the 'Selling' or 'For cost' field, the offerer or
filler respectively
- retracts enough (if any) of eir ballots on that decision that the
following ballots are valid and do not exceed eir voting limit;
- casts the specified number of ballots with the option specified by
the other party; and
- SHALL NOT retract these ballots.
If this process is impossible, the Offer CANNOT be filled.
Retractions of ballots caused by this process are performed in the
order the ballots were originally submitted.
VIII. Selling Support/Objection
Opining ISELL(X) on an intent to perform a dependent action is
equivalent to intending to sell an opinion on that action for X.
Opining ISELL(X - Y) on an intent to perform a dependent action is
equivalent to intending to sell an opinion on that action for X, and
then opining Y.
Examples:
- ISELL(4 zm)
- ISELL(4 zm - support)
- ISELL(4 zm - object)
When an Offer is filled that specifies an opinion on a certain
dependent action in the 'Selling' or 'For cost' field, the offerer or
filler respectively
- withdraws all previous support or objection for that action,
- supports or objects to that action, as specified by the other party, and
- SHALL NOT withdraw that support or objection, or thereafter support
or object to that action.
This process also applies to contract-defined psuedo-dependent
actions whose behavior differs from that of a dependent action only in
the values of time limits, or not at all.
IX. Selling Agreement
When an Offer is filled that specifies agreement to certain terms in
the 'Selling' or 'For cost' field, the offerer or filler respectively
SHALL follow those terms.
X. Motions
A motion is an entity which acts identically to an Agoran decision,
except that the requirement that the voting period last at least seven
days is waived, and, by default:
* the eligible voters are the parties to this contract,
* each eligible voter's voting limit is one,
* quorum is three,
* the voting period lasts 72 hours,
* the vote collector is the President, and
* the vote collector SHALL resolve it as soon as possible after the
voting period ends.
Any party CAN initiate a Motion to Act, specifying a set of actions to
be performed by this contract. For this motion, the adoption index is 2.
If the option selected on a Motion to Act is ADOPTED, the vote
collector CAN once act on behalf of this contract to perform those
actions, and the Motion CANNOT be resolved unless the vote collector
does so in the same message, immediately after resolving it.
Submitting a Motion to Amend with a set of amendments to this contract
is equivalent to submitting a Motion to Act specifying that this
contract make those amendments to itself.
XI. Changing the Rates
A Rate List is a list of assets and associated Rates. To effect a
Rate List is to set the Rate of each asset in the list to the
specified value.
The President CAN effect a Rate List without two objections in 48
hours. Any party CAN initiate a Motion to Effect, specifying a Rate
List. For this motion, the adoption index is 1. If the option
selected on a Motion to Effect is ADOPTED, the specified Rate List is
effected.
XII. Rates are Self-Ratifying
One week after the publication of a Rate List purporting to be part of
the President's report, the Rate List is effected unless, less than a
week after its publication, any person publicly
- challenged the Rate List's veracity, or
- purported to effect a different Rate List.
XIII. The IBA is a Partnership
Parties to this contract SHALL collectively ensure it fulfills its
legal obligations. If the Sentiment of this contract is ever not
Legalistic, any person CAN flip it to Legalistic by announcement. If
the Disclosure of this contract is ever not Public, any person CAN
flip it to Public by announcement including its text and list of
parties.
XIV. Pending Offers
A person is involved in an Offer if e is its offerer or filler. A
pending Offer is an Offer whose effects impose an ongoing, future, or
unsatisfied obligation on a person involved in it.
XV. Presidential Restriction
The President, when performing actions allowed to em by virtue of the
position, SHALL act in good faith, considering the best interests of
this contract and the game.
===============================================================================
Alright. I've been slacking with the IBA, but I believe that its
purpose is much better fulfilled with the multitude of cards that are
now available for trade. I for one already want to trade cards I
don't want for those I do, and there's no reason the IBA can't satisfy
this purpose.
I pledge that in the future, I won't be so haphazard regarding
reports. Instead, I will set the weekly report as a cronjob, like the
ruleset; however, like the ruleset, it may in the future be slightly
out of date at the time of publication. I will indicate the time of
last update with future reports.
--
Reposting this amendment, which failed quorum before.
I initiate a Motion to Amend, specifying the following amendment (in
diff format). The eligible voters are the parties to the IBA, the
options are FOR, AGAINST, and PRESENT, and I am the vote collector. I
vote FOR the Motion to Amend.
@@ -256,6 +255,7 @@
days is waived, and, by default:
* the eligible voters are the parties to this contract,
* each eligible voter's voting limit is one,
+* quorum is three,
* the voting period lasts 72 hours,
* the vote collector is the President, and
* the vote collector SHALL resolve it as soon as possible after the
--
Fix the offer system.
I initiate a Motion to Amend, specifying the following amendment (in
diff format). The eligible voters are the parties to the IBA, the
options are FOR, AGAINST, and PRESENT, and I am the vote collector. I
vote FOR the Motion to Amend.
@@ -152,20 +152,18 @@ A person CAN create an Offer by announcement, thus becoming its
offerer. A person CAN destroy an Offer for which e is the offerer by
announcement.
-A party (the filler) CAN fill an Offer by announcement if and only if:
- - the offerer is a party, and
- - the offerer has the assets in the 'Selling' field (if any), and CAN
- perform the actions in that field (if any), and
- - the filler has the assets in the 'For cost' field (if any), and CAN
- perform the actions in that field (if any).
-
-When an Offer is filled,
-- the IBA acts on behalf of the offerer to transfer the assets in the
- 'Selling' field to the filler, and to take the actions in the
- 'Selling' field, and
-- the IBA acts on behalf of the filler to transfer the assets in the
- 'For cost' field to the offerer, and to take the actions in the 'For
- cost' field, and
+A party (the filler) generally CAN fill an Offer by announcement (and
+is authorized to act on behalf of the offerer for this purpose) if the
+offerer is a party. Filling an Offer is equivalent to performing the
+following procedure in order, with no other actions inserted between
+the start and end of the procedure; and notwithstanding the previous
+sentence, if the procedure would not be entirely successful, the Offer
+cannot be filled at all:
+
+- the filler acts on behalf of the offerer to transfer the assets in the
+'Selling' field to the filler, and to take the actions in the 'Selling' field, and
+- the filler transfers the assets in the 'For cost' field to the offerer, and
+takes the actions in the 'For cost' field, and
- the Offer's 'Repeats' field is decreased by one.
An Offer with zero Repeats is automatically destroyed.
===============================================================================
Industrial Bank & Agora Report
Date of this report: 7 August 2009
Date of last report: 17 June 2009
Accurate as of: 7 August 2009 20:24:50
President of the IBA: comex
===============================================================================
Current Holdings:
Nickname zm
---------------------------------
*BobTHJ 0
*comex 0
*coppro 0
*C-walker 0
*Pavitra 623
*Tiger 130
*woggle 91
* IBA party
All IBA parties are listed. All other persons have no zm.
===============================================================================
Current Rates:
asset rate (zm) # in bank
---------------------------------
0 Crop 11 3
1 Crop 11 6
2 Crop 45
3 Crop 21 2
4 Crop 23 1
5 Crop 27
6 Crop 50 4
7 Crop 19 3
8 Crop 12
9 Crop 11 12
X Crop 100 8
WRV 130
--
C Credit 75
C# Credit 214
D Credit 80
D# Credit 188
E Credit 57
F Credit 141
F# Credit 96
G Credit 173
G# Credit 69
A Credit 100
A# Credit 125
B Credit 214
**Credit = Note Credit
===============================================================================
New Rates:
I intend, without two objections in 48 hours, to effect the following
Rate List.
asset rate (zm) # in bank
-------------------------------------
-- AAA
0 Crop 11 3
1 Crop 11 6
2 Crop 45
3 Crop 21 2
4 Crop 23 1
5 Crop 27
6 Crop 50 4
7 Crop 19 3
8 Crop 12
9 Crop 11 12
X Crop 100 8
WRV 130
-- Cards (Government)
Roll Call 20
Debate-o-Matic 20
Arm-twist 45
On the Nod 45
Kill Bill 110
Lobbyist 110
Local Election 110
No Confidence 55
-- Cards (Change)
Distrib-u-Matic 20
Committee 23
Your Turn 25
Presto! 115
Not Your Turn 250
-- Cards (Justice)
Absolv-o-Matic 45
Stool Pigeon 40
Drop your Wea.. 80
Discard Picking 170
* Drop your Wea.. = Drop your Weapon
===============================================================================
History:
03 June 2009 02:44:03 Pavitra +623zm (0c, 7*1c, 2*3c, 2*4c, 2*5c,
2*6c, 7c, 3*8c, 13*9c, 4*Xc)
14 June 2009 19:37:25 woggle +200zm (4*6c)
-109zm (2*5c, 7c, 3*8c)
14 June 2009 20:13:55 Tiger +275zm (2*Xc, 3*7c, 2*0c)
-145zm (1c, 4c, 2*6c, 9c)
===============================================================================
Text of the contract:
I. IBA
This is the Industrial Bank & Agora. The currency of the IBA is
zorkmids (zm); the recordkeepor of zorkmids is the President.
Any person CAN join this contract by announcement. Any party to this
contract CAN leave it by announcement, unless e is involved in a
pending Offer, or this contract has less than three parties, in which
case any party CAN dissolve it without objection.
The President of the IBA is comex.
II. Summary
- You can join the contract by announcement. Please join before
attempting to make Offers or vote ISELL-- your only obligations are
to uphold the terms of Offers you make.
- You can deposit 4 assets per week for the standard rate; further
deposits give you diminishing returns to prevent scams, but you can
still get a good price for up to 10.
- You can always withdraw assets for the standard rate.
- You can intend to sell or buy assets, naming a price; this is known
as an Offer, and other parties can fill the Offer by announcement.
- ISELL works like SELL, but you can vote ISELL on dependent
actions as well as decisions.
III. Banking
Every asset has a Rate in zorkmids, intially zero. The President's report
includes a Rate List containing all nonzero Rates.
IV. Withdrawal
A person CAN withdraw an asset in the IBA's possession if e has at
least its Rate in zorkmids; those zorkmids are destroyed in eir
possession and the IBA transfers the asset to em.
V. Deposits
A person CAN deposit an asset by transferring it to the IBA; e then
gains the Effective Rate in zorkmids.
The Effective Rate for a deposit is its Rate, multiplied by a value
depending on the number of previous deposits made in the same week
with the same Executor, and rounded to the nearest integer:
prev rate
0-3 1.00
4-6 0.90
7-9 0.80
10 0.73
11 0.62
12 0.50
13 0.38
14 0.26
15 0.18
16 0.12
17 0.08
18 0.05
19 0.03
20 0.01
21- 0.00
VI. Offers
An Offer is an entity with three fields:
Selling: (a nonempty list of assets and/or actions)
For cost: (a nonempty list of assets and/or actions)
Repeats: (a nonnegative integer, or infinity; default 1)
A person CAN create an Offer by announcement, thus becoming its
offerer. A person CAN destroy an Offer for which e is the offerer by
announcement.
A party (the filler) CAN fill an Offer by announcement if and only if:
- the offerer is a party, and
- the offerer has the assets in the 'Selling' field (if any), and CAN
perform the actions in that field (if any), and
- the filler has the assets in the 'For cost' field (if any), and CAN
perform the actions in that field (if any).
When an Offer is filled,
- the IBA acts on behalf of the offerer to transfer the assets in the
'Selling' field to the filler, and to take the actions in the
'Selling' field, and
- the IBA acts on behalf of the filler to transfer the assets in the
'For cost' field to the offerer, and to take the actions in the 'For
cost' field, and
- the Offer's 'Repeats' field is decreased by one.
An Offer with zero Repeats is automatically destroyed.
To intend to sell X for Y is to create an Offer with X as 'Selling'
and Y as 'For cost'; to intend to buy X for Y is to create an Offer
with X as 'For cost' and Y as 'Selling'; to intend to sell A*X for Y
each is to create an Offer with X as 'Selling', Y as 'For cost', and A
as 'Repeats'; etc.
Examples:
- I intend to sell a WRV for 8 zm.
- I intend to sell 4 G# Credits for 2 zm each.
- I intend buy a Land for 3 zm.
- I intend to sell a WRV for a Land.
VII. Selling Votes
Voting ISELL(X) on a decision is equivalent to intending to sell a
number of votes equal to your voting limit on that decision for X.
Voting ISELL(X - A*Y) on a decision (A equals one if not specified) is
equivalent to intending to sell A votes on that decision for X, and
then voting A*Y.
Examples:
- ISELL(8 zm) - allow all of your votes to be
purchased as a block for 8 zm
- ISELL(8 zm - AGAINST*8) - cast 8 AGAINST votes, which can be purchased
as a block for 8 zm
- 8*ISELL(1 zm) - allow each of your votes to be purchased
separately for 1 zm each
- 8*ISELL(1 zm - AGAINST) - cast 8 AGAINST votes, each of which can
be purchased separately for 1 zm
When an Offer is filled that specifies a number of votes on a certain
Agoran decision in the 'Selling' or 'For cost' field, the offerer or
filler respectively
- retracts enough (if any) of eir ballots on that decision that the
following ballots are valid and do not exceed eir voting limit;
- casts the specified number of ballots with the option specified by
the other party; and
- SHALL NOT retract these ballots.
If this process is impossible, the Offer CANNOT be filled.
Retractions of ballots caused by this process are performed in the
order the ballots were originally submitted.
VIII. Selling Support/Objection
Opining ISELL(X) on an intent to perform a dependent action is
equivalent to intending to sell an opinion on that action for X.
Opining ISELL(X - Y) on an intent to perform a dependent action is
equivalent to intending to sell an opinion on that action for X, and
then opining Y.
Examples:
- ISELL(4 zm)
- ISELL(4 zm - support)
- ISELL(4 zm - object)
When an Offer is filled that specifies an opinion on a certain
dependent action in the 'Selling' or 'For cost' field, the offerer or
filler respectively
- withdraws all previous support or objection for that action,
- supports or objects to that action, as specified by the other party, and
- SHALL NOT withdraw that support or objection, or thereafter support
or object to that action.
This process also applies to contract-defined psuedo-dependent
actions whose behavior differs from that of a dependent action only in
the values of time limits, or not at all.
IX. Selling Agreement
When an Offer is filled that specifies agreement to certain terms in
the 'Selling' or 'For cost' field, the offerer or filler respectively
SHALL follow those terms.
X. Motions
A motion is an entity which acts identically to an Agoran decision,
except that the requirement that the voting period last at least seven
days is waived, and, by default:
* the eligible voters are the parties to this contract,
* each eligible voter's voting limit is one,
* the voting period lasts 72 hours,
* the vote collector is the President, and
* the vote collector SHALL resolve it as soon as possible after the
voting period ends.
Any party CAN initiate a Motion to Act, specifying a set of actions to
be performed by this contract. For this motion, the adoption index is 2.
If the option selected on a Motion to Act is ADOPTED, the vote
collector CAN once act on behalf of this contract to perform those
actions, and the Motion CANNOT be resolved unless the vote collector
does so in the same message, immediately after resolving it.
Submitting a Motion to Amend with a set of amendments to this contract
is equivalent to submitting a Motion to Act specifying that this
contract make those amendments to itself.
XI. Changing the Rates
A Rate List is a list of assets and associated Rates. To effect a
Rate List is to set the Rate of each asset in the list to the
specified value.
The President CAN effect a Rate List without two objections in 48
hours. Any party CAN initiate a Motion to Effect, specifying a Rate
List. For this motion, the adoption index is 1. If the option
selected on a Motion to Effect is ADOPTED, the specified Rate List is
effected.
XII. Rates are Self-Ratifying
One week after the publication of a Rate List purporting to be part of
the President's report, the Rate List is effected unless, less than a
week after its publication, any person publicly
- challenged the Rate List's veracity, or
- purported to effect a different Rate List.
XIII. The IBA is a Partnership
Parties to this contract SHALL collectively ensure it fulfills its
legal obligations. If the Sentiment of this contract is ever not
Legalistic, any person CAN flip it to Legalistic by announcement. If
the Disclosure of this contract is ever not Public, any person CAN
flip it to Public by announcement including its text and list of
parties.
XIV. Pending Offers
A person is involved in an Offer if e is its offerer or filler. A
pending Offer is an Offer whose effects impose an ongoing or
unsatisfied obligation on a person involved in it.
XV. Presidential Restriction
The President, when performing actions allowed to em by virtue of the
position, SHALL act in good faith, considering the best interests of
this contract and the game.
===============================================================================
body {
background-color: #424242;
font-family: Verdana;
font-size: 11px;
}
#sectionreport {
color: #fff;
white-space: pre;
font-family: monospace;
display: none;
}
#sectioncontract {
color: #fff;
white-space: pre;
display: none;
}
#sectionrate {
}
#links {
margin-bottom: 3px;
}
#links .link {
border-color: #606060;
color: #81ffa5;
text-decoration: underline;
}
#links .linkactive {
text-decoration: none;
}
#tab {
}
#tab td, th {
background-color: #606060;
color: #81ffa5;
font-family: Verdana;
font-size: 11px;
}
#tab td.ghost {
padding-top: 3px;
padding-bottom: 3px;
}
#tab td.rate {
color: #ffa9af;
font-weight: bold;
padding-left: 5px;
}
#tab button {
background-color: #404040;
font-weight: bold;
color: #888; /*#e8646a;*/
border: 1px solid #777777;
text-align: center;
width: 50px;
margin: 0px;
padding-top: 2px;
padding-bottom: 2px;
cursor: pointer;
}
#tab td.mine {
font-weight: bold;
}
#tab td.mipos, td.mineg, td.mirate {
width: 40px;
text-align: center;
}
#tab td.mipos {
color: #81ffa5;
}
#tab td.mineg {
color: #f7a9af;
}
#tab td.mirate {
color: #ffa9af;
}
.negzm {
font-weight: bold;
color: #ff7777;
}
.pos {
font-weight: bold;
color: #81ffa5;
}
.neg {
font-weight: bold;
color: #f7a9af;
}
div.lt {
position: fixed;
top: 27px;
background-color: #606060;
color: #ffa9af;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
padding: 5px;
}
div#row {
margin-bottom: 3px;
}
div#row a {
color: #81ffa5;
}
#cancel {
display: none;
}
textarea#stuff {
background-color: #606060;
border: 1px solid #404040;
padding: 1px;
color: #ffa9af;
height: 200px;
font-family: Verdana;
font-size: 11px;
margin-top: 5px;
}
#parties {
background-color: #606060;
color: #ffffff;
border: 1px solid #404040;
}
function getXmlHttp() {
var xhr = null;
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e){
try {
xhr = new XMLHttpRequest();
} catch(e){}
}
return xhr;
}
function grabPage(url, callback) {
var xhr = getXmlHttp();
if(callback) xhr.onreadystatechange = function() {
if(xhr.readyState == 4) callback(xhr.responseText);
}
xhr.open('GET', url);
xhr.send(null);
}
var users = null;
var user = null;
var bobmode = false;
function c(x, md, all) {
var banks = document.getElementById('banks-'+md);
var mine = document.getElementById('mine-'+md);
var bankv = data[md][2];
var minev = data[md][3];
var u;
bankv -= x;
minev += x;
if(bankv < 0) return;
if(user) {
u = user[md];
if(!u) u = 0;
if(u + minev < 0) return;
}
banks.innerHTML = bankv == 0 ? '' : bankv;
if(user) {
mine.className = 'mine mirate';
var v = u + minev;
mine.innerHTML = v == 0 ? '' : v;
} else if(minev < 0) {
mine.className = 'mine mineg';
mine.innerHTML = minev;
} else if(minev > 0) {
mine.className = 'mine mipos';
mine.innerHTML = '+'+minev;
} else {
mine.className = 'mine';
mine.innerHTML = '';
}
data[md][2] = bankv;
data[md][3] = minev;
if(!all) {
fixLeft();
fixTotals();
}
}
function call() {
for(var md in data) {
c(0, md, true);
}
fixLeft();
fixTotals();
}
function cancel() {
for(var md in data) {
c(-data[md][3], md, true);
}
fixLeft();
fixTotals();
}
var bob = document.getElementById('bob');
var parties = document.getElementById('parties');
var prev2rate = [1.00, 1.00, 1.00, 1.00, 0.90, 0.90, 0.90, 0.80, 0.80, 0.80, 0.73, 0.62, 0.50, 0.38, 0.26, 0.18, 0.12, 0.08, 0.05, 0.03, 0.01];
var totale = document.getElementById('total');
var stuffe = document.getElementById('stuff');
var cancele = document.getElementById('cancel');
function fixTotals() {
var deposit = ''; var withdraw = '';
var prev = prevs[parties.value];
if(!prev) prev = 0;
var total = 0;
var yes = false;
var md; for(var e = 0; md = order[e]; e++) {
var minev = data[md][3];
if(minev == 0) continue;
var rate = data[md][1];
var a = 0;
var ab = Math.abs(minev);
for(var i = 0; i < ab; i++) {
var mult;
if(minev < 0) {
mult = prev >= 21 ? 0 : -prev2rate[prev];
prev++;
} else {
mult = 1.0;
}
var q = Math.round(mult * rate);
total -= q;
a -= q;
yes = true;
}
var line = 'I ' + (minev < 0 ? 'deposit' : 'withdraw') + ' ' + (ab > 1 ? (ab + ' * ') : 'one ') + data[md][0] + ' for ' + Math.abs(a) + 'zm.\n';
if(minev < 0) deposit += line; else withdraw += line;
}
if(!yes) {
totale.innerHTML = '--';
totale.className = '';
cancele.style.display = 'none';
} else {
cancele.style.display = 'inline';
var newzm = userzm + total;
totale.innerHTML = (total >= 0 ? '+' : '') + total + 'zm';
totale.className = (newzm < 0 ? 'negzm' : (total >= 0 ? 'pos' : 'neg'));
//totale.innerHTML = //(newzm < 0 ? ('<span class="negzm">'+newzm+'zm</span>') : (newzm+'zm')) + ' (<span class="' + (total >= 0 ? 'pos' : 'neg') + '">' + (total >= 0 ? '+' : '') + total + '</span>)';
}
stuffe.value = deposit + withdraw;
}
function cancelBob() {
bobmode = false;
updateBob();
}
function updateBob() {
if(bobmode) {
var p = parties.value.toLowerCase();
if(p == 'comex') p = 'c.';
user = users[p];
if(!user) user = {};
bob.innerHTML = 'Ask Bob';
bob.onclick = cancelBob;
bob.href = '#';
call();
} else {
var ou = user;
user = null;
bob.innerHTML = 'Ask Bob';
bob.onclick = askBob;
bob.href = '#';
if(ou) call();
}
}
var now = document.getElementById('now');
parties.onchange = function() {
userzm = holdings[parties.value];
now.innerHTML = userzm + 'zm';
updateBob();
}
fixTotals();
var lt = document.getElementById('lt');
var tab = document.getElementById('tab');
var aaa = document.getElementById('aaa');
function fixLeft() {
lt.style.left = tab.clientWidth + 15 + 'px';
lt.style.top = aaa.offsetTop + tab.offsetTop;
lt.className = 'lt';
}
fixLeft();
window.onload = fixLeft;
function askBob() {
bob.innerHTML = 'Asking Bob...';
bob.href = bob.onclick = null;
// grabpage
grabPage('scrape.php', function(text) {
users = eval('('+text+')');
bobmode = true;
updateBob();
});
}
bob.onclick = askBob
var srs = [
document.getElementById('sectionrate'),
document.getElementById('sectioncontract'),
document.getElementById('sectionreport')
];
var lcs = document.getElementById('links').getElementsByTagName('a');
var curn = 0;
function go(n) {
if(n == curn) return;
for(var i = 0; i < srs.length; i++) {
srs[i].style.display = (i == n) ? 'block' : 'none';
lcs[i].className = (i == n) ? 'link linkactive' : 'link linkinactive';
var ih = lcs[i].innerHTML.replace('[', '').replace(']', '');
if(i == n) ih = '['+ih+']';
lcs[i].innerHTML = ih;
}
if(n == 0) fixLeft();
curn = n;
}
function checkHash() {
var q = window.location.hash.replace('#', '');
q = parseInt(q);
go(q?q:0);
}
setInterval(checkHash, 200);
checkHash();
<html>
<head>
<link rel="stylesheet" href="rates.css?<?php echo @filemtime('rates.css'); ?>">
<title>industrial bank &amp; agora</title>
</head>
<body>
<?php
if(@filemtime('.agd.cache') < max(@filemtime('agdump.py'), @filemtime('iba.txt'))) {
passthru('python agdump.py 2>&1 > .agd.cache');
}
list($rates, $prev, $parties, $order, $contract, $holdings) = json_decode(file_get_contents('.agd.cache'));
$loser = $parties[0];
?>
<div id="links">
<a class="link linkactive" href="#0" onclick="go(0);">[rate calculator]</a>
<a class="link" href="#1" onclick="go(1);">contract</a>
<a class="link" href="#2" onclick="go(2);">report</a>
</div>
<div id="sectionreport">
<?php
$iba = file_get_contents('iba.txt');
$iba = preg_replace('/^Date of this report: .*$/m', 'Last updated: (unknown)', $iba);
echo $iba;
?>
</div>
<div id="sectioncontract">
<?php echo $contract; ?>
</div>
<div id="sectionrate">
<table id="tab">
<tr>
<th>asset</th>
<th>rate (zm)</th>
<th># in bank</th>
<th style="background-color: #424242"></th>
<th>you</th>
<?php
$data = array();
$rated = false;
foreach($rates as $rate) {
if(gettype($rate) == 'string') {
if(substr($rate, 0, 3) == '-- ') {
echo "<tr><td class='ghost' colspan='5'" . ($rated ? "" : " id='aaa'") . "><b>" . htmlentities(substr($rate, 3)) . "</b>";
$rated = true;
}
} else {
if($rate[0] == 'Drop your Wea..') $rate[0] = 'Drop your Weapon';
$data[$rate[0]] = array($rate[0], $rate[1], $rate[2], 0);
$banks = $rate[2] == 0 ? '' : $rate[2];
echo "<tr id='tr-{$rate[0]}'><td>{$rate[0]}</td><td class='rate'>{$rate[1]}</td><td class='rate' id='banks-{$rate[0]}'>{$banks}</td><td class='btab'><button onclick=\"return c(-1,'{$rate[0]}');\">&laquo;</button><button id='ra-{$rate[0]}' onclick=\"return c(1,'{$rate[0]}');\">&raquo;</button></td><td class='mine' id='mine-{$rate[0]}'></td></tr>\n";
}
}
?>
</table>
<div id="lt">
Player:
<select name="parties" id="parties">
<?php foreach($parties as $party) {
$party = htmlentities($party);
$p = $prev->$party;
if(!$p) $p = 0;
echo "<option value='$party'";
if($party == $loser) echo " selected='selected'";
echo ">$party ($p)</option>\n";
} ?>
</select>
<br>
<div id="row">
<a id="cancel" href="#" onclick="return cancel();">Cancel</a>
<a id="bob" href="#" onclick="return askBob();">Ask Bob</a>
</div>
Now: <span id="now"><?php echo $holdings->$loser; ?>zm</span><br>
Change: <span id="total">--</span><br>
<textarea id="stuff">
</textarea>
</div>
<script>
var data = <?php echo json_encode($data); ?>;
var userzm = <?php echo $holdings->$loser; ?>;
var prevs = <?php echo json_encode($prev); ?>;
var order = <?php echo json_encode($order); ?>;
var holdings = <?php echo json_encode($holdings); ?>;
</script>
</div>
<script src="rates.js?<?php echo @filemtime('rates.js'); ?>">
</script>
</body>
</html>
<?php
if(0) {
header('Content-Type: text/plain');
readfile('scrape.txt');
die();
}
$fp = fopen("http://nomic.bob-space.com/agorareport.aspx?contract=All%20Decks", "r");
$cards = array();
$mode = 0;
while($line = fgets($fp)) {
$line = trim($line);
if($mode == 0) {
if($line == '-------------') {
$mode = 1;
}
} else if($mode == 1) {
if($line == '') {
$mode = 2;
} else {
preg_match('!^([^\(]+) \([^\)]+\)( x([0-9]+))?!', $line, $matches);
$card = $matches[1];
$cards[$cur][$card] = $matches[3] ? intval($matches[3]) : 1;
}
} else if($mode == 2) {
if($line == '') break;
$cur = strtolower($line);
$cards[$cur] = array();
$mode = 1;
}
}
fclose($fp);
$fp = fopen("http://nomic.bob-space.com/agorareport.aspx?contract=Scorekeepor", "r");
while($line = fgets($fp)) {
if(preg_match('/^All other players have/', $line)) break;
if(!preg_match('/(.*) +([0-9]+)\+ *([0-9]+)i/U', $line, $matches)) continue;
$user = strtolower(trim($matches[1]));
$cards[$user]['X Point'] = intval($matches[2]);
$cards[$user]['Y Point'] = intval($matches[3]);
}
fclose($fp);
$fp = fopen("http://nomic.bob-space.com/agorareport.aspx?contract=AAA", "r");
$mode = false;
while($line = fgets($fp)) {
$line = trim($line);
if(!$mode) {
if($line != '' && str_replace('-', '', $line) == '') $mode = true;
continue;
}
if($line == '') break;
$p = strtolower(trim(substr($line, 0, 19)));
$stuff = preg_split('/\s+/', substr($line, 19));
$ar = array('0 Crop', '1 Crop', '2 Crop', '3 Crop', '4 Crop', '5 Crop', '6 Crop', '7 Crop', '8 Crop', '9 Crop', 'X Crop', 'WRV');
for($i = 0; $i < count($ar); $i++) {
$cards[$p][$ar[$i]] = intval($stuff[$i]);
}
}
header('Content-Type: text/plain');
echo json_encode($cards) . "\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment