is there a way to declare an static single dimension array as 1 base Say 1..13 as opposed to 0 based 0..12
is there a way to declare an static single dimension array as 1 base Say 1..13 as opposed to 0 based 0..12
That didn't work. Got an error 'unit1.pas(334,38) Fatal: Syntax error, "=" expected' but ";" found on Const Deck : Array[1..52] of Integer; It looks like it looking for values in the array elements.
Deck : Array[1..52] of CardRecords;
South : Array[1..13] of integer;
North : Array[1..13] of integer;
East : Array[1..13] of integer;
West : Array[1..13] of integer;
The Deck array holds a record with card attributes, suit, position ect.
The North, South,East and West represent the hands at a bridge table. The integers
in the hand arrays could be an integer value of 1..52 and would be a card of the Deck.
I need to change the values in al 5 arrays while playing a hand of bridge.
Is there a way to have a static array that is 1 based as opposed to 0 based?
No, I never considered sets. I have a array of records.That would be ill informed for a card game (for lack of an abusive term) because for a card game you can use include/exclude, so the set will represent the cards that are still in the deck or already played. If you write a card game, sets are the way to go.
No, I never considered sets. I have a array of records.That would be ill informed for a card game (for lack of an abusive term) because for a card game you can use include/exclude, so the set will represent the cards that are still in the deck or already played. If you write a card game, sets are the way to go.
E.g. Poker can be written in less than 100 lines using sets. Bridge a bit more, but that is just handling logic, so does not count to your problem.
An array of records can be handled with e.g. the sets in rtl-generics.
Might get more complicated than a simple set if more than one deck is involved... or a game has more than one indistinguishable joker.Actually not. The logic is the same. Only provision is to identify the deck in the record.
MarkMLl
No disrespect Thaddy but I don't think a bridge game came be written in less than 200 lines.