Implementation of Lucifers Pastime
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.2KB

  1. #!/usr/bin/perl
  2. package main;
  3. use warnings;
  4. use strict;
  5. use lib './';
  6. use LPST;
  7. my $b;
  8. # Move types
  9. my $SUMMON = 0b00000001;
  10. my $MOVE = 0b00000010;
  11. my $CAPTURE = 0b00000100;
  12. my $SACRIFICE = 0b00001000;
  13. # my $SPELL = 0b10000000;
  14. my $DRAW = 0b01000000;
  15. sub mt1($$){
  16. my ($s0, $tc) = (shift, shift);
  17. return $SUMMON if $s0 =~ /\*/;
  18. return $MOVE if $s0 =~ /([A-Za-z]{1,2}[0-9]{1,2}){2}/;
  19. return $CAPTURE if $s0 =~ /\~/;
  20. return $SACRIFICE if $s0 =~ /([A-Za-z]{1,2}[0-9]{1,2}' ?){2}/;
  21. return $DRAW if $tc <= 1;
  22. }
  23. sub f2($$$){
  24. my ($s0, $tc, $apl) = (shift, shift, shift);
  25. my $mt0;
  26. return LPST->P2 if $apl eq LPST->P1;
  27. return LPST->P1;
  28. }
  29. sub f1($){
  30. my $ns0 = shift;
  31. my $apl;
  32. my $tc;
  33. $apl = LPST->P1;
  34. $tc = 0;
  35. for my $s0 (split(/\n/, $ns0)){
  36. # $mt0 = mt1($s0, $tc);
  37. $apl = f2($s0, $tc, $apl);
  38. # printf(">>%s\n", $s0);
  39. $tc++;
  40. }
  41. }
  42. my $ns0;
  43. $ns0 = "";
  44. $ns0 .= "A I It Au\n";
  45. $ns0 .= "H S Im Im\n";
  46. f1($ns0);
  47. my $m1 = "C10";
  48. my $m2 = "B3";
  49. my $c1 = LPST->MG_SY;
  50. my $c2 = LPST->MG_A;
  51. $b = LPST->new();
  52. # $board{$m1} = $P1.$DIV.$c1;
  53. # $board{$m2} = $P2.$DIV.$c2;
  54. # $b->shade_all_p1_mvmt();
  55. $b->disp_board();