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?
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.
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)
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.