home *** CD-ROM | disk | FTP | other *** search
- //⌐ David Jean, 1993
- game calculation is 21 by 18;
-
- // A1 A2 A3 A4
- // B1 B2 B3 B4
- // D1
-
- {--------------------------------------------------------------------------}
-
- #include 'predicat.cdh'
- #include 'stack.cdh'
- #include 'deck.cdh'
-
- {--------------------------------------------------------------------------}
-
- procedure About is
- begin
- Clear 'About Calcul';
- write('Rules from : RΘglements officiels des jeux de cartes, Intl. playing card company limited, 1977.\n');
- write('Program : ⌐ David Jean, 1993.\n');
- end;
-
- procedure ShowSuite is
- begin
- Write('Ace 2 3 4\n');
- Write('2 4 6 8\n');
- Write('3 6 9 Queen\n');
- Write('4 8 Queen 3\n');
- Write('5 10 2 7\n');
- Write('6 Queen 5 Jack\n');
- Write('7 Ace 8 2\n');
- Write('8 3 Jack 6\n');
- Write('9 5 Ace 10\n');
- Write('10 7 4 Ace\n');
- Write('Jack 9 7 5\n');
- Write('Queen Jack 10 9\n');
- Write('King King King King\n');
- Wait 'About...' About;
- end;
-
- stack A1, A2, A3, A4, B1, B2, B3, B4;
-
- var src : stack;
-
- stack D1 is
- X := 2;
- Y := 9;
- Direction := over;
- w := 3;
- h := 4;
- Handler := VCARDS;
- //****************************
- Start is
- begin
- OneDeckUp;
- [0]:=CrossCard;
- end;
- //****************************
- SelectFrom(Spos : Index) is
- if !>0 then
- begin
- Pull 1 to Cursor;
- src:=self;
- end;
- //****************************
- Help is
- begin
- Clear 'The Stock';
- Write('You build The Tableau or the Foundation by dragging cards from here, one by one.\n');
- Wait 'About...' About;
- end;
- end D1;
-
- {--------------------------------------------------------------------------}
-
- stack A1 is
- X := 6;
- Y := 2;
- Direction := over;
- w := 3;
- h := 4;
- Handler := VCARDS;
- //****************************
- Start is MoveFirstFrom(Ace,D1);
- //****************************
- SelectTo(Spos : Index) is
- if !<13 then
- if FollowRankWrapN?(1,[!],Cursor[1]) then
- Pull 1 From Cursor;
- //****************************
- Help is
- begin
- Clear 'Foundations';
- Write('Arithmetic sequences are build here.\n');
- Write('The Suite is not important.\n\n');
- Write('The goal is to bring every sequence to the king.\n\n');
- Wait 'Sequences...' ShowSuite;
- Wait 'About...' About;
- end;
- end A1;
-
- stack A2 from A1 is
- X := 10;
- //****************************
- Start is MoveFirstFrom(Deuce,D1);
- //****************************
- SelectTo(Spos : Index) is
- if !<13 then
- if FollowRankWrapN?(2,[!],Cursor[1]) then
- Pull 1 From Cursor;
- end A2;
-
- stack A3 from A1 is
- X := 14;
- //****************************
- Start is MoveFirstFrom(Three,D1);
- //****************************
- SelectTo(Spos : Index) is
- if !<13 then
- if FollowRankWrapN?(3,[!],Cursor[1]) then
- Pull 1 From Cursor;
- end A3;
-
- stack A4 from A1 is
- X := 18;
- //****************************
- Start is MoveFirstFrom(Four,D1);
- //****************************
- SelectTo(Spos : Index) is
- if !<13 then
- if FollowRankWrapN?(4,[!],Cursor[1]) then
- Pull 1 From Cursor;
- end A4;
-
- {--------------------------------------------------------------------------}
-
- stack B1 is
- X := 6;
- Y := 7;
- Direction := down;
- w := 3;
- h := 11;
- Handler := VCARDS;
- //****************************
- SelectFrom from D1;
- //****************************
- SelectTo(Spos : Index) is
- if src=D1 then Pull 1 from Cursor;
- //****************************
- Help is
- begin
- Clear 'The Tableau';
- Write('You can bring cards from The Stock here.\n\n');
- Write('Only the topmost card can be moved, and only to the Foundation.');
- Wait 'About...' About;
- end;
- end B1;
-
-
- stack B2 from B1 is
- X := 10;
- end B2;
-
- stack B3 from B1 is
- X := 14;
- end B3;
-
- stack B4 from B1 is
- X := 18;
- end B4;
-
- {--------------------------------------------------------------------------}
-
- predicate Integrity? is
- begin
- with it do
- if it!=13 then
- if not IsShaded?(it[it!]) then Turn it[it!] side shaded
- for A1, A2, A3, A4;
- return TRUE;
- end;
-
- predicate Win? is return (A1!=13) and (A2!=13) and (A3!=13) and (A4!=13);
-
- predicate Loose? is
- var n : integer;
- begin
- if D1!>0 then return FALSE;
- n:=1;
- with it do
- begin
- with it2 do
- if it2!>0 then
- if FollowRankWrapN?(n,it[it!],it2[it2!]) then return FALSE
- for B1, B2, B3, B4;
- n:=n+1;
- end
- for A1, A2, A3, A4;
- return TRUE;
- end;
-
- order B1, B2, B3, B4, D1, A1, A2, A3, A4;
- title:='Calcul'.
-