Create a function that when startBtn is clicked, it looks at the chosen radio in (1), (easy and hard either can be chosen) and if the easy is chosen the parameter for addTable (2) is EASY[getRandomNumber()] and if it is hard then HARD[getRandomNumber()] 1. <div class="flex justify-center space-x-4 border p-4 rounded-md"> <labelclass="difficulty-option"> <inputtype="radio"name="difficulty"value="easy"class="hidden"/> <spanclass="difficulty-button">5 x 5 (Easy)</span> </label> <labelclass="difficulty-option"> <inputtype="radio"name="difficulty"value="hard"class="hidden"/> <spanclass="difficulty-button">7 x 7 (Hard)</span> </label> </div> 3. There are arrays called EASY, HARD 2. function addTable(matrix) { consttable=document.createElement("table"); for (leti=0; i<matrix.length; i++) { constrow=document.createElement("tr"); for (letj=0; j<matrix[i].length; j++) { constcell=document.createElement("td"); constimg=generator(matrix[i][j]); cell.appendChild(img); row.appendChild(cell); } table.appendChild(row); } map.appendChild(table); } startBtn.addEventListener('click', startGame) // HELPER FUNCTIONS function startGame(){ menuDiv.style.display='none' gameDiv.style.display='block' rulesDiv.style.display='none' ldrDiv.style.display='none' document.querySelector('#name').innerHTML="ROUTE DESIGNER: "+nameInput.value startTime=Date.now(); timerInterval=setInterval(updateTimer, 1000); } function getRandomNumber() { returnMath.floor(Math.random() *5); }
Create a function that when startBtn is clicked, it looks at the chosen radio in (1), (easy and hard either can be chosen) and if the easy is chosen the parameter for addTable (2) is EASY[getRandomNumber()] and if it is hard then HARD[getRandomNumber()] 1. <div class="flex justify-center space-x-4 border p-4 rounded-md"> <labelclass="difficulty-option"> <inputtype="radio"name="difficulty"value="easy"class="hidden"/> <spanclass="difficulty-button">5 x 5 (Easy)</span> </label> <labelclass="difficulty-option"> <inputtype="radio"name="difficulty"value="hard"class="hidden"/> <spanclass="difficulty-button">7 x 7 (Hard)</span> </label> </div> 3. There are arrays called EASY, HARD 2. function addTable(matrix) { consttable=document.createElement("table"); for (leti=0; i<matrix.length; i++) { constrow=document.createElement("tr"); for (letj=0; j<matrix[i].length; j++) { constcell=document.createElement("td"); constimg=generator(matrix[i][j]); cell.appendChild(img); row.appendChild(cell); } table.appendChild(row); } map.appendChild(table); } startBtn.addEventListener('click', startGame) // HELPER FUNCTIONS function startGame(){ menuDiv.style.display='none' gameDiv.style.display='block' rulesDiv.style.display='none' ldrDiv.style.display='none' document.querySelector('#name').innerHTML="ROUTE DESIGNER: "+nameInput.value startTime=Date.now(); timerInterval=setInterval(updateTimer, 1000); } function getRandomNumber() { returnMath.floor(Math.random() *5); }
Chapter16: Graphics
Section: Chapter Questions
Problem 14RQ
Related questions
Question
Create a function that when startBtn is clicked, it looks at the chosen radio in (1), (easy and hard either can be chosen) and if the easy is chosen the parameter for addTable (2) is EASY[getRandomNumber()] and if it is hard then HARD[getRandomNumber()]
1.
<div class="flex justify-center space-x-4 border p-4 rounded-md">
<labelclass="difficulty-option">
<inputtype="radio"name="difficulty"value="easy"class="hidden"/>
<spanclass="difficulty-button">5 x 5 (Easy)</span>
</label>
<labelclass="difficulty-option">
<inputtype="radio"name="difficulty"value="hard"class="hidden"/>
<spanclass="difficulty-button">7 x 7 (Hard)</span>
</label>
</div>
3.
There are arrays called EASY, HARD
2.
function addTable(matrix) {
consttable=document.createElement("table");
for (leti=0; i<matrix.length; i++) {
constrow=document.createElement("tr");
for (letj=0; j<matrix[i].length; j++) {
constcell=document.createElement("td");
constimg=generator(matrix[i][j]);
cell.appendChild(img);
row.appendChild(cell);
}
table.appendChild(row);
}
map.appendChild(table);
}
startBtn.addEventListener('click', startGame)
// HELPER FUNCTIONS
function startGame(){
menuDiv.style.display='none'
gameDiv.style.display='block'
rulesDiv.style.display='none'
ldrDiv.style.display='none'
document.querySelector('#name').innerHTML="ROUTE DESIGNER: "+nameInput.value
startTime=Date.now();
timerInterval=setInterval(updateTimer, 1000);
}
function getRandomNumber() {
returnMath.floor(Math.random() *5);
}
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
Unlock instant AI solutions
Tap the button
to generate a solution
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage