PhaethonH

From Egs Mayhem

(Difference between revisions)
m (Current Inventory)
m (Inventory Log)
Line 199: Line 199:
   % First item collection
   % First item collection
-
   ts('2008.08.11'),
+
   ts('2007.08.11'),
   obtain('Tyris', 'TF Gun', [tfgun]),
   obtain('Tyris', 'TF Gun', [tfgun]),
   obtain('Tyris', 'Fish', [fish, dead]),
   obtain('Tyris', 'Fish', [fish, dead]),
Line 206: Line 206:
   obtain('Tyris', 'red crystal inscribed with TF-gun code for Otter V1', [crystal, red, for(tfgun), tfgun('Otter V1')]),
   obtain('Tyris', 'red crystal inscribed with TF-gun code for Otter V1', [crystal, red, for(tfgun), tfgun('Otter V1')]),
-
   ts('2008.08.11'),
+
   ts('2007.08.11'),
   obtain('Kalga', 'yarn ball of distraction', [ball, yarn, distraction]),
   obtain('Kalga', 'yarn ball of distraction', [ball, yarn, distraction]),
-
   ts('2008.08.11'),
+
   ts('2007.08.11'),
   obtain('Cheez', 'shiny hubcap', [hubcap, shiny]),
   obtain('Cheez', 'shiny hubcap', [hubcap, shiny]),
   obtain('Cheez', 'can of mackerel', [can, mackerel]),
   obtain('Cheez', 'can of mackerel', [can, mackerel]),
   obtain('Cheez', 'bag of salt-n-glass cookies', [bag, cookie, salt_n_glass]),
   obtain('Cheez', 'bag of salt-n-glass cookies', [bag, cookie, salt_n_glass]),
-
   ts('2008.08.11'),
+
   ts('2007.08.11'),
   obtain('littlebeast', 'Infinite Scroll of Doom-Ish', [scroll, infinite, 'doom-ish']),
   obtain('littlebeast', 'Infinite Scroll of Doom-Ish', [scroll, infinite, 'doom-ish']),
   obtain('littlebeast', 'Infinite Pen of Doom-Ish', [pen, infinite, 'doom-ish']),
   obtain('littlebeast', 'Infinite Pen of Doom-Ish', [pen, infinite, 'doom-ish']),
   obtain('littlebeast', 'DD/RR mod for TF Gun', [dd_rr_mod, 'DD/RR mod', for(tfgun)]),
   obtain('littlebeast', 'DD/RR mod for TF Gun', [dd_rr_mod, 'DD/RR mod', for(tfgun)]),
-
   ts('2008.08.11'),
+
   ts('2007.08.11'),
   obtain('Jenerix525', 'mirror with silver handle', [mirror, 'silver handle']),
   obtain('Jenerix525', 'mirror with silver handle', [mirror, 'silver handle']),
   % Add above this line.
   % Add above this line.

Revision as of 07:35, 12 August 2007

Contents

ΦαεθωνΗ

Phi, alpha, epsilon, theta, omega, nu -- along the lines of "faye, tonne".

I abuse this wiki to stash stuff.

Forum-avatar stuff

Image:iJackhound3.gif

This is May from Guilty Gear. An iPod ad parody with May doing her Jackhound technique and losing her iPod mid-attack.

Image stuff

Image:PH_TG-MK1.png


Inventory

Current Inventory

Generated from the Inventory Log program below.

Current inventory:
 a) TF Gun
 b) Fish (dead)
 c) Squirrel teddy (squirrel)
 d) can of soda (soda, unlabeled)
 e) can of soda (soda, unlabeled)
 f) can of soda (soda, unlabeled)
 g) can of soda (soda, unlabeled)
 h) can of soda (soda, unlabeled)
 i) can of soda (soda, unlabeled)
 j) red crystal inscribed with TF-gun code for Otter V1 (red)
 k) yarn ball of distraction (yarn, distraction)
 l) shiny hubcap (shiny)
 m) can of mackerel (mackerel)
 n) bag of salt-n-glass cookies (cookie, salt_n_glass)
 o) Infinite Scroll of Doom-Ish (infinite, doom-ish)
 p) Infinite Pen of Doom-Ish (infinite, doom-ish)
 q) DD/RR mod for TF Gun (DD/RR mod)
 r) mirror with silver handle (silver handle)
(end)

Inventory Log

This is one giant Prolog program file:

%#! gprolog --entry-goal "consult('./PH_inventory.prolog')"
% phaethon@EGC.prolog
% GNU Prolog.

:- dynamic(maxitemid/1, logtime/1).

% Convenience predicate -- make GNU Prolog stop complaining about deliberate singletons.
ignore(_).

% These predicates affect dynamic predicates.
newitemid(IDnum) :-
  maxitemid(M),
  N is (M+1),
  IDnum is M,
  retractall(maxitemid(_)),
  asserta(maxitemid(N)).

ts(X) :-
  retractall(logtime(_)),
  asserta(logtime(X)).


