home *** CD-ROM | disk | FTP | other *** search
- //⌐ David Jean, 1993
- game royal is 29 by 24;
-
- // A1 C1 K1 B1 B2 B3
- // A2 C2 K2
- // A3 C3 K3
- // A4 C4 K4 D1 D2
-
- {--------------------------------------------------------------------------}
-
- #include 'predicat.cdh'
-
- {--------------------------------------------------------------------------}
-
- procedure About is
- begin
- Clear 'About Royal Families';
- write('Rules from : RΘglements officiels des jeux de cartes, Intl. playing card company limited, 1977.\n');
- write('Program : ⌐ David Jean, 1993.\n');
- end;
-
- #include 'rightbut.cdh'
-
- stack D2, A1, A2, A3, A4, C1, C2, C3, C4, K1, K2, K3, K4, B1, B2, B3;
-
- stack D1 is
- X := 11;
- Y := 19;
- Direction := over;
- w := 3;
- h := 4;
- Handler := VCARDS;
- //****************************
- Start is
- begin
- Add Three+Spade .. King+Spade;
- Add Three+Heart .. King+Heart;
- Add Three+Club .. King+Club;
- Add Three+Diamond .. King+Diamond;
- Turn [1..!] side down;
- Shuffle;
- Add Deuce+Diamond;
- Add Deuce+Club;
- Add Deuce+Heart;
- Add Deuce+Spade;
- Add Ace+Diamond;
- Add Ace+Club;
- Add Ace+Heart;
- Add Ace+Spade;
- [0]:=CrossCard;
- end;
- //****************************
- SelectLeftFrom(Spos : Index) is
- if !>0 then
- begin
- Pull 1 to D2;
- Turn D2[D2!] side up;
- end;
- //****************************
- Help is
- begin
- Clear 'The Stock';
- Write('You can click here to move a card to The Waste Pile.\n');
- Wait 'About...' About;
- end;
- end D1;
-
- stack D2 is
- X := 17;
- Y := 19;
- Direction := over;
- w := 3;
- h := 4;
- Handler := VCARDS;
- //****************************
- Start is
- begin
- Pull 1 from D1;
- Turn [1] side up;
- end;
- //****************************
- SelectLeftFrom(Spos : Index) is
- if !>0 then
- Pull 1 To Cursor;
- //****************************
- SelectRightFrom(Spos : Index) is
- if !>0 then
- begin
- Pull 1 to Cursor;
- PollLeftTo(|K1,K2,K3,K4,A1,A2,A3,A4,C1,C2,C3,C4|);
- PollLeftToNE(|B1,B2,B3|);
- PollLeftTo(|B1,B2,B3|);
- end;
- //****************************
- Help is
- begin
- Clear 'The Waste Pile';
- Write('The topmost card of this pile is available to play on The Tableau or The Foundation.\n\n');
- Write('You can Drag cards from here by using the left mouse button.\n');
- Wait 'Right Button...' RButton;
- Wait 'About...' About;
- end;
- end D2;
-
- {--------------------------------------------------------------------------}
-
- stack A1 is
- X := 2;
- Y := 2;
- Direction := over;
- w := 3;
- h := 4;
- Handler := VCARDS;
- //****************************
- Start is
- begin
- Pull 1 From D1;
- Draw D1;
- end;
- //****************************
- SelectLeftTo(Spos : Index) is
- if SameSuit?(Cursor[1],[!]) and
- FollowRankN?(2,[!],Cursor[1]) then
- Pull 1 From Cursor;
- //****************************
- Help is
- begin
- Clear 'Odd Foundations';
- Write('Plays are made to the Foundations in the same suit and in ascending order ');
- Write('of odd cards, Ace, Three, Five, Seven, Nine, Jack.\n\n');
- Write('The goal is to move all 52 cards to the Foundations.\n');
- Wait 'About...' About;
- end;
- end A1;
-
- stack A2 from A1 is
- X := 26;
- Y := 2;
- end A2;
-
- stack A3 from A1 is
- X := 2;
- Y := 20;
- end A3;
-
- stack A4 from A1 is
- X := 26;
- Y := 20;
- end A4;
-
- {--------------------------------------------------------------------------}
-
- stack C1 from A1 is
- X := 6;
- Y := 2;
- //****************************
- Help is
- begin
- Clear 'Even Foundations';
- Write('Plays are made to the Foundations in the same suit and in ascending order ');
- Write('of Even cards, Deuce, Four, Six, Eight, Ten, Queen.\n\n');
- Write('The goal is to move all 52 cards to the Foundations.\n');
- Wait 'About...' About;
- end;
- end C1;
-
- stack C2 from C1 is
- X := 22;
- Y := 2;
- end C2;
-
- stack C3 from C1 is
- X := 6;
- Y := 20;
- end C3;
-
- stack C4 from C1 is
- X := 22;
- Y := 20;
- end C4;
-
- {--------------------------------------------------------------------------}
-
- stack K1 from A1 is
- X := 2;
- Y := 7;
- //****************************
- Start is
- [0]:=King+Spade+Shaded*DeckSize;
- //****************************
- SelectLeftTo(Spos : Index) is
- if SameCard?(Cursor[1],[0]) then
- Pull 1 From Cursor;
- //****************************
- Help is
- begin
- Clear 'Kings Foundations';
- Write('Kings are played here.\n');
- Write('They are grey at first to indicate wich King to move here.\n\n');
- Write('The goal is to move all 52 cards to the Foundations.\n');
- Wait 'About...' About;
- end;
- end K1;
-
- stack K2 from K1 is
- X := 26;
- Y := 7;
- //****************************
- Start is
- [0]:=King+Heart+Shaded*DeckSize;
- end K2;
-
- stack K3 from K1 is
- X := 2;
- Y := 15;
- //****************************
- Start is
- [0]:=King+Club+Shaded*DeckSize;
- end K3;
-
- stack K4 from K1 is
- X := 26;
- Y := 15;
- //****************************
- Start is
- [0]:=King+Diamond+Shaded*DeckSize;
- end K4;
-
- {--------------------------------------------------------------------------}
-
- stack B1 is
- X := 10;
- Y := 3;
- Direction := down;
- w := 3;
- h := 15;
- Handler := VCARDS;
- //****************************
- Start is
- begin
- Pull 1 From D1;
- Turn [1] Side Up;
- end;
- //****************************
- SelectLeftFrom(Spos : Index) is
- if !>0 then
- Pull 1 to Cursor;
- //****************************
- SelectLeftTo(Spos : Index) is
- if (!=0) or
- (SameSuit?([!],Cursor[1]) and
- FollowRankN?(2,Cursor[1],[!])) then
- Pull 1 From Cursor;
- //****************************
- SelectRightFrom from D2;
- //****************************
- Help is
- begin
- Clear 'The Tableau';
- Write('Each card played here must be in descending sequence and of the same suit ');
- Write('to the card on which it is played. They also must be both odd or even.\n\n');
- Write('The bottommost card can be played to The Foundation.\n\n');
- Write('Any card can be moved in an empty spot on The Tableau.\n');
- Wait 'Right Button...' RButton;
- Wait 'About...' About;
- end;
- end B1;
-
-
- stack B2 from B1 is
- X := 14;
- Y := 3;
- end B2;
-
- stack B3 from B1 is
- X := 18;
- Y := 3;
- end B3;
-
- {--------------------------------------------------------------------------}
-
- predicate Win? is
- return (A1!=6) and (A2!=6) and (A3!=6) and (A4!=6) and
- (C1!=6) and (C2!=6) and (C3!=6) and (C4!=6) and
- (K1!=1) and (K2!=1) and (K3!=1) and (K4!=1);
-
- predicate Loose? is
- begin
- if D1!>0 then return FALSE;
- with it do
- if it!>0 then
- if IsKing?(it[it!]) then return FALSE
- else
- with it2 do
- if (SameSuit?(it[it!],it2[it2!]) and
- FollowRankN?(2,it2[it2!],it[it!])) then
- return FALSE
- for A1, A2, A3, A4, C1, C2, C3, C4
- for B1, B2, B3, D2;
- with it do
- if it!>0 then
- with it2 do
- if it2<>it then
- if it2!=0 then return FALSE
- else if (SameSuit?(it[it!],it2[it2!]) and
- FollowRankN?(2,it[it!],it2[it2!])) then return FALSE
- for B1, B2, B3
- for D2, B1, B2, B3;
- return TRUE;
- end;
-
- order D1, A1, A2, A3, A4, C1, C2, C3, C4, K1, K2, K3, K4, D2, B1, B2, B3;
- title:='Royal Families'.
-