10,000 : Bubble Sort

hartnell 23 Apr 2007 21:31

I thought it would be good to sort the dice. So, I wrote a bubble sort example for it. This will be used to sort the dice. Later, kept dice will appear as one color, while "new" dice will appear as another.

— hartnell

*edit*

Forgot the code :)

```
randomize timer
Dim dice(5) as integer
for i = 1 to 5
dice(i) = int(rnd(1)*6)+1
next i
do
sorted = 0
for i = 1 to 4
if dice(i) > dice(i+1) then
temp = dice(i)
dice(i) = dice(i+1)
dice(i + 1) = temp
sorted = 1
end if
next i
loop until Sorted = 0
for i = 1 to 5
print "Die" ; i ; ":" ; dice(i)
next i
sleep
```