Compare commits
2 commits
9c9504363d
...
aa1af7a9b8
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | aa1af7a9b8 | ||
Manuel Thalmann | b0d029e07f |
10
gulpfile.ts
10
gulpfile.ts
|
@ -140,25 +140,25 @@ export let Watch: TaskFunction = async (): Promise<void> =>
|
|||
server: context.StaticPath(),
|
||||
online: false
|
||||
});
|
||||
|
||||
|
||||
watch(
|
||||
context.SourcePath(context.JSDirName),
|
||||
series(
|
||||
JavaScript,
|
||||
BrowserSync(syncer, "*.js")));
|
||||
|
||||
|
||||
watch(
|
||||
context.SourcePath(context.StyleDirName, "**", "*.css"),
|
||||
series(
|
||||
Styles,
|
||||
BrowserSync(syncer, "*.css")));
|
||||
|
||||
|
||||
watch(
|
||||
context.SourcePath(context.AssetDirName),
|
||||
series(
|
||||
Assets,
|
||||
BrowserSync(syncer, join(context.AssetDirName, "**", "*"))));
|
||||
|
||||
|
||||
watch(
|
||||
context.SourcePath("**", "*.html"),
|
||||
series(
|
||||
|
@ -167,4 +167,4 @@ export let Watch: TaskFunction = async (): Promise<void> =>
|
|||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -5,19 +5,4 @@
|
|||
*/
|
||||
export const State = /** @type {Board} */ (
|
||||
Array(6).fill("").map(
|
||||
() => (Array(7).fill("").map(
|
||||
() =>
|
||||
{
|
||||
let id = Math.floor(Math.random() * 3);
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case 1:
|
||||
return "r";
|
||||
case 2:
|
||||
return "b";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
})))
|
||||
);
|
||||
() => (Array(7).fill(""))));
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { initializeBoard } from "./board.js";
|
||||
import { State } from "./State.js";
|
||||
|
||||
/**
|
||||
* Initializes the board.
|
||||
|
@ -10,59 +9,3 @@ function initialize()
|
|||
}
|
||||
|
||||
initialize();
|
||||
|
||||
/**
|
||||
* Sleeps for the specified number of milliseconds.
|
||||
*
|
||||
* @param {number} ms
|
||||
* The number of milliseconds to sleep.
|
||||
*/
|
||||
async function sleep(ms)
|
||||
{
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
(
|
||||
async () =>
|
||||
{
|
||||
let counter = 0;
|
||||
let tick = 0;
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true)
|
||||
{
|
||||
await sleep(1000 * (1 / 5));
|
||||
let cycle = counter % 24;
|
||||
|
||||
if ((cycle <= 11) || ((cycle % 2) === 0))
|
||||
{
|
||||
tick = (tick % 18) + 1;
|
||||
let rowId = Math.floor(Math.random() * State.length);
|
||||
let fieldId = Math.floor(Math.random() * State[rowId].length);
|
||||
|
||||
/**
|
||||
* @type {CellOwner}
|
||||
*/
|
||||
let owner;
|
||||
|
||||
switch (Math.floor(Math.random() * 3))
|
||||
{
|
||||
case 1:
|
||||
owner = "r";
|
||||
break;
|
||||
case 2:
|
||||
owner = "b";
|
||||
break;
|
||||
default:
|
||||
owner = "";
|
||||
break;
|
||||
}
|
||||
|
||||
State[rowId][fieldId] = owner;
|
||||
console.log(tick);
|
||||
initialize();
|
||||
}
|
||||
|
||||
counter++;
|
||||
}
|
||||
})();
|
||||
|
|
Loading…
Reference in a new issue