Jay Campbell on Sat, 15 Nov 2008 02:06:29 -0700 (MST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[s-d] More automation


I have a ruby script that grabs email for bnomic@xxxxxxxxxx Given 
commands that start with 'bnomic!' it can produce a saved gamestate:

  bnomic! a player exists named J
  bnomic! a corporation exists named OCB LLC

  bnomic! adjust j by m100
  bnomic! adjust j by -5 macks
  bnomic! transfer 25 macks from j to ocb LLC

  bnomic! ocb llc has 3 blue socks
  bnomic! transfer 10 blue socks from ocb llc to j   # see below
  bnomic! transfer 1 blue foowear from ocb llc to j

  bnomic! j has 20 points
  bnomic! adjust j by -30 points     # actually just drops to zero
  bnomic! adjust j by 5 points
  bnomic! adjust somebody by 100 points

Interim errors produced:
FAIL: transfer 10 blue socks from ocb llc to j: insufficient funds
FAIL: adjust somebody by 100 points: Failed to adjust macks: Who is 
'somebody'?

Final state:
name: OCB LLC
  points: 0
  type: corp
  macks: 25
  socks:  Blue: 2
name: J
  points: 20
  type: player
  macks: 45
  socks:  Blue: 1

If Ministers past and present like the idea I'll push it live.

For transparency, full history will be queryable via private mail to the 
bot or via wiki or somesuch, and periodic public forum reports of 
sucessful (and failed) activity is probably in order. Rather than spam 
the list, it should probably send private email in case of transaction 
failure.

The current regular expressions (after some normalization of the input) are:

    if line =~ /transfer (m(\d+)|(\d+) macks?) from (.*) to (.*)/i

    elsif line =~ /adjust (.*) (by)? (\+?-?m?\+?-?\d+)( macks?)?/i

    elsif line =~ /adjust (.*) (by)? (\+?-?\d+) points?/i

    elsif line =~ /(.*) has (\d+) points/i

    elsif line =~ /transfer (\d+) (.*) (sock|foot?wear)s? from (.*) to 
(.*)/i

    elsif line =~ /(.*) has (\d+) (.*) (sock|foot?wear)s?/

    elsif line =~ /a (player|corp)(oration)? exists named "?(.*)"?/i




_______________________________________________
spoon-discuss mailing list
spoon-discuss@xxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/spoon-discuss