im triying to build a mathématique game for my school project work
i have the idea and the desgin but i face a lot of problms in construct
my game exemple
player 1:1286(choose a numbe r with 4 caracter)
player 2: 2359(choose a numbe r with 4 caracter)
every player sould now the number of the other player
if a caracter is equal to the carcter of player 2 it give T if it ecxst but not in his place it give V until one of the player now the number of the other player
)i programe it with pascal and c )
so sorrryyyyy for my bad english
please help me
Develop games in your browser. Powerful, performant & highly capable.
let me quickly recap it, just to be sure:
1.) player one picks a 4 digit number
2.) player two picks a 4 digit number
3.) when any number matches it says "T" (=true?) if not "V" (=false?)
You could achieve that by putting the digits into two arrays, e.g. 1# (1|2|8|6), 2# (2|3|5|9).
Afterwards you check the single places of the array one by one.
I don't understand the rest of the game concept tho.
this is the rules
Each player writes a four-digit number on a piece of paper, taking care to ensure that the other player does not see the number. The digits must all be different. (For example, 4729 would be legal, but 4724 would not be legal.)Determine which player will guess first.
In turn, players try to guess their opponent's number. The opponent responds by announcing the number of matches.
A digit which is in the number but not announced in the correct position is a V." A digit which is in the number and is announced in the correct position is a "T."(or T.V can be sprites or somthing)
EXAMPLE: Andre's secret number is 8045. Beth guesses 0865. There are two V (0 and 8) and one T(5). Andre says, "There are two V and one T Andre does not reveal which digits are the cows and which one is the bull.
Ah, so you are trying to recreate mastermind, but with numbers instead of coloured pins..
I guess using a string for this would do and using tokenAt to see if the number exists in the right place..
Using an array would also be an option..
After the player has guessed you could loop through it to see if the number exists and if so if it´s in the right place..