Please Disable Ad-Block To View This Website.

If you block ads, this site can not survive!

Ads are very minimal for registered users. If you don't have an account please register now!

DOWNLOAD
 Full Scripts
 Addons
 Snippets
 DLLs
 MTS Themes
 Tutorials
 Misc.
 File Queue
 Download mIRC
INTERACT
 Screenshots
 Challenge
 Top Downloads
 Submit Form
 Forums

SEARCH
Site Search

FRIENDS
Link to us!
PhotoShelf

Top Challenge Entrants

  # User Points
  1 jaytea 587
  2 [Znork] 303
  3 urza 297
  4 Ag2X 288
  5 dr_Eamer 255
  6 Albie 199
  7 Chessnut 197
  8 A Noniem 194
  9 zzattack 186
  10 Kol 185
  11 m910q 168
  12 Sephiroth 115
  13 Auron956 114
  14 patje 114
  15 chid 110
  16 Ohad2121 92
  17 SkorpSSS 87
  18 DixrouE 84
  19 Suchorski 83
  20 ^Vampire^ 74
Challenge:Smallest $switch
Start:September 14th 2009
End:September 22nd 2009

Results

First of all, I'd like to apologize for the huge delay in posting the results but I have been busy as hell for the past week. I wasn't even been able to come up with an entry myself due to workload. However, with a lot of prodding from people and my nagging conscience, I finally mustered up the energy and time to do so!

This challenge was a bit more tricky than usual because it had to cater to so many specific features. This is perhaps why there weren't as many entries as I'd hoped for but those who did enter have come up with some pretty brilliant stuff!

There was a total of 6 non-regex entries and 7 regex entries, 9 of which were valid and 4 of which were invalid.

Congratulations to A Noniem for winning by a considerable difference in both entries! His $regsubex either returning "return VALUE" or "$null" was quite ingenious and what really put him ahead of everyone else. The flow of his non-regex script is quite slick and logical resulting in another short, impressive entry!


