mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
30 lines
339 B
Plaintext
30 lines
339 B
Plaintext
//TODO: Not yet functional
|
|
|
|
//advent of code thingy
|
|
var arr = [
|
|
3, 4,
|
|
4, 3,
|
|
2, 5,
|
|
1, 3,
|
|
3, 9,
|
|
3, 3,
|
|
];
|
|
|
|
var total = 0;
|
|
var counter = 0;
|
|
|
|
while (counter < arr.length) {
|
|
var difference = arr[counter] - arr[counter+1];
|
|
|
|
if (difference < 0) {
|
|
difference = -difference;
|
|
}
|
|
|
|
total += difference;
|
|
|
|
counter += 2;
|
|
}
|
|
|
|
print difference;
|
|
|