Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create bubblesort.bas #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions bubblesort.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
1 poke53280,0:poke53281,0:printchr$(147);
2 print
3 print
4 print
5 print
6 print
7 print
8 print
15 PRINT "jeremy ray jewell presents..."
16 print
17 print
18 print
20 goto 60010

101 poke53280,0:poke53281,0:printchr$(147);
102 print " bubble sort is a simple sorting" : print "algorithm that works by repeatedly"
103 print "stepping through a list of elements," : print "comparing each pair of adjacent"
104 print "items and swapping them if they are in" : print "the wrong order. the pass through"
105 print "the list is repeated until no swaps are" : print "needed, which indicates that the"
106 print "list is sorted." : print" bubble sort is named because smaller"
107 print "elements 'bubble' to the top of the": print "list while larger elements 'sink' to" : print" the bottom." : print
108 print
109 PRINT
110 PRINT "enter number of elements: ";
120 INPUT N
130 FOR I = 1 TO N
140 PRINT "enter number "; I; ": ";
150 INPUT A(I)
160 NEXT I
170 FOR I = 1 TO N - 1
180 FOR J = I + 1 TO N
190 IF A(I) > A(J) THEN GOSUB 1200
1100 NEXT J
1110 NEXT I
1111 poke53280,0:poke53281,0:printchr$(147);
1112 T$ = "comparing pairs then swapping their places until every pair is in ascending order.... W blub blub blub "
1113 FOR count = 1 TO LEN(T$)
1114 PRINT CHR$(147); TAB(20); MID$(T$, 1, count)
1115 FOR delay = 1 TO 20: NEXT delay
1116 NEXT count
1118 poke53280,0:poke53281,0:printchr$(147);
1120 PRINT "here are your sorted numbers: ";
1125 print
1130 FOR I = 1 TO N
1140 PRINT A(I);
1150 NEXT I
1152 print
1155 print "W": print "hey, that was fun, let's go again!"
1158 print
1160 GOTO 109
1200 TEMP = A(I): A(I) = A(J): A(J) = TEMP: RETURN