Winner! A Noniem (232 bytes)
switch {
  %a = 1
  %b = -1
  while $mid($1 a,%a,1) >=  {
    %i = $v1
    if (%i = ") inc %q
    if %i isalpha && %q !& 1 {
      inc %b
      if $2 isincs %b %c && %b {
        var %f $iif($prop,$remove(%d,"),%c)
      }
      var %c %i,%d
    }
    else %d = $+(%d,%i,")
    inc %a
  }
  return $iif($2,%f,%b)
}


Winner! A Noniem (137 bytes)
switch {
  $regsubex($1,/(.)(".*?"|[^a-z]*)/gi,$iif( [ $2 ] isincs \n\1,return $iif($prop,$noqt(\2),\1)))
  if (!$2) return $calc($regml(0)/2)
}


Non regex entries

Top entries:

1 A Noniem 232 bytes
switch {
  %a = 1
  %b = -1
  while $mid($1 a,%a,1) >=  {
    %i = $v1
    if (%i = ") inc %q
    if %i isalpha && %q !& 1 {
      inc %b
      if $2 isincs %b %c && %b {
        var %f $iif($prop,$remove(%d,"),%c)
      }
      var %c %i,%d
    }
    else %d = $+(%d,%i,")
    inc %a
  }
  return $iif($2,%f,%b)
}
2 SkorpSSS 270 bytes
switch {
  var %v $1,%i 0
  while (%v) {
    var %w $mid(%v,2),%a $asc(%w),%l $left(%v,1),%s ..,%d
    if (%a < 65) var %d $calc(%w),%s %d .
    if (%a == 34) var %d $gettok(%w,1,34),%s %d ...
    inc %i
    if %l === $2 || %i == $2 {
      return $iif($prop,%d,%l)
    }
    %v = $mid(%v,$len(%s))
  }
  if (!$2) return %i
}
3 Ag2X 307 bytes
switch {
  var %p 1,%c,%q,%i 0,%s,%a,%b
  while $mid($1,%p,1) != $null {
    %c = $v1
    if (%c = ") %q = $iif(%q,0,1)
    if !%q {
      if %c isalpha {
        inc %i
        if %s && (%b < /) %b = %p - %a
        if %i = $2 || (%c === $2) var %s %c,%a %p + 1
      }
    }
    inc %p
  }
  if %a && (%b < /) %b = %p
  return $iif(!$2,%i,$iif($prop,$iif(%b,$noqt($mid($1,%a,%b))),%s))
}
4 poiuy_qwert 325 bytes
switch {
  %x = 1
  %s = 0
  while $mid($1,%x,1) != $! {
    %l = $v1
    inc %s
    inc %x
    %m = 65
    if $mid($1,%x,1) == " {
      inc %x
      %m = 34
    }
    %n = %x
    while ($asc($mid($1,%n)) && $v1 != %m && (($v1 < %m) || (%m == 34))) inc %n
    if %s == $2 || %l === $2 {
      dec %n %x
      if ($prop) return $iif(%n,$mid($1,%x,%n))
      return %l
    }
    %x = %n $iif(%m == 34,+ 1)
  }
  if (!$2) return %s
}
5 [Znork] 347 bytes
switch {
  %s = $1
  while %s  {
    %v = $iif(?"* iswm %s,$qt($token(%s,2,34)))
    if !%v {
      %i = 2
      while $mid(%s,%i,1) != $o && $v1 !isalpha {
        %v = %v $+ $v1
        inc %i
      }
    }
    var %a $+ $asc(%s) $noqt(%v)
    %s = $mid(%s,$len(.. $+ %v))
  }
  %n = $var(a*,$2)
  %w = $var(a $+ $asc($2),1)
  return $iif($prop,$(,$iif($2 isnum,%n,%w)),$iif($2 isnum,$iif($2,$chr($mid(%n,3)),%n),$iif(%w,$2)))
}


Invalid entries:

urza 252 bytes $switch($null,0) should === 0 NOT $null (could have been fixed by changing %y = to %y = 0)
switch {
  %x = 1
  %y = 
  while %x <= $len($1) {
    inc %x
    inc %y
    %s = %x

    while $mid($1,%x,1) < 60 || %" {
      if ($v1 = ") %" = $iif(!%",1)
      inc %x
    }
    %d = $mid($left(#$1,%x),%s)
    if $2 = %y || ($2* iswmcs %d) return $iif($prop,$noqt($mid(%d,2)),$left(%d,1))
  }
  if (!$2) return %y
}



Regex entries

Top entries:

1 A Noniem 137 bytes
switch {
  $regsubex($1,/(.)(".*?"|[^a-z]*)/gi,$iif( [ $2 ] isincs \n\1,return $iif($prop,$noqt(\2),\1)))
  if (!$2) return $calc($regml(0)/2)
}
2 Ag2X 150 bytes
switch {
  %a = $2
  return $regsubex($1,/([a-z])([0-9-\.]+|"(?U).*"|)/gi,$iif(\1 === %a || \n = %a,$iif($prop,$noqt(\2),\1))) $iif(!%a,$calc($regml(0)/2))
}
3 urza 174 bytes
switch {          
  $iif($2,%x =,return) $regex($1,/(.(?:".+?"|[\d.-]*))/g)
  while %x {
    %r = $regml(%x)
    if %x = $2 || ($2* iswmcs %r) return $iif($prop,$noqt($mid(%r,2)),$left(%r,1))
    dec %x
  }     
}
4 starGaming 175 bytes
switch return $token($iif($regsub($1,/([a-z])(?:"(.+?)"|(-?\d*\.?\d*))/ig,\1 \2",%x) $+ $2 isnum,$token(%x,$2,34) $iif($2,,0),$wildtokcs(%x,$2 $+ *,1,34)),$iif($prop,2-,1),32)
5 poiuy_qwert 195 bytes
switch {
  %x = 1
  %s = 0
  while $regex($mid($1,%x),^((.)(".+?"|[\d-.]*)?)) {
    inc %s
    if %s == $2 || $regml(2) === $2 { return $remove($regml($iif($prop,3,2)),") }
    inc %x $len($regml(1))
  }
  if (!$2) return %s
}


Invalid entries:

Jos-hR 261 bytes $switch(abc,d) should === $null NOT d
switch {
  noop $regex($1-,/([a-z](?:"[^"]+|[^a-z]+)?)/ig)
  var %a 1,%b $remove($regml($2),"),%d $iif($prop = data,1),%e $!iif(%d,$mid(%b,2),$mid(%b,1,1))
  if ($2 isnum) return $(%e,2)
  while $regml(%a) {
    var %b $remove($v1,")
    if ($2 $+ * iswmcs %b) return $(%e,2)
    inc %a
  }
}
L4roXyL 467 bytes $switch(a\"0\",1).data should === 0 NOT a
switch {
  var %r return,%n $!null,%t NOT TESTED 
  if $len($2) >= 2 %r %t
  if ($2 isnum) %r $iif($2 = 0,$iif($prop = data,%t,$len($1)),$iif($len($1) < $2,%n,$mid($1,$2,1)))
  if $1 = %n %r $iif($2 = 0,$v1,%n)
  if $2 isincs $1 { 
    if $prop = data {
      if " isin $1 %r $iif($regex(c,$1,$+(/".",$2,"(.+)")/g),$regml(c,1),$iif($regex(s,$1,$+(/,$2,"(.)")/g),$regml(s,1),%t))
      %r $iif($regex(x,$1,$2 $+ (.+)),$iif($regml(x,1) isnum,$v1,%n))
    }
    %r $iif($regex($1,/ $+ $2 $+ /g) = 1,$2,%t)
  }
  else %r %n