almost final
This commit is contained in:
parent
56eca6e9c7
commit
96cb870900
2 changed files with 10 additions and 20 deletions
27
script.js
27
script.js
|
@ -1,8 +1,8 @@
|
|||
const reponse = "TRAIN";
|
||||
const reponse = "train";
|
||||
var word ="";
|
||||
const good_letter_color = "#3fbe00";
|
||||
const bad_letter_color = "#BE0000";
|
||||
const mid_letter_coloer = "#BF8200";
|
||||
const good_letter_color = "#8dc689";
|
||||
const bad_letter_color = "#e57373";
|
||||
const mid_letter_color = "#e3e466";
|
||||
var free_box = [1,1];
|
||||
let arrWords;
|
||||
readTextFile("words.txt");
|
||||
|
@ -37,52 +37,41 @@ function update(x) {
|
|||
document.getElementById(free).innerHTML = x;
|
||||
free_box[1]+=1;
|
||||
}
|
||||
console.log("word",word);
|
||||
console.log("apres",free_box);
|
||||
}
|
||||
|
||||
function Supprimer() {
|
||||
word = word.slice(0,-1);
|
||||
console.log(word);
|
||||
if (free_box[1]==1) {
|
||||
}
|
||||
else {
|
||||
free_box[1]+=-1;
|
||||
}
|
||||
free = free_box.map(num=>{return String(num)}).join("");
|
||||
console.log("freesup",free);
|
||||
document.getElementById(free).innerHTML = "";
|
||||
console.log(free_box);
|
||||
}
|
||||
|
||||
function Enter() {
|
||||
console.log("enter",free_box);
|
||||
|
||||
if (verifWord() && free_box[0]!=6) {
|
||||
|
||||
console.log("he");
|
||||
write_result(verifLettres(word));
|
||||
free_box[0]+=1;
|
||||
free_box[1]=1;
|
||||
word="";
|
||||
}
|
||||
console.log("enter word",word);
|
||||
console.log("enter apres",free_box);
|
||||
}
|
||||
|
||||
function verifLettres(aWord) {
|
||||
function verifLettres() {
|
||||
let verif = [0,0,0,0,0];
|
||||
for(let i=0 ; i<5; i++){
|
||||
if(aWord[i]==reponse[i])
|
||||
{
|
||||
if(word[i]==reponse[i]){
|
||||
verif[i]=2;
|
||||
}
|
||||
else{
|
||||
if(reponse.includes[aWord[i]]){
|
||||
if(reponse.includes(word[i])){
|
||||
verif[i]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(verif);
|
||||
return verif;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ section{ /* Alignement du tableau de jeu */
|
|||
font-weight: bold;
|
||||
font-size:30px;
|
||||
align-items: center;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
footer{ /* Fond et alignement du clavier */
|
||||
|
|
Laden…
Reference in a new issue