60010 fori=0to999:readp,c:poke1024+i,p:poke55296+i,c:next
60020 geta$:ifa$=""then60020:end
60030 data 32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,100,11,100,6
60031 data 44,11,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0
60032 data 32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0
60033 data 32,0,32,0,32,0,32,0,108,1,121,1,32,0,32,0,32,0,32,11,121,6,247,6
60034 data 160,6,160,6,160,6,160,1,227,6,58,6,32,0,108,1,121,1,32,0,32,0
60035 data 32,0,108,1,98,1,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0
60036 data 32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,225,1,231,1,32,0
60037 data 32,0,108,6,254,6,160,6,160,6,160,6,160,6,160,1,160,1,160,6,101,6
60038 data 32,0,225,1,231,1,32,0,32,0,32,0,225,1,231,1,32,0,32,0,32,0,32,0
60039 data 32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0
60040 data 32,0,225,1,231,1,32,0,233,6,160,6,160,6,160,6,160,6,160,6,160,6
60041 data 160,1,160,1,160,6,101,6,32,0,225,1,231,1,32,0,32,0,32,0,225,1
60042 data 231,1,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0
60043 data 32,0,32,0,32,0,32,0,32,0,32,0,32,0,225,1,202,1,248,1,160,1,160,6
60044 data 186,6,173,1,160,6,167,1,186,1,160,1,160,1,160,1,247,1,44,1,225,1
60045 data 202,1,248,1,248,1,123,1,225,1,231,1,32,0,233,1,247,1,248,1,32,1
60046 data 32,0,32,0,32,0,32,0,85,1,64,1,73,1,32,0,32,0,32,0,32,0,32,0,32,0
60047 data 225,1,160,1,174,1,160,1,186,1,187,1,160,1,160,6,160,1,160,1,160,1
60048 data 160,1,174,1,160,1,231,1,225,1,160,1,226,1,201,1,231,1,225,1,231,1
60049 data 118,1,160,1,209,1,201,1,97,1,32,0,32,0,32,0,32,1,92,1,39,7,102,7
60050 data 92,1,32,0,32,0,32,0,32,0,32,0,225,1,186,1,160,6,160,1,160,1,186,1
60051 data 173,1,160,6,172,1,231,1,229,1,174,1,201,6,199,1,231,1,225,1,231,1
60052 data 32,0,225,1,231,1,225,1,231,1,225,1,160,1,249,1,249,1,126,1,32,0
60053 data 32,0,32,0,103,1,32,12,32,0,39,7,71,1,32,0,32,0,32,0,32,0,32,0
60054 data 225,1,160,1,160,1,160,1,186,1,160,1,160,1,248,1,160,1,97,1,245,1
60055 data 160,1,248,1,160,1,167,1,203,1,160,1,247,1,203,1,167,1,203,1,231,1
60056 data 103,1,160,1,98,1,247,1,123,1,32,0,32,0,32,0,39,1,92,1,32,0,85,1
60057 data 75,1,32,0,32,0,32,0,32,0,32,0,245,1,160,1,160,1,160,1,160,6,186,6
60058 data 249,1,239,1,226,1,32,1,204,1,249,1,249,1,172,1,160,6,160,6,160,1
60059 data 160,1,174,1,160,6,228,6,250,1,32,0,124,1,249,1,226,1,32,1,32,0
60060 data 32,0,32,0,32,0,39,1,68,1,75,1,32,0,32,0,32,0,32,0,32,0,32,0,229,6
60061 data 160,6,160,6,160,6,160,6,117,6,32,0,32,0,32,0,32,0,32,0,32,0,32,0
60062 data 229,6,160,6,160,6,160,6,160,6,160,6,174,6,75,6,32,0,32,0,32,0
60063 data 32,0,94,1,68,1,115,1,73,1,32,0,32,0,32,0,32,0,32,0,32,0,32,0
60064 data 32,0,32,0,32,0,32,11,160,6,160,6,160,6,160,6,160,6,32,11,32,0
60065 data 32,0,32,0,32,0,32,0,32,0,32,0,229,6,160,6,160,6,160,6,160,6,160,6
60066 data 167,1,32,0,32,0,32,0,32,0,72,1,32,1,32,0,99,7,214,1,32,1,32,0
60067 data 32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,103,11,160,6,160,6,160,6
60068 data 160,6,231,6,32,0,32,1,121,1,111,1,32,1,32,1,121,1,121,1,239,6
60069 data 239,6,160,6,172,6,186,6,156,1,160,1,111,1,32,0,32,0,32,0,62,1
60070 data 32,0,32,0,32,0,40,7,101,1,32,0,32,0,32,0,32,0,32,0,32,0,32,0
60071 data 32,0,32,0,103,6,160,6,160,6,160,6,160,6,231,6,32,0,245,1,236,1
60072 data 239,1,58,1,203,1,160,1,160,1,252,1,103,1,160,1,160,1,174,1,229,1
60073 data 160,1,228,1,32,0,32,0,32,0,66,1,32,0,32,0,32,0,58,1,101,1,32,0
60074 data 32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,39,11,160,6,160,6,160,6
60075 data 160,6,231,6,32,0,95,1,167,1,98,1,118,1,160,1,75,1,103,1,160,1
60076 data 160,8,160,1,160,8,160,8,183,8,160,1,32,0,32,0,32,0,32,0,39,1
60077 data 123,1,32,0,32,0,78,1,32,0,32,0,32,0,32,0,100,11,32,0,32,0,32,0
60078 data 32,0,32,0,32,0,160,6,160,6,160,6,160,6,160,6,44,6,104,1,80,1
60079 data 160,1,166,1,160,1,223,1,233,1,160,1,160,8,160,1,160,8,160,8,160,8
60080 data 160,1,73,1,32,0,32,0,32,0,32,0,39,1,113,1,68,1,32,1,32,0,58,1
60081 data 78,1,119,1,219,1,16,1,104,1,32,11,32,0,32,0,32,0,229,6,160,6
60082 data 160,6,160,6,160,6,97,6,229,1,160,1,228,1,75,1,95,1,160,1,160,1
60083 data 160,8,160,8,160,1,160,8,160,8,160,8,160,1,167,1,32,0,32,0,32,0
60084 data 32,0,32,0,32,0,32,0,32,0,46,1,75,1,32,0,32,0,32,0,119,7,77,7
60085 data 77,1,32,0,32,0,32,0,225,6,160,6,160,6,160,6,160,6,160,6,123,6
60086 data 99,1,32,0,32,0,32,0,39,1,32,1,229,8,160,8,160,8,160,8,160,8,160,8
60087 data 160,8,167,8,123,8,32,0,32,0,32,0,32,0,32,0,32,0,32,0,78,1,32,0
60088 data 32,0,32,0,32,0,32,0,32,7,113,7,92,1,32,0,32,0,39,11,160,6,160,6
60089 data 160,6,160,6,160,6,167,6,223,6,32,0,32,0,32,0,32,0,58,6,226,8
60090 data 226,8,226,8,226,8,226,8,226,8,226,8,226,8,120,8,32,0,32,0,32,0
60091 data 32,0,32,0,32,0,32,1,101,1,32,0,32,0,32,0,32,0,32,0,32,0,103,7
60092 data 66,1,32,0,32,0,32,0,95,6,160,6,160,6,160,6,160,6,160,6,160,6
60093 data 227,6,98,6,98,6,248,6,160,6,101,6,32,0,32,0,32,0,32,0,32,0,32,0
60094 data 32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,103,1,32,12,32,0,32,0
60095 data 32,0,32,0,32,0,32,0,39,7,151,1,32,0,32,0,39,14,100,14,201,6,160,6
60096 data 160,6,160,6,160,6,160,6,160,6,160,6,160,6,160,6,160,6,101,6,104,14
60097 data 32,11,85,14,44,14,85,14,73,14,46,14,73,14,32,14,104,14,32,6,85,14
60098 data 44,14,85,14,122,1,100,14,73,14,32,12,104,14,32,12,85,14,44,14
60099 data 85,14,72,1,32,0,32,0,32,0,39,14,124,6,160,6,160,6,160,6,160,6
60100 data 160,6,160,6,160,6,160,6,160,6,160,6,101,6,32,0,99,14,32,14,99,14
60101 data 32,14,39,14,99,14,32,14,99,14,32,0,99,14,32,14,99,14,32,14,39,1
60102 data 101,1,32,11,99,14,32,0,99,14,32,12,39,14,32,14,10,1,32,0,32,0
60103 data 46,6,32,0,32,6,124,6,172,6,160,6,160,6,160,6,160,6,160,6,160,6
60104 data 160,6,160,6,101,6,44,6,32,0,46,6,32,0,58,6,32,6,32,0,44,6,32,0
60105 data 44,6,32,0,46,6,32,0,32,6,32,6,77,1,44,6,32,0,46,6,32,0,46,6,32,11
60106 data 58,1,92,1,32,0,32,0,39,6,43,6,33,6,33,6,63,6,95,6,160,6,160,6
60107 data 160,6,160,6,160,6,160,6,160,6,125,6,75,6,43,6,75,6,43,6,39,6
60108 data 33,6,68,6,33,6,33,6,75,6,43,6,75,6,33,6,69,6,33,6,63,6,214,1
60109 data 43,6,75,6,33,6,39,6,61,6,78,1,32,6,32,0,32,0,32,0,32,0,32,0,32,0
60110 data 32,0,32,0,39,6,249,6,239,6,228,6,228,6,228,6,249,6,32,6,32,0
60111 data 32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0,32,0
60112 data 32,0,32,0,39,1,77,1,111,1,111,1,104,1,69,1,32,0,32,0,32,0,32,0
60113 data 39,14,104,14,70,14,40,14,104,14,40,14,104,14,47,14,104,14,47,14
60114 data 73,14,104,14,77,14,73,14,40,14,104,14,47,14,104,14,47,14,61,14
60115 data 104,14,77,14,73,14,40,14,104,14,78,14,104,14,64,14,110,14,104,14
60116 data 77,14,104,14,60,14,214,14,78,14,104,14,64,14,32,14,32,0
60126 goto 101