I am making a small game, just to sharpen up my Delphi knowledge before school starts again, and also to show of to my friends. So in this game I have five integers and I need to check if at least three of them equal each other. How would I do this without checking every single possible combination of equal variables?

Use an array with those five integers, so you can loop it. Then make a function to count distinct values. One of them should have a count of three or more.

Okay, so we haven't actually done arrays in school yet. How do they work? My game is a poker type game. I have vars A, B, C, D and E and they can each have a value between one and six. I have a button for each possible combination (3 of a kind, 4 of a kind, 5 of a kind, full house, small straight, large straight). When a button is clicked it must check if they have said combination and give them some points and if not, it must give them a zero.

Okay so im going to loop the array and let it count all the ones, twos, threes, fours, fives and sixes, and then check if one of the counts are equal to three or more?

I'm kind off struggling to figure it out. Right now I have to arrays. One array is aDiceScores and it's range is 1 to 5. It stores the count of each dice. Then I have an array aCount that's from 1 to 6. aCount should count how many variables in aDiceScores are the same. What would be my code for this? Also, what would be the code to actually calculate the score? (It should be the sum of the 3 vars that are the same)

for each aCount
set to zero
for each aDiceScore
increment aCount[aDiceScore]
for each aCount, index 1..6
if aCount[index] >= 3
score = aCount[index] * index

Okay thanks I got it! Just the last part, what am I supposed to do where you say index?

This is what I have:

for K := 1 to 6 do
aCount[K] := 0;
for K := 1 to 5 do
Inc(aCount[aDiceScores[K]]);
for K := 1 to 6 do
if aCount[index] >= 3 then
iScore := aCount[K] * 3;

I've fixed it, but now my problem is that when the player gets 4 of the same, but they have already used that option, and they put it in 3 of a kind, they still get the score for all 4 of the same dices, where the should only get three.

The problem when I do that is that if the user has four, but chooses three of a kind, it doesn't work and gives him a zero. For example you roll a four 6s, but you have already previously used four of a kind, and can only use each option once. Now if you select the three of a kind it gives you zero, instead of 18.

for K := 1 to 6 do
if aCount[K] >= myVariable then
begin
iScore := aCount[K] * myVariable;
Break; // get out of the loop, to avoid further processing
end;

This is my code, but it still isn't right somewhere. It results a nine when there are three 2s for example.

for K := 1 to 6 do
aCount[K] := 0;
for K := 1 to 5 do
Inc(aCount[aDiceScores[K]]);
for K := 1 to 6 do
if aCount[K] >= 3 then begin
iScore3Kind := aCount[K] * 3;
Break;
end;

for K := 1 to 6 do
if aCount[K] >= myVariable then
begin
iScore := K * myVariable; // <-- here was the problem, multiply by K, not the value of K
Break;
end;

I'm trying to compare 2 different CSV files, mark those differences respectively, then produce it as an output. However, my code seems to be only reading the last part of ...

I am becoming confused with visual studio v. Vb.net. I am findings hundreds of pieces of code tells me how to connect. Snippets elsewhere that tell me how to access ...