Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: word is undefined' in or related to this line: 'var wordShuffled = wordShuffled = word.split('').sort(function () {' Line Number: 495
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: pickAndShakeSingleWord is not defined' in or related to this line: 'var word = pickAndShakeSingleWord().word;' Line Number: 495
Code edit (6 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: maingrid is not defined' in or related to this line: 'if (maingrid) {' Line Number: 547
Code edit (1 edits merged)
Please save this source code
Code edit (18 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: clueButton is null' in or related to this line: 'clueButton = new Button('', {' Line Number: 433
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'y')' in or related to this line: 'var validateButton = new Button('', {' Line Number: 302
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'width')' in or related to this line: 'self.width = options.width || 200;' Line Number: 56
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: wordsMainList is undefined' in or related to this line: 'var randomIndex = Math.floor(Math.random() * wordsMainList.length);' Line Number: 382
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: word is undefined' in or related to this line: 'var wordShuffled = word.split('').sort(function () {' Line Number: 394
User prompt
Please fix the bug: 'TypeError: liste is undefined' in or related to this line: 'var randomIndex = Math.floor(Math.random() * liste.length);' Line Number: 390
Code edit (9 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -189,15 +189,15 @@
}; //Fin de la fonction removeLetter
self.addWord = function (word) {
// Add a word in the list of words
self.words.push(word);
- scoreTest = "Nb mots : " + self.words.length;
+ scoreTest = "Nb mots : " + self.words.length + " wordsMainList : " + wordsMainList.length;
}; //Fin de la fonction addWord
self.removeWord = function (word) {
// Remove a word from the list of words
if (self.words.includes(word)) {
self.words.splice(self.words.indexOf(word), 1);
- scoreTest = "Nb mots : " + self.words.length;
+ scoreTest = "Nb mots : " + self.words.length + " wordsMainList : " + wordsMainList.length;
}
}; //Fin de la fonction removeWord
self.isFull = function () {
for (var i = 0; i < self.gridLines; i++) {
@@ -271,9 +271,10 @@
****/
//var wordsMainListTest = ["AARDVARK", "ALBATROSS", "ALLIGATOR", "ALPACA", "ANT"]; //The real main list is at the end
var usaStates = ["ALABAMA", "ALASKA", "ARIZONA", "ARKANSAS", "CALIFORNIA", "COLORADO", "CONNECTICUT", "DELAWARE", "FLORIDA", "GEORGIA", "HAWAII", "IDAHO", "ILLINOIS", "INDIANA", "IOWA", "KANSAS", "KENTUCKY", "LOUISIANA", "MAINE", "MARYLAND", "MASSACHUSETTS", "MICHIGAN", "MINNESOTA", "MISSISSIPPI", "MISSOURI", "MONTANA", "NEBRASKA", "NEVADA", "NEW-HAMPSHIRE", "NEW-JERSEY", "NEW-MEXICO", "NEW-YORK", "NORTH-CAROLINA", "NORTH-DAKOTA", "OHIO", "OKLAHOMA", "OREGON", "PENNSYLVANIA", "RHODE-ISLAND", "SOUTH-CAROLINA", "SOUTH-DAKOTA", "TENNESSEE", "TEXAS", "UTAH", "VERMONT", "VIRGINIA", "WASHINGTON", "WEST-VIRGINIA", "WISCONSIN", "WYOMING"];
var europeanCapitales = ["AMSTERDAM", "ANDORRA-LA-VELLA", "ANKARA", "ATHENS", "BELGRADE", "BERLIN", "BERN", "BRATISLAVA", "BRUSSELS", "BUCHAREST", "BUDAPEST", "CHISINAU", "COPENHAGEN", "DUBLIN", "HELSINKI", "KIEV", "LISBON", "LJUBLJANA", "LONDON", "LUXEMBOURG", "MADRID", "MINSK", "MONACO", "MOSCOW", "NICOSIA", "OSLO", "PARIS", "PODGORICA", "PRAGUE", "REYKJAVIK", "RIGA", "ROME", "SAN-MARINO", "SARAJEVO", "SKOPJE", "SOFIA", "STOCKHOLM", "TALLINN", "TBILISI", "TIRANA", "VADUZ", "VALLETTA", "VIENNA", "VILNIUS", "WARSAW", "ZAGREB"];
-var planetesNsatellites = ["SUN", "MERCURY", "VENUS", "EARTH", "MOON", "MARS", "PHOBOS", "DEIMOS", "JUPITER", "IO", "EUROPA", "GANYMEDE", "CALLISTO", "SATURN", "TITAN", "MIMAS", "ENCELADUS", "TETHYS", "DIONE", "RHEA", "HYPERION", "LAPETUS", "PHOEBE", "URANUS", "PUCK", "MIRANDA", "ARIEL", "UMBRIEL", "TITANIA", "OBERON", "NEPTUNE", "TRITON", "PROTEUS", "NEREID", "PLUTO", "CHARON"];
+//var planetesNsatellites = ["SUN", "MERCURY", "VENUS", "EARTH", "MOON", "MARS", "PHOBOS", "DEIMOS", "JUPITER", "IO", "EUROPA", "GANYMEDE", "CALLISTO", "SATURN", "TITAN", "MIMAS", "ENCELADUS", "TETHYS", "DIONE", "RHEA", "HYPERION", "LAPETUS", "PHOEBE", "URANUS", "PUCK", "MIRANDA", "ARIEL", "UMBRIEL", "TITANIA", "OBERON", "NEPTUNE", "TRITON", "PROTEUS", "NEREID", "PLUTO", "CHARON"];
+var planetesNsatellites = ["SUN", "MERCURY", "VENUS", "EARTH", "MOON", "MARS"];
var scoreTest = 0; // Define scoreTest variable
var score = 0;
/****
* Game zones and backgrounds
@@ -371,9 +372,9 @@
game.addChild(backGroundImage);
} //Fin de la fonction setBackGroundImage
//Fonction onClickValidateButton : permet de valider le mot formé par le joueur
function onClickValidateButton() {
- if (validateWord(wordsMainList)) {
+ if (validateWord(mainGrid.words)) {
//On vide la grille des lettres formant le mot final apres x secondes
LK.setTimeout(function () {
wordGrid.resetGrid();
initWordGrid();
@@ -474,11 +475,18 @@
//Fonction pickAndShakeSingleWord : permet de choisir un mot dans la liste des mots et de le mélanger
function pickAndShakeSingleWord() {
var randomIndex = Math.floor(Math.random() * wordsMainList.length);
var word = wordsMainList[randomIndex];
- var wordShuffled = wordShuffled = word.split('').sort(function () {
+ if (!word) {
+ return {
+ word: '',
+ wordShuffled: ''
+ };
+ }
+ var wordShuffled = word.split('').sort(function () {
return 0.5 - Math.random();
}).join('');
+ wordsMainList.splice(randomIndex, 1); //Retire le mot de la liste principale pour ne pas le reprendre
return {
word: word,
wordShuffled: wordShuffled
};
@@ -487,10 +495,11 @@
function pickAndShakeWords(numberOfWords) {
var words = [];
var wordsShuffeled = [];
for (var i = 0; i < numberOfWords; i++) {
- var word = pickAndShakeSingleWord().word;
- var shuffledWord = pickAndShakeSingleWord().wordShuffled;
+ var wordSingle = pickAndShakeSingleWord();
+ var word = wordSingle.word;
+ var shuffledWord = wordSingle.wordShuffled;
words.push(word);
wordsShuffeled.push(shuffledWord);
}
return {
@@ -521,9 +530,9 @@
for (var i = 0; i < wordGrid.gridColumns; i++) {
word += wordGrid.cells[0][i].letter;
}
if (liste.includes(word)) {
- wordGrid.addWord(word); //Archive le mot
+ wordGrid.addWord(word); //Archive les mots trouves
mainGrid.removeWord(word); //Retire le mot de la grille principale
score += word.length;
isWordValid = true;
} else {
@@ -585,20 +594,19 @@
//mot(s) est choisi au hasard dans la liste principale,
//il est mélangé et les lettres sont directement ajoutées à la grille principale avec la fonction addRandomLetter
if (mainGrid.isEmpty() && !isGameStarted) {
var wordsToBegin = pickAndShakeWords(1).words;
- var wordsShuffeledToBegin = pickAndShakeWords(1).wordsShuffeled;
- var wordCompiled = "";
- for (var i = 0; i < wordsShuffeledToBegin.length; i++) {
- wordCompiled += wordsShuffeledToBegin[i];
- }
- if (wordCompiled.length > 0) {
- for (var i = 0; i < wordCompiled.length; i++) {
- mainGrid.addRandomLetter(wordCompiled[i]);
+ for (var i = 0; i < wordsToBegin.length; i++) {
+ var isPossibleToAddletter = true;
+ for (var j = 0; j < wordsToBegin[i].length && isPossibleToAddletter; j++) {
+ isPossibleToAddletter = mainGrid.addRandomLetter(wordsToBegin[i][j]);
}
- isGameStarted = true;
- isMGRefillrequired = false;
+ if (isPossibleToAddletter) {
+ mainGrid.addWord(wordsToBegin[i]);
+ }
}
+ isGameStarted = true;
+ isMGRefillrequired = false;
}
//Chargement d'un mot mélangé dans la grille principale si demandé (isMGRefillrequired = true) et fin de partie
if (isMGRefillrequired) {
if (!putRandomShuffledWordInGrid()) {
An empty cell.
Drapeau national des USA en fond d'un patchwork des États américains.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Une jeton de scrabble sans lettre.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Un bouton arrondi suggérant une validation mais sans texte écrit dessus.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A round button with a cyan interrogation mark.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A round cyan button with a yellow lamp bulb.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Planetes.
Remove the white square and the red lines.
A patchwork of european countries with the european unio flag in back ground.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A yellow coin wher we can see '+10' written on it.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A red coin wher we can see '-10' written on it... Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Patchwork of heads of plenty animals.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
The periodic table of the elements.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Patchwork de mots sur un fond cyan.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Patchwork of scene extracted from video games.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
It is written "COOL QUIZZ".
A cyan circle button with a home silhouette in the center. The button means "go back to start window". Avoid white color.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.