¿Me podeis ayudar a solucionar esto?
Publicado por Antonio (3 intervenciones) el 07/03/2020 14:02:55
In this game the computer “thinks” in a 4-distinct-digit number [1-9] (“1234” ok, but not “1241”
or “0543”), randomly chosen. The player tries to guess this number through successive attempts.
Each attempt is also a 4-digit number. The machine examines it, answering how many digits are
perfectly placed (correct answer) and how many are present but out of position (half correct
answer).
The player will have 8 attempts to try to win. In the last attempt, you can show the addition of
the four digits as a hint. If you feel 8 attempts too easy or too difficult you can adapt the difficulty
changing this value.
or “0543”), randomly chosen. The player tries to guess this number through successive attempts.
Each attempt is also a 4-digit number. The machine examines it, answering how many digits are
perfectly placed (correct answer) and how many are present but out of position (half correct
answer).
The player will have 8 attempts to try to win. In the last attempt, you can show the addition of
the four digits as a hint. If you feel 8 attempts too easy or too difficult you can adapt the difficulty
changing this value.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script>
var valorposicion=9
let masterMind = "";
function execute() {
let arrayNumeros = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
let posicion = (Math.random()*10)%valorposicion;
masterMind += arrayNumeros[posicion];
array.Numeros.splice(posicion, 0);
valorposicion--;
}
let numerousuario = guardarnumero;
function empezar(number) {
guardarnumero=number;
numeroordenador = masterMind;
if (guardarnumero == numerousuario) {
alert("has acertado")
}
else {
alert("Fallaste");
}
}
Valora esta pregunta


0