Crazyplayer.adb

-- Plays in a crazy pattern
-- Can maybe fool some patternmatching

function CrazyPlayer return Move is
   Choice : Integer;
begin
   Choice := MN mod 10;
   Choice := CHoice + (100+Integer(Character'Pos((ON(ON'First)))-Integer(Character'Pos('0')))) mod 10;
   if OL = Cooperate then
      Choice := Choice + 5;
   else
      CHoice := CHoice - 1;
   end if;
   if OS > MS then
      CHoice := Choice - 4;
   end if;
   if abs(Choice rem 10) < 7 then
      return Cooperate;
   else
      return Defect;
   end if;
end CrazyPlayer;

Tillbaka till huvudsidan