Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ challenge 4,294,967,295 - make your're are game

Name: Anonymous 2020-08-14 22:31

Wouldn't it be nice to have some code posted here for a change? Any humble stupid code.
This challenge is about making a game and finishing it. You can use any shitty language and write the simplest game possible, the only challenge is to FINISH it. That means that the game is playable and somewhat enjoyable.

Deadline: 2020-08-22T00:00:00Z Do what you can, a Rock paper scissors simulator is fine. Snake, Pacman, whatever, just finish it! Size limit is the max post length, but you can use any external libraries you want.

Name: Anonymous 2020-08-15 6:04

>>2 Added some improvements:
<!DOCTYPE html>
<html>
<head>

<meta charset="ISO-8859-1">

<title>Lights Out Game</title>
<style>
table#board { max-width:none;overflow: scroll;
border: 1px solid green; }
table#board td {
font-size:1em;
width:1em;
height:1em;
border: 1px solid red;
}
td::before{ content:attr(state); }
</style>
</head>
<body>
<table id="board"></table>
<input type="text" onchange="generateTable(this.value)">Enter Board Size</input>
<script>
const onstate='O';
const offstate=' ';

function generateTable(boardsize) {
var table = document.getElementById('board');
table.innerHTML='';
for (var i = 0; i < boardsize; i++) {
var row = table.insertRow(i);
for (var j = 0; j < boardsize; j++) {
var td = document.createElement('td');
td.setAttribute('row', i);
td.setAttribute('col', j);
td.setAttribute('state',Math.random()>0.5?offstate:onstate);
td.addEventListener('click', updateBoard);
row.appendChild(td);
}
}
}
function updateBoard() {

var row=parseInt(this.getAttribute('row'),10)
var col=parseInt(this.getAttribute('col'),10);
toggle(row,col);
toggle(row+1,col);
toggle(row-1,col);
toggle(row,col+1);
toggle(row,col-1);
if (!document.querySelector(`td[state="${offstate}"`)) alert('Victory');
}
function toggle(row,col){
var cell=document.querySelector(`#board td[row="${row}"][col="${col}"]`);
if(!cell)return;
var state=cell.getAttribute('state');
if(state==onstate){cell.setAttribute('state',offstate)}
else{cell.setAttribute('state',onstate);}
}

generateTable(25);
</script>
</body>
</html>
Edited on 15/08/2020 06:11.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List