M
M
MapKyuJa2016-04-18 19:12:13
Pascal
MapKyuJa, 2016-04-18 19:12:13

Need advice on PascalABC.NET?

I want to write poker in pascal.
The essence of the question is that I want to make it so that after the distribution, I automatically get a message in which my combination of cards is written. There is an idea how to do this, create several arrays in which the combination is written (the first will be a street, since roughly speaking it is a relatively basic combination (street, straight flush, royal flush)) so there are 9 all possible straights in total (5 cards in a row) then there are 9 arrays and now I substitute 5 cards from the table and 2 of my own into another 1 array, after that I start comparing all the arrays. This is my idea.
But it seems to me that you can make it a bit easier using a two-dimensional array, that is, comparing strings with my array.
And at the same time you can ask, I made a part of the code and I want to know how it looks from the point of view of an IT specialist, that is, is it accurate (I myself am a 9th grade student Pascal began to learn relatively recently)

//Покер\\
uses crt;
var

      urpok1: array [1..2] of string ;
      urpok2: array [1..2] of string ;
      urpok3: array [1..2] of string ;
      urpok4: array [1..2] of string ;
      koloda: Array [1..52] Of string = ('2♣','3♣','4♣','5♣','6♣','7♣','8♣','9♣','10♣','J♣','Q♣','K♣','A♣','2♠','3♠','4♠','5♠','6♠','7♠','8♠','9♠','10♠','J♠','Q♠','K♠','A♠','2♦','3♦','4♦','5♦','6♦','7♦','8♦','9♦','10♦','J♦','Q♦','K♦','A♦','2♥','3♥','4♥','5♥','6♥','7♥','8♥','9♥','10♥','J♥','Q♥','K♥','A♥');
                                  //Переменный для тосовки\\
                                  Tocovka,Tosovka1:integer;
                                  //Переменный для раздачи\\
                                  a,a1:integer;
   
begin  
//write('Колода',koloda);
                                  //Тосовка колоды\\  
                                  randomize;
                                  for Tocovka:=0 to 51 do 
                                  begin
                                  Tosovka1:=random(52-Tocovka)+1;
                                  swap(koloda[Tosovka1],koloda[52-Tocovka]);
                                  end;
                                  
                                  //Раздача карт\\  
                                  a1:=0;
                                  for a:=1 to 2 do begin
                                  
                                  urpok1[a]:=koloda[52-a1];
                                  a1:=a1+1;
                                  urpok2[a]:=koloda[52-a1];
                                  a1:=a1+1;                                  
                                  urpok3[a]:=koloda[52-a1];
                                  a1:=a1+1;
                                  urpok4[a]:=koloda[52-a1];                                 
                                  a1:=a1+1;
                                  end;
                                  writeln('Моя рука ',urpok1);
  
  
  
                                  //Стол\\
                                  writeln('Стол');
                                  writeln(koloda[44],'  ',koloda[43],'  ',koloda[42]);  
                                 
  
  
  
writeln;

writeln('Рука второго ',urpok2);
writeln('Рука третьего',urpok3);
writeln('Рука четвертого',urpok4);
writeln;
writeln;
writeln;
writeln;
write('вся колода после перемешки ',koloda);
writeln;


end.

And yes, I know that the piscal for games is not quite suitable, I write for myself, I thought they would understand the language better, but it turned out that it was quite simple, with the exception of combinations (as it seems to me)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Fedoryan, 2016-04-19
@AnnTHony

Unfortunately, I don't know the rules of poker.
But instead of an array for the deck, I would use a queue:
koloda: Queue<string>;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question