Recent

Author Topic: Single deminision arrays(Solved)  (Read 2114 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Single deminision arrays(Solved)
« Reply #15 on: June 21, 2022, 11:27:06 am »
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.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 14204
  • Probably until I exterminate Putin.
Re: Single deminision arrays(Solved)
« Reply #16 on: June 21, 2022, 11:38:34 am »
Might get more complicated than a simple set if more than one deck is involved... or a game has more than one indistinguishable joker.

MarkMLl
Actually not. The logic is the same. Only provision is to identify the deck in the record.
Specialize a type, not a var.

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Single deminision arrays(Solved)
« Reply #17 on: July 05, 2022, 10:18:15 pm »
@Thaddy

No disrespect Thaddy but I don't think a bridge game came be written in less than 200 lines.

I'm at about 3,000 and and probably a 1,000 more line to finish. 
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Single deminision arrays(Solved)
« Reply #18 on: July 05, 2022, 10:22:46 pm »
No disrespect Thaddy but I don't think a bridge game came be written in less than 200 lines.

Thaddy loves a challenge :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018