Carlos Guedes

Generation

gerar um labirinto com o formato de quadrado construído com o seguinte caractere # na cor verde e o fundo da tela na cor preta , gerar um personagem feito com o caractere @ na cor laranja que possa ser movido com as teclas direcionais

<div class="container" id="main"> <pre id="playground"> <script> function init(){ var text = "" var size = 15 var color = "green" var background = "black" for(var i=0;i<size;i++){ for(var j=0;j<size;j++){ if(i==0 || i == size-1 || j==0 || j == size-1){ text += "#" }else{ text += " " } } text += "\n" } document.getElementById("playground").style.color = color document.getElementById("playground").style.background = background document.getElementById("playground").innerHTML = text } init() </script> <style> #playground{ font-size: 20px; white-space:pre; } </style> </pre>

Questions about programming?Chat with your personal AI assistant