diff --git a/Script.js b/Script.js index deed9bf..1dd01bb 100644 --- a/Script.js +++ b/Script.js @@ -112,6 +112,7 @@ async function nextMove(row,col){ return true } nextobject.classList.remove("Path"); + nextobject.classList.add("wrong"); } return false } @@ -121,7 +122,7 @@ function nonWall(row,col){ for(let i=0;i=0 && nextvalue[i][1]>=0){ let object=document.getElementById((nextvalue[i][0])+","+(nextvalue[i][1])); - if(!(object.classList.contains('wall'))&& !(object.classList.contains('Path'))){ + if(!(object.classList.contains('wall'))&& !(object.classList.contains('Path'))&& !(object.classList.contains('wrong'))){ NoWalls.push([nextvalue[i][0],nextvalue[i][1]]) } } @@ -161,6 +162,12 @@ function resetall(){ objects=document.querySelectorAll(".Path"); objects.forEach((elemant)=>{ elemant.classList.remove('Path') + + }) + objects=document.querySelectorAll(".wrong"); + objects.forEach((elemant)=>{ + elemant.classList.remove('wrong') + }) } } diff --git a/style.css b/style.css index 49dc005..3b406df 100644 --- a/style.css +++ b/style.css @@ -50,7 +50,7 @@ h1{ background-color: green !important; } .Path{ - background-color: yellow !important; + background-color: yellow; animation: pathinsert .4s ease-in-out forwards ; } @@ -102,4 +102,7 @@ h1{ } .solver:active{ transform: scale(0.96); + } + .wrong{ + background-color: rgb(255, 201, 201) !important; } \ No newline at end of file