% Affects dynamic database.

obtain(Giver, Item) :-
  obtain(Giver, Item, []).

obtain(Giver, Count, Item) :-
  number(Count),
  obtain(Giver, Count, Item, []).

obtain(Giver, Item, Descriptions) :-
  newitemid(ID),
  describe(ID, Descriptions),
  logtime(TS),
  assertz(ts(TS, obtain(ID))),
  assertz(item(ID, Item)),
  assertz(blame(ID, Giver)).

obtain(_, 0, _).

obtain(Giver, Count, Item, Descriptions) :-
  number(Count),
  Count > 0,
  obtain(Giver, Item, Descriptions),
  Oneless is (Count-1),
  obtain(Giver, Oneless, Item, Descriptions).  %Recurse!

obtain(_, 0, _, _).

describe(_, []).
describe(ID, [Desc|Rest]) :-
  assertz(attrib(ID, Desc)),
  describe(ID, Rest).


% Inventory listing.

% Determine letter-coding of inventory id number -- probably buggy.
item_header(N, Header) :-
  N > 0,
  N < (1+26),
  Cc is (N + 96),
  char_code(Ch, Cc),
  Header = Ch.

item_header(N, Header) :-
  N > 26,
  N < (1 + 26*2),
  Cc is (N + 64 - 26),
  char_code(Ch, Cc),
  Header = Ch.

item_header(N, Header) :-
  N > (26*2),
  Header = N.


% string.join()
strjoin(ResultString, _, []) :-
  ResultString = "".

strjoin(ResultString, _, [C]) :-
  atomic(C),
  name(C, ResultString)
  ;
  strjoin(ResultString, "", []).

strjoin(ResultString, JoinString, [H|T]) :-
  atomic(H),
  name(H, SrcStr),
  strjoin(RestStr, JoinString, T),
  length(RestStr, Len),
  (Len > 0 -> append(JoinString, RestStr, SuffixStr) ; SuffixStr = RestStr),
  append(SrcStr, SuffixStr, ResultString)
  ;
  strjoin(ResultString, JoinString, T).


% Return string description of item #N (Opts affects description verbosity).
item_line(N, Opts, Line) :-
  item(N, ItemName),
  ignore(Opts),

  findall(X, attrib(N, X), [ItemNoun|ItemAttribs]),
  ignore(ItemNoun),

  strjoin(ItemAttribStr, ", ", ItemAttribs),
  length(ItemAttribStr, IASL),
  (IASL > 0 -> append(" (", ItemAttribStr, S1), append(S1, ")", S2) ; S2 = ""),
  name(ItemAttrib, S2),
  atom_concat(ItemName, ItemAttrib, Line),

  true.


% List description of item #N.
inv_item(N) :-
  maxitemid(Max),
  N < Max,
  item_header(N, ItemHeader),
  write(' '), write(ItemHeader), write(') '),
  item_line(N, [], ItemLine),
  write(ItemLine),
  nl,
  !,
  Next is (N+1),
  inv_item(Next).


% prety-print inventory.
inv :-
  write('Current inventory:'), nl,
  inv_item(1);
  write('(end)\
'),
  true.


% Old inventory listing.
inv0 :- listing(item), listing(blame).


% Run through all transactions to update dynamic database.
:- initialization(transactions).
%:- initialization(init).





% Record of inventory transactions.
transactions :-
  assertz(maxitemid(1)),

  % First item collection
  ts('2007.08.11'),
  obtain('Tyris', 'TF Gun', [tfgun]),
  obtain('Tyris', 'Fish', [fish, dead]),
  obtain('Tyris', 'Squirrel teddy', [teddy, squirrel]),
  obtain('Tyris', 6, 'can of soda', [can, soda, unlabeled]),
  obtain('Tyris', 'red crystal inscribed with TF-gun code for Otter V1', [crystal, red, for(tfgun), tfgun('Otter V1')]),

  ts('2007.08.11'),
  obtain('Kalga', 'yarn ball of distraction', [ball, yarn, distraction]),

  ts('2007.08.11'),
  obtain('Cheez', 'shiny hubcap', [hubcap, shiny]),
  obtain('Cheez', 'can of mackerel', [can, mackerel]),
  obtain('Cheez', 'bag of salt-n-glass cookies', [bag, cookie, salt_n_glass]),

  ts('2007.08.11'),
  obtain('littlebeast', 'Infinite Scroll of Doom-Ish', [scroll, infinite, 'doom-ish']),
  obtain('littlebeast', 'Infinite Pen of Doom-Ish', [pen, infinite, 'doom-ish']),
  obtain('littlebeast', 'DD/RR mod for TF Gun', [dd_rr_mod, 'DD/RR mod', for(tfgun)]),

  ts('2007.08.11'),
  obtain('Jenerix525', 'mirror with silver handle', [mirror, 'silver handle']),
  % Add above this line.
  true.


% After consulting/loading this file:
%
% * To generate inventory list:
%| ?- inv.
Personal tools