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