-
Notifications
You must be signed in to change notification settings - Fork 0
/
generation-000.js
41 lines (35 loc) · 1 KB
/
generation-000.js
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
37
38
39
40
41
/**
* GOAL:
* - Write a mandelbrot function that draws ascii code
* - The ascii code should have 90 columns AND 30 rows (90 * 30 grid)
* - The ascii code should use the provided characters only
* - Log the ascii code to the console in EACH generation
*/
/**
* CHANGELOG:
* Generation 0: implement base script
*/
import { generations, evolve } from "./base.js"; /* !!! */
const generation = 0;
console.log(`Generation ${generation} spawned`); /* !!! */
/* RULES:
* - Do not modify the code above these lines
* EXCEPTIONS
* - The CHANGELOG may be adjusted
* */
/* Please extend the function "output" to achieve the GOAL */
async function output() {
const asciiCharacters = ["\u00B7", "\u2022", "\u2218", "\u22C5", "\u25CF", "\u25CB", "\u26AA"];
// Log the ascii code to the console
console.log(asciiCharacters.join(""));
}
await output();
if (generation < generations) {
try {
await evolve(generation); /* !!! */
} catch (error) {
console.error(error);
}
} else {
console.log("GOAL achieved!");
}