blob: 353eea5b3c18c1052d37bab63ffbaf816fdc0c93 (
plain)
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
|
REM Advent of Code 2022: Day 1, part 1
REM Written in Applesoft BASIC
10 ONERR GOTO 900
20 MOST = 0:CURR = 0
30 PRINT CHR$ (4),"OPEN INPUT"
40 PRINT CHR$ (4),"READ INPUT"
100 S$ = ""
110 GET C$
120 IF ASC (C$) = 13 GOTO 200
130 S$ = S$ + C$
135 GET D$
140 GOTO 110
200 V = VAL (S$)
205 GET D$
210 IF V = 0 GOTO 300
220 CURR = CURR + V
230 GOTO 100
300 IF MOST < CURR THEN MOST = CURR
310 CURR = 0
320 PRINT MOST
330 GOTO 100
900 PRINT CHR$ (4),"CLOSE"
910 END
|