Advertisement
linesguy

Side by side random walks

Mar 30th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. 0 rem On the left side of the screen is some code i made by accident while trying to make something else (which i'll finish later)
  2. 0 rem On the right side of the screen is a real* random walk to show the code on the left isn't pure random
  3. 0 rem That's what i like about applesoft basic, Even if you mess up you can still create interesting things.
  4.  
  5. 0 rem *Not actually real randomness since jsbasic sucks at randomness (try making a program with just " 10 print rnd(1) " then run it again and again)
  6.  
  7. 5 v = 1 : rem Maximum "velocity" for the leftside randomess, Must be an integer
  8.  
  9. 10 hgr2 : x = 70 : y = 96 : x2 = 210 : y2 = 96 : hcolor = 3 : hplot 140,0 to 140,191
  10. 11 for re = 1 to peek(78)+peek(78)+peek(78) : er = rnd(1) : next
  11.  
  12. 19 rem Code for left side randomness:
  13. 20 XV = XV + int(rnd(1)*3)-1 : YV = YV + int(rnd(1)*3)-1
  14. 40 if xv > v then xv = v
  15. 50 if yv > v then yv = v
  16. 60 if xv < -v then xv = -v
  17. 70 if yv < -v then yv = -v
  18. 80 x = x + xv : y = y + yv
  19. 90 if x > 140 then x = x - 140
  20. 100 if x < 0 then x = x + 140
  21. 120 if y > 191 then y = y - 191
  22. 130 if y < 0 then y = y + 191
  23. 140 hplot x,y
  24.  
  25. 149 rem Code right right side randomness:
  26. 150 x2 = x2 + int(rnd(1)*3)-1
  27. 160 y2 = y2 + int(rnd(1)*3)-1
  28. 162 if x2 > 279 then x2 = x2 - 140
  29. 164 if x2 < 140 then x2 = x2 + 140
  30. 166 if y2 > 191 then y2 = y2 - 191
  31. 168 if y2 < 0 then y2 = y2 + 191
  32. 169 hplot x2,y2
  33.  
  34. 170 goto 20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement