0    8Luaqmmp8d%qy)6o;]AsVl3<W
P          2TvͫgE#2Tv2Tvpk|ۚw
V	 
 p        $"  $  $  $  @      @A"    A    @   @  $"  $@$@$ @ @    @"    A           A                                                                                                                                                                                                                                                                                                                                                                                                  @@@"@A""  @    @   """                    @  @"A""$  $          "@""B@      @                                                                     43 @33 433@333@333 @<< @  @3  33  333333<<  @  @   43 @33 433@333@333@<<@ @@ @3  33333333  <<                                                                                                        !!                  !!!! !!!!  !          "   "   "  "" """ ""                              "  ""  ""  "" """ " "                                  "   "  ""  "" """ "                                       "   "  "" """ """  ""                                  "   "  ""  "" """ """                                                                                                                                                                                    DADDDD@DDD@@DDDDDD@DDDD@DDDDD@                                                                                                                                                                                                                                                                                                                                                                                                               D@DD@@@DDDDDD@D@DDDDDD@DDDD                                                                                                                                                                                                                                                                                                                                                                                   @   @        @                        @   @                      @   D   D  @D@DDDD@DDD@DDDDDDDDDDDDDDDDDD@D                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                !"""""!"""!""!!!!!!""1""""""!"!!"""""!"""!""!!!!!!""1""""""!"!!"""""!"""!""!!!!!""1""""""!"!!"""""!"""!""!!!!!!""1""""""!"!               !!!!!!!!!!     ! ! ! ! ! !                                                                                                                                                              !""!!! ""1    !""!!! ""1    !""!!! ""1    !""!! ! ""1        ""!!!!!!!!!!!!!!  " ! ! ! ! ! ! ! !"                                                                                                                                                                                                                                                                                                                                                                                                                                                !!!!!!                                                                                                                                                                                                                                                                                                                                                                                                                     ""      ""!! ! ! ! !"" "           "       "   ""        "                                                  !!!!!!!!!!!!      !! !!!! !! !! !!      "                             !!!!!!                                                                                                                                                                                                                                                                                                                                                             !! !!!!!!!!!!"  " !          "             """           ! ""!!!!!!" "                                                                                                                                                                                                                                                                                                                                    0  0                                                                                                         2    00 1   0    "100      1 0  1      1      1            1                                                                                                                                   @DD@DDDDD@DDDDD@@@DD  D @DDDDDDDDDDDD@@@@DDD@D  D@                                                                                                                                        1  0 0 1   #00!    0 1    ! #                1                                                                                                                                          @D  D  D @ @ @D @D @DD@ D@  D@  D@ D@ @@ @@ @@                                                   ""                                       1  1  1  1  1  00   1  0 0 0  0  0   11  0    1  0010000    1      1                 !                                       0                                                                    @ @ @ @D @D  D  D @DD@ D@ D@ @@ @@ D@  D@  D@                               "       "        "       "     1  1  1  1   3    1   31 1  1  1   3    1   3   1       1 0 33333  0  3 03333    2103333  1       11!3333 00 0 00  3333  0000023333   00 0   !3333                                 @D  D@@DDD@DDD@DDDDDD@DD@D@ @D  DD@@DDD@@DDDDDDDDD      	   !            	 	 
 
 
                                                   80?6o?P1>4Q?1?o1?94a0?@?P0>0@1>0>@03;h>>0]=_0                                                                      @ E M J @ @ G F @ @ J I K @ @ K @ J @ @ H @ I @ @ K @ @ N F      A~@]BLC;D*DDEG
