home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1985 October / Ahoy_Magazine_85-10_1985_Double_L.d64 / cd22-1 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  483b  |  17 lines

  1. 0 rem << cd22-1 >>
  2. 1 rem
  3. 2 rem various readers' solutions to
  4. 3 rem problem #18-1 : cycling function
  5. 4 rem
  6. 10 def fnc(d)=d*sgn((99-x)/(x-1))
  7. 11 def fnc(d)=int(x/100)*-105+5
  8. 12 def fnc(d)=d+10*(x=100)-10*(x=0)
  9. 13 def fnc(d)=d+10*(x>95)-10*(x<5)
  10. 14 def fnc(d)=d+(2*d*(x=0 or x=100))
  11. 15 def fnc(d)=5+10*(x>95 or d<5)-10*(x<5)
  12. 16 def fnc(d)=d+(2*d*((x<=0)or(x>=100)))
  13. 17 def fnc(d)=-5*(d=5)+5*(d=-5)+10*(x=100)-10*(x=0)
  14. 18 def fnc(d)=d*((((x=100)+(x=0))*2)+1)
  15. 20 d=5:x=0
  16. 30 s=x/5:printspc(abs(s))x:x=x+d:d=fnc(d):goto30
  17.