-
Notifications
You must be signed in to change notification settings - Fork 2
/
comp-sci-2.ts
45 lines (34 loc) · 1001 Bytes
/
comp-sci-2.ts
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
42
43
44
45
function unique<T>(array: readonly T[]) {
return array.filter((x, i, a) => a.indexOf(x) == i).length
}
function ascii(size: number) {
let output = []
for (let i = 0; i < size; i++) {
output.push(
" ".repeat(size - i) + "/" + " ".repeat(i) + "\\" + " ".repeat(size - i),
)
}
for (let i = 1; i <= size; i++) {
output.push(
" ".repeat(i) + "\\" + " ".repeat(size - i) + "/" + " ".repeat(i),
)
}
return output.join("\n")
}
function starAscii(size: number) {
const output = []
for (let x = 1; x <= size; x += 2) {
output.push(" ".repeat((size - x) / 2) + "*".repeat(x))
}
for (let x = size - 2; x >= 1; x -= 2) {
output.push(" ".repeat((size - x) / 2) + "*".repeat(x))
}
return output.join("\n")
}
function minArrows(stars: [number, number][]) {
unique(stars.map(([x, y]) => Math.atan2(y, x)))
}
function minArrowsWithRadius(stars: [x: number, y: number, r: number][]) {
const angles = stars.map(([x, y, r]) => [])
}
export {}