G
HHIIIIFJJJKLLLLLMNNNO`  a                    a          a          a   	 a    a    a       	                                                                                                            a          a         
 a         	 a                             	                                                                                                          a          a         
 a         	 a                 	            	                                                                                                     a          a         
 a         	 a         
 a    a        a   
                                                                                                                a          a         
 a         	 a         
 a    a        a       
                                                                                                           a          a          a          a          a          a        a   	 a    a    a    a    a  a                                     	 a 
   
   
      
   
    	 
                                                                                                                                          
           
       	 
                                                                                                                                                                                `          `          `          `                                                                                                          A                                              A                                                                                                                                              A                                 	 A                                                                                                                                                          A                                 	 A                                 A                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    d                    E                                        E                                                                                                                                       E                                        E  E  E  E e                 C  C   	                                                 ?  "   "                                                                                                                 "   "                                                                                                                "  "                                                                                                                  " "                                                                                          """" " " "              DDDDD DD DDDDD                     DDDDD DD DDDDD                          """"                     DDDDD DD DD         DDDDD DD DDDDD                            ""                    DDDDDDDDDDDD        DDDDDDDDDDDDDDDD                           ""                    DDDDDDDDDDD"""" """ "DDDDDDDDDDDDDDD                            ""                    DD DDDDDDDD"""" """ "D3DDDDDDDDDD DD" "                         ""                    DD DDDDDDDD"""" """" "D3DDDDDDDDDD DD" "                           "03   30 0          D D DDDDDDD"""" """" "33 DDDDDDDD D " "                            "30 03            D D DDDDDDD"""" """" "33 DDDDDDDD D " "                             3 030 0           DDD D  DD  """" """" "3""                             3 300            DDD D  DD  """" """" "3""                               """03 3 30 0           D DDDDDDDD"""" """" "33DDDDDDDDDD D" "                               """                     D DDDDDDDD""" """" "33DDDDDDDDDD D" "                                                       DDD  DD""" """" " 3 DDD  DDD    " "                                                      DDD  DD"""" """" " 3 DDD  DDD    " "                               ""    "                       DD DDDD """" """" "  DD DDDD DD                                     ""    "                       DD DDDD """" """" "  DD DDDD DD                                         DDDDDD                       DD DDDD """" """" "  DD DDDD DD                                         DDDDDD                       DD DDDD """" """" "  DD DDDD DD                                         DDDDDD D                        D DDDD """" """" "   D DDDD D                                          DDDDDD D                        D DDDD """" """" "   D DDDD D                                             DDDDDD D                        D DDDD """" """" "   D DDDD D                                             DDDDDD D                        D DDDD """" """" "   D DDDD D                                              DDDDDDD                       DD D DD """" """" "  DD D DD DD                                             DDDDDDD                       DD D DD """" """" ""   DD D DD DD                                            DDDDDD D                       DD D DD """" """" ""   DD D DD DD                                            DDDDDD D                       DD D DD """" """"    DD D DD DD                                            DDDDDDDD                       DD DD D """" """"    DD DD D DD                                            DDDDDDDD                       DD DD D """ """ "  DD DD D DD                                             DDDDDDD                       DD DD D """ """ "  DD DD D DD                                             DDDDDDD                       DD DD D """" "" "  "" """""  ""   DD DD D DD                                            DDD DD D                       DD DD D """" "" "  "" """""  ""   DD DD D DD                                           DDD DD D                       DD DD D DD                         DD DD D DD                                       !    DDD  DDD                       DD D DD DD                         DD D DD DD                                           DDD  DDD                       DD D DD    DDD DD                                            D$$  D D                       DD D DD    DDD DD                                            D$A  D D                       DD D DD DD""  """ "   D" D DD                                             "DDDDD                       DD D DD DD""  """ "   D" D DD                                             $DDDDDD                       DD D DD DD""  """" "   D" " DD                                            DDDDDD D                       DD DD D DD""  """" "   D"D" DD                                            DDDDDD D                       DD DD D DD""  """" "   D"D" DD                                            DD DDDDD                       DD DD D DD""  """" "   D"D" DD                                            DD DDDDD                       DD DD D DD" "  """" "   D"D" DD                                           DDDDDDD                         D DDDD D " "  """" "    "D" D                                            DDDDDDD                         D DDDD D   " """" "    "D" D         "                                  DD DD DD                        D DDDD D   " """" "    "D" D         "                                  DD DD DD                        D DDDD D  "  """" "    "D D         "                                  DDDDD DD  $""                 DD DDDD D  "  """" "   D"D DD        "                                 DDDDD DD  $                 DD DDDD "  "  """" "   D""DDD       "                                  DDDDDDD  $A                 DD DDDD "  "  """" "   D""DDD       "                               "   DDDDDDD  $                DD DDDD "  "  """"  "D"D"                            "  DD DDDDD  @                 DDD  DD"  "  """"  " " "                            ""  DD DDDDD   @                 DDD  DD"  "  """"    " """" """"""                        ""  DD DDDDD                 D DDDDDDDD"D "  """"    "D"""" """"""                        """  DD DDDDD @A@             D DDDDDDDD"D "  """"    "D"""" D"""""" "        DD           ""  DDDDDDDD 433            DDD D  DD  "DD"  """"    " """"DD"""""" "        DD                DDDDDDDD@A3333            DDD D  DD  "DD"  """"    " """"DD"""""" "          D              DDDDDDDD @43333            D D DDDDDDD" D"  """"    " """"D """""" "          D              DDDDDDDD @33333            D D DDDDDDD" D"  """"   """"D """""" "         D D            DDDDDDDDDD@33333            DD DDDDDDDD"DD"  """"  D"""" D"""""" "         D D            DDDDDDDDDD @<<<<              DD DDDDDDDD"""" " D""" D"""""        D  D           DDDDDDDDDD D@              DDDDDDDDDDD"""" "DD"""DD"""""        D  D           DDDDDDDDDD D@             DDDDDDDDDDD""""D""""""" """""  """"DDD""D"""D"DDD""" """ """  " "       D   D           DDDD DD DD                     DDDDD DD D"""" """"""" """""  """"DDD"" """D"DDD""" """ """  " "       D   D           DDDDD DD DD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           !""""1                                                                                                                """"""                                                                                                                !""""""                                                                                                                !""!!"                                                                                                                !!!                                                                                                                !                                                                                              !                                                                                              !                                                                                                                                                                                                      !                                                                                                  !                                                                                                                                                                                                                                                                                                                                                                                                           !!                                                                                               """"1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""z  ;; title:   oh no! zeno's paradox
;; author:  replicat
;; desc:    a short "game" about one of zeno's paradoxes
;; site:    matdombrock.com
;; license: GPL3
;; version: 1.0
;; script:  scheme

(define-macro (inc! x dx) `(set! ,x (+ ,x ,dx)))
(define-macro (numh n)
	`(number->string
   	(exact->inexact ,n)))
(define-macro (loop n fn) 
	`(let l ((i 0))
		(when (< i ,n) 
			(begin (,fn i)(l (+ i 1))))))
(define (any-key?)
	(define hit #f)
	(loop 128 (lambda (i)
		(when (t80::btnp i)
			(set! hit #t))
		(when (t80::keyp i)
			(set! hit #t))))
	hit)
    
;; global state
(define phrases (list
	"Achilles is the fastest runner
in all the land! Surely he can best the 
tortoise in a race to the flag!

          --press any key to continue--"
 "He may think he can  give 
the tortoise quite the head start!
For the tortoise is quite slow indeed!
None the less it has already won the race!"
	"For before Achilles can catch the tortoise
he must get half way to the tortoise!"
	"And before he can get half way,
he must get one quarter of the way.
Yet before that he must reach 
one eighth of the distance!"
	"ACHILLES CAN NOT MOVE AT ALL!!
For before he can move any distance, he must
cover the infinite amount of 
distances in between!"
	"The paradoxical conclusion then 
would be that travel over any 
finite distance can be neither
completed nor begun!
All motion must be an illusion!"
 "Yet Achilles can move!?
He seems to have already covered half
the distance between his 
starting point and the tortoise!"
	"However, the quickest runner can never 
overtake the slowest! 
Since the pursuer must 
first reach the point whence the 
pursued started, so that the slower 
must always hold a lead!"
	"Achilles is quite fast indeed!
with each passing moment he covers
half the distance between where he
last was and where the tortoise
is now!"
 "Yet is halfway there is ever enough?"
"Even after reaching an infinite amount
of halfway points there are an
infinite amount left to cross!"
	"Achilles will never catch up!"
	"So long as the tortoise keeps advancing
Achilles can never catch her!"
 "When Achilles arrives somewhere the 
tortoise has been, he always has 
some remaining distance to go before 
he can reach the tortoise!"
 "Achilles grows closer and closer
to the tortoise in each passing moment!"
	"Yet it is now clear he will never pass her!"
	"He will only grow infinitely closer!"
	"Infinitely close is surely not passing!"
 "Yet, is there any difference between being
infinitely close and being THERE?"
	"Let us try again!";; phase 2
	"Suppose instead of trying to beat the 
tortoise, Achilles simply runs
to the flag!"
	"Achilles will no longer be concerned
with passing the tortoise.
He will simply complete the race!"
 "He will only need to move halfway
between the starting line and the flag!"
	"From there he can easily reach the halfway
point between that halfway 
point and the flag!"
 "Surely the fastest runner in the world
can complete such a simple task!"
 "Yet Achilles must wonder if he can complete
an INFINITE amount of simple tasks?"
 "Achilles clears half of the race 
in a single bound!
He is truly the fastest in the world!"
 "He bursts into the lead!
Clearing the next halfway point
without any signs of tiring!"
	"With each passing moment he
crosses a new halfway point!
There is no chance the tortoise
can win the race now!"
	"Yet as the next halfway point approaches
Achilles in his wisdom realizes he is
not progressing as well as he had hoped!"
	"For the distance between each new
halfway point grows smaller and smaller!
Yet he must still pass each one!"
	"Achilles may be bested by the tortoise 
once again!
She is gaining on him quickly now!"
	"But what of the tortoise?
Can she complete the race herself?
She is still far behind!"
 "However, she is not burdened with
the knowledge of philosophy!"
 "She is not ruled by the tyrant of
abstract thought!"
 "She moves discretely without regard
for Zeno!"
	"She is not bothered to move only
half way!
She simply goes where she must!"
	"One step at a time, she
approaches the lead!"
	"If only Achilles could move
in discrete steps!"
	"Instead of converging on the flag
he could simply pass it!"
	"There may still be time!"
	"Could Achilles simply attempt
to move past the flag?"
	"Setting his goal to be twice
the distance between his
starting location on the flag
could resolve him to the location
of the flag by his first
halfway point!"
	"While he must traverse an
infinite amount of halfway points
to get anywhere, he can get
halfway to anywhere easily!"
	"Halfway to anywhere is every somewhere!"
	"Similarly, being infinitely
close to a location is the same
as being there!"
	"With this new mastery of the infinite
is Achilles able to
best the tortoise?"
	"Furthermore is that flag
actually moving at all?"))
(define t 0)
(define moves 0)
(define moves-real 0)
(define ax 0)
(define tx 0)
(define flowers 
	(list 210 0 220 0 230 0))
(define phase 0)
(define phrase-index 0)
(define input-time 120)
(define input-timer input-time)

(define (make-percent-string x)
	(define xx (* (/ x 200) 100))
	(string-append
		(numh 
			(min 
				xx 
				;;99.99999999999999)
				100))
		(if (= xx 100) "...%" "%")))

(define (reset-phase!)
	(t80::sfx 0 16 30)
	(set! moves-real 0)
	(set! moves 0)
	(set! ax 0))
	 
(define (handle-input!)
	(when (and (= input-timer 0) (any-key?)) 
   (set! input-timer input-time)
   (inc! moves 1)
			(inc! phrase-index 1)
   (t80::sfx 0 (modulo (+ 32 moves) 98)
   		8 3 6)
   (set! tx (+ tx 4))
   (when (> moves 5)
   	(inc! moves-real 1)
				(when (= phase 0)(set! ax (- tx (/ (- tx ax) 2))))
   	(when (= phase 1)(set! ax (- 200 (/ (- 200 ax) 2))))
				(when (= phase 2)(set! ax 0)))
			(when (= phase 3)(set! ax (- 420 (/ (- 420 ax) 2))))
			(when (= phrase-index 20)	
				(reset-phase!)
				(set! phase 1))
			(when (= phrase-index 40)
				(reset-phase!)
				(set! phase 2))
			(when (= phrase-index 46)				
				(reset-phase!)
				(set! phase 3))))

(define (render)
	(define tt (floor (/ t 60)))
	(t80::cls 0)
	;; !?
	(when (or 
		(= phrase-index 6)
		(= phrase-index 19)
		(= phrase-index 26)
		(= phrase-index 32)
		(= phrase-index 40)
		(= phrase-index 46))
			(t80::spr (+ 224 (* (modulo tt 2) 2)) 90 10 0 3 0 0 2 2))
	;; title
 (when (< phrase-index 6)
  ;; pillar
  (t80::spr 204 40 4 0 2 0 0 2 4)
  (t80::spr 204 110 4 0 2 0 0 2 4)
  ;; title
  (t80::spr 104 60 3 0 2 0 0 8 4)
  ;; arrow
  (t80::spr 192 (max (- 240 (* t 2)) 
  	110) 
   8 0 2 0 0 3 1))
 ;; tree
 (t80::spr 28 176 3 0 2 0 0 4 4)
 ;; Achilles
 (t80::spr (* (modulo moves-real 2) 2) 
  (floor ax) 50 0 1 0 0 2 2)
 ;; tortoise
 (t80::spr (+ 6 (* (modulo moves 2) 2)) 
  (floor tx) 50 0 1 0 0 2 2)
 ;; flag
 (t80::spr (+ 32 (* (modulo tt 4) 2)) 
  211 50 0 1 0 0 2 2) 
 ;; flowers
	(loop 3 (lambda (i)
		(define ii (* i 2)) 
		(define x (list-ref flowers ii))
		(define y (list-ref flowers (+ 1 ii)))
		(t80::spr (+ 128 (modulo (+ tt i) 2)) 
			x y 0 1 0 0 1 1)
		(when (= (modulo t 16) 0)
			(define rx (- (random 5) 2))
			(define ry (random 3))
			(list-set! flowers ii (+ x rx))
			(if (> (+ y ry) 136)
				(begin
					(list-set! flowers ii 
						(+ 210 (random 20))) 
					(list-set! flowers (+ ii 1) 0))
				(list-set! flowers 
					(+ ii 1) (+ y ry))))))
 ;; floor
 (loop 16 (lambda (i)
  (t80::spr 64 (* i 16) 67 0 1 0 0 2 2))) 
 (when (> t 120)
	 ;; input timer
	(t80::rect 0 132 
		(- 240 (* 2 input-timer)) 4 2)
		;; Zeno
	 (t80::spr (+ 96 (* (modulo tt 4) 2)) 
	  0 75 0 1 0 0 2 2)
	 (t80::print "ZENO:" 24 80 1 #f 2)
		;;(t80::print (numh phrase-index) 0 20 1)
	 (t80::print 
	  (list-ref phrases 
	   (min phrase-index 
					(- (length phrases) 1))) 
	    0 94 1)
	 ;; stats
	 (when (< phrase-index (length phrases))
			(t80::print (make-percent-string ax) 
				0 0 2)
	 	(t80::print (make-percent-string tx) 
				0 10 3)))
	;; Dev logo
	(when (< t 119)
		(t80::spr 204 132 (- 136 (min 42 t))
			 0 2 0 0 2 4)
		(t80::spr 160 120 (- 120 (min 42 t)) 
			0 1 0 0 6 2))
	(when (>= phrase-index (length phrases))
		(t80::spr 160 42 4 0 3 0 0 6 2)))
		
(t80::poke #x7FC3F 1 1)
(t80::sfx 0 16 52)
(define (TIC)
  (handle-input!)
  (render)
  (when (= t 60)
  	(t80::sfx 2 16 16))
  (when (= t 120)
  		(set! input-timer input-time)
  	 (t80::music 0))
  (inc! t 1)
  (when (> input-timer 0)
  	(inc! input-timer -1)))
