Graphics Game Dev C++ – Bingo

Welcome to Bingo
The first is to introduce the game, the computer will randomly out a different 4-digit number
Your task is to enter the numbers, the computer will show you
the correct number of digits and the correct number of locations
If you enter a number that matches the number that the computer randomly issued
Then you win the game, keeping in mind that you only have up to 14 times to enter
Try to deduce the least number of times. Good luck!
First we will try to enter the simplest number 1234
Notice that there are 2 correct numbers and 2 correct positions
We still do not know what to do
We will try again with the number 5678. We see that there are two correct numbers and one correct position
Then figure out the 4 numbers you need in these 8 numbers
I will try on 1267
Notice that only one number is true
We will try again
Try with 34 at the end. 5734, only 2 numbers
Continue to 6834
We have four numbers and two numbers in the right place
Notice that the number 34 is always in place, we will swap 6 for 8
8634 and won the game!
We will try again
Let’s try with 1234
There are 3 numbers right, 0 position right
We keep 123, select number 5, but we will reverse position
3512. Fortunately for 4 numbers
We must turn the position to get the right position
No. 1234 has no valid location
We can not see the first 2, can not be in the second, third can not be in the third
Too little, try with 3125
No position is right
Assume the number one is in the third position, and the number one in the right place
No. 3 was wrong, so 2 or 5 was right
Let’s try for position 5
We have the number 2513
We try to enter
Winning the game
Thank you for watching

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *