Created
December 17, 2020 02:41
-
-
Save roblogic/7b2633a4469b0369f49993b02d542304 to your computer and use it in GitHub Desktop.
Apple II BASIC code for drawing the "hacker logo": a glider from Conway's Game of Life
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0data51,29,73,51,73,73,51,73,29,73 | |
1hgr2:hcolor=3:fori=0to191:hplot0,i to191,i:hplot i,0toi,191:next | |
2hcolor=0:fori=18to84step22:hplot18,i to84,i:hplot i,18toi,84:next | |
3fori=1to5:reada,b:a=a+.5:b=b+.5:gosub4:next:end | |
4forr=0to9step0.5:r2=r*r:for x=0 to r:y=sqr(r2-x*x) | |
5hplot a+x,y+b:hplot a-x,y+b:hplot a+x,-y+b:hplot a-x,-y+b | |
6hplot a+y,x+b:hplot a-y,x+b:hplot a+y,-x+b:hplot a-y,-x+b | |
7next:next:return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
0data...
locates the circles.1hgr2...
draws white background.2hcolor...
draws grid.3for..read..
gets data & calls the circle subroutine. (.5
is added at various points because of quirky Apple II drawing logic).4for...
to7..return
is a unique algorithm for circles usingSQR
. (algo adapted from this tutorial).Verified at https://www.calormen.com/jsbasic/