anchor.diff:  eval(_Turn, _SpellBacklog, #state{player=#life{hp=HP, mana=Mana}, cmana=CMana})
     when Mana =< 0 orelse HP =< 0 ->
       {lose, CMana};
  -eval(player, SpellBacklog, St0) ->
  +eval(player, SpellBacklog, #state{player=#life{hp=OldPHP}=P0,
  +                                  hard_mode=HM}=St00) ->
  +    St0 = case HM of
  +              true ->
  +                  NewPlayer = P0#life{hp=OldPHP-1},
  +                  St00#state{player=NewPlayer};
  +              false ->
  +                  St00
  +          end,
       St = apply_effects(St0),
       St1 = case SpellBacklog of
                 [] ->
  
positive.code:                  poison, magic_missile],
      eval(player, SpellList, St).
  
  perm() ->
      Player = #life{hp=50, mana=500},
      Boss = #life{hp=?bosshits},
      St = #state{player=Player, boss=Boss, effects=[], cmana=0},
      Start = [[poison], [recharge], [shield], [magic_missile], [drain]],
      Perms = perm1(Start, 8),
      Answers = [eval(player, Perm, St) || Perm <- Perms],
      lists:sort([X || {win, X} <- Answers]).
  
  perm1(Lss, 0) ->
      Lss;
  perm1(Lss, Level) ->
      NewLss = [Ls ++ [X]
                || X <- [poison, recharge, shield, magic_missile, drain],
                   Ls <- Lss],
      perm1(NewLss, Level-1).
  
  eval(_Turn, _SpellBacklog, #state{boss=#life{hp=BossHP}, cmana=CMana})
    when BossHP =< 0 ->
  
negative.code: 
  -define(debug, false).
  
  -export([test/0, run/1]).
  
  -record(life, {hp :: integer(),
                 mana :: integer()}).
  