Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Fibonacci Butt Sort

Name: Anonymous 2009-08-16 23:08

Let us discuss the various implementations of theFIBONACCI BUTT SORT.

Name: Anonymous 2009-09-03 2:01

>>94
Providing a mIRC implementation.
Usage: /bs testing buttsort
Can be used as an identifier, e.g. $buttsort(testing buttsort)
Caveat: Will not function well at all if the output ends up being > 900 characters. This means that you can only do roughly 90 characters worth of input text.

alias bs { say $buttsort($$1-) }
alias bbcode { return $+($chr(91), $1, $chr(93)) }
alias endbbcode { return $bbcode($+($chr(47), $1)) }
alias buttsort {
  var %text = $$1-
  var %output = $bbcode(b) $+ $bbcode(i)
  var %i = 1
  var %ctr = 1
  var %t = $len(%text)
  while (%i <= %t) {
    var %g = $mid(%text, %i, 1)
    var %spacequantity = 0
    while (%i <= %t && %g == $chr(32)) {
      inc %i
      inc %spacequantity
      var %g = $mid(%text, %i, 1)
    }
    if (%i > %t && %spacequantity > 0) { break }
    if (%ctr == 1) {
      var %output = %output $+ $str($chr(32), %spacequantity) $+ $bbcode(u) $+ %g $+ $endbbcode(u)
      var %ctr = 0
    }
    else {
      var %output = %output $+ $str($chr(32), %spacequantity) $+ $bbcode(o) $+ %g $+ $endbbcode(o)
      var %ctr = 1
    }
    inc %i
  }
  var %output = %output $+ $endbbcode(i) $+ $endbbcode(b)
  return %output
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List