thomas_2023/day_6/part1.bas
Quantum fce178d777 Part 1 ez, part 2 was pain but theoretically works on a C64
Part 2 takes about 2 seconds per iteration and needs to
do 46857582 iterations.

From what ive tested everything else works and the C64 is
capable of decrementing 46857582 so the loop should finish
successfully... eventually...
2024-06-20 23:32:52 -04:00

14 lines
319 B
QBasic

0 ACCUM = 1
100 INPUT "TIME"; TIME%
101 IF TIME% = -1 THEN GOTO 1000
110 INPUT "DIST"; DIST%
199 WINS% = 0
200 FOR I=0 TO TIME%
210 CALCDIST% = (TIME% - I) * I
211 REM PRINT CALCDIST%
220 IF CALCDIST% > DIST% THEN WINS% = WINS% + 1
300 NEXT I
301 REM PRINT WINS%
310 ACCUM = ACCUM * WINS%
900 GOTO 100
1000 PRINT ACCUM