-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset.php
More file actions
36 lines (31 loc) · 761 Bytes
/
reset.php
File metadata and controls
36 lines (31 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
// Reset grid to all black cells
// the-grid by aaviator42
// 2024-01-18, v0.2, AGPLv3
// Function to generate a 100x100 array with all values 0
function generateZeroArray() {
$array = array();
for ($i = 0; $i < 100; $i++) {
$row = array();
for ($j = 0; $j < 100; $j++) {
$row[] = 0;
}
$array[] = $row;
}
return $array;
}
// Generate black grid array
$grid = generateZeroArray();
// Delete current.db
if(file_exists('current.db')){
unlink('current.db');
}
// Create new current.db
require 'lib/StorX.php';
$sx = new \StorX\Sx;
$sx->createFile('current.db');
$sx->openFile('current.db', 1);
$sx->modifyKey('grid', $grid);
$sx->closeFile();
echo 'ok';
?>