I'm programming a Yahtzee type game, but I have a problem checking for the different scoring types. So far I have everything but Full House, Small Straight and Large straight. It works like this: There are 5 variables (the dice) that are randomized to something between 1 and 6 every roll. I need to figure out a way to check if 1) Two of the variables are the same and three of the variables are also the same but a different number (Full House). Then I need to check if there are 4 variables in sequence (1,2,3,4 for example)(small Straight). Finally I need to check if all 5 are in sequence (large straight). How would I do this? Each of those have their own procedure, I just need to know what to put in there because after struggling a bit I can't seem to figure it out.
Thanks for any help.

For the straight, I got this code, but it doesn't work. Can somebody tell me what's wrong?

var
counter, min, look, K : integer;
temp, iSequence : integer;

  for counter:=1 to Top do begin
    min:=counter;
    for look:=counter+1 to top do
      if aDiceScores[look]<aDiceScores[min] then min:=look;
    temp:= aDiceScores[min];
    aDiceScores[min]:=aDiceScores[counter];
    aDiceScores[counter]:=temp;
  end;

 iSequence := 0;
 for K := 1 to 5 do
    if aDiceScores[K] + 1 = aDiceScores[K + 1]
    then inc(iSequence);


  if iSequence = 5 then
  iScoreLarge := 40;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.