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 $boxes
Start:August 31st 2009
End:September 9th 2009

Results

Thank you to everyone who participated in this challenge.

As a number of you who participated knew, there was a number of problems you could run into when coding this challenge. Initial thoughts were this; recursively going through the boxes, count how many sides each box has, if it has 3, increase counter, manipulate the bit to give the box the missing side and carry on in the loop. This would cause problems when giving a side that completes another box next to it giving it 4 sides. Next time in the loop it would see that box has 4 sides and wouldn't count it.

As figured out, one way around it was to count the number of boxes with 4 sides prior to entering the loop, then again at the end outside the loop. Then using the formula:

(new calculated boxes with 4 sides) - (old boxes with 4 sides) = new boxes

Then add this onto the result. It's a bit of a dirty technique really, but it was useful for some. I would be interested in knowing any other struggles you had to overcome when coding your alias in the forum.

Now onto the results...




There was a total of 12 non regex-entries of which 7 were valid and 5 invalid. In the regex section there were 2 valid entries.


Congratulations to the winners:


Winner! jaytea (235 bytes)

alias boxes {
  bset -tc &a 1 $1-
  %a = $len($1a)
  :a
  %b = %a
  while %b {
    %1 = 3
    a
    a %a
    a %a +%b /%a
    a %e +1a
    if (!%1) var %c $+ %b,%d bset &a %0 1
    dec %b
  }
  %d
  %d = return $var(c*)
  goto a
}
alias a {
  %e = $calc($1- ^.5+%b)
  $iif($bvar(&a,%e) & 1,dec %1,%0 = %e)



Winner! Kylar (297 bytes)

alias c return $regex($3,/1(?=.{ $+ $2 $+ }1)(?=.{ $+ $1 $+ }11)/g)
alias boxes {
  var %g $numtok($2,32),%l $len($1),%p $1 $regsubex($2,/ /g,),%i 1,%r 0
  while $pos(%p,0,%i) {
    %n = $regsubex(%p,(.{ $+ $(},$v1) $+ }).,\t1)
    if $c(%l,%g,%p) < $c(%l,%g,%n) {
      %p = %n
      %i = 0
      inc %r $v2
      dec %r $v1    
    }
    inc %i
  }
  return %r



Non regex entries

Top entries:

1 jaytea 235 bytes
alias boxes {
  bset -tc &a 1 $1-
  %a = $len($1a)
  :a
  %b = %a
  while %b {
    %1 = 3
    a
    a %a
    a %a +%b /%a
    a %e +1a
    if (!%1) var %c $+ %b,%d bset &a %0 1
    dec %b
  }
  %d
  %d = return $var(c*)
  goto a
}
alias a {
  %e = $calc($1- ^.5+%b)
  $iif($bvar(&a,%e) & 1,dec %1,%0 = %e)
2 urza 291 bytes
alias b {
  %~ = $bfind(&1,1,4)
  %! = 
  while $bvar(&1,%~,2) {  
    if ($v1 > 4) inc %!    

    if (49 49 49*9 iswm $v1 $bvar(&1,%!,$bfind(&1,1,32))) inc %c $2
    inc %~
  } 
  bset &1 %x $1
}
alias boxes { 
  %b = 0
  %x = 1
  bset -tc &1 1 #$1 $2

  while $bfind(&1,%x,48) {
    %x = $v1
    %c =
    b 49 -1
    b 48

    if %c {
      inc %b %c
      b 49
      %x = 
    }
    inc %x 
  }
  return %b
3 dr_Eamer 331 bytes
alias c return $calc((1+$2+ %n)*($1+ %k % %n)+1+%k /%n +(1+%n)^2*$2)
alias s bset -t &a $1-
alias y {
  s $c 1
  s $c(1) 1
  s $c(,1) 11
  %k = -1
}
alias w {
  %k = 0
  while %k < $calc(%n ^2) {
    if $count($bvar(&a,$c) $bvar(&a,$c(1)) $bvar(&a,$c(,1),2),9) = $1 $2 % $+ r
    inc %k
  }
}
alias boxes {
  %r = 0
  s 1 $1 $2
  %n = $numtok($2,32)
  w 4 dec
  w 3 y
  w 4 inc
  return %r
4 [Znork] 343 bytes
alias c inc %c $gettok(%r,$1,2)
alias p %ø = $puttok(%ø,1,$1,2)
alias boxes {
  %ø = $replace($1-,1,1,0,0)
  tokenize 32 $2
  %n = 0
  :a
  %s = $0 ^ 2
  %r = %ø
  while %s {
    var %a %s + $0,%b $calc($0 ^2-(1-%s)/$0 +%a),%d %b + 1
    %c =
    c %s
    c %a
    c %b
    c %d
    if %c < 4 var % $+ %s 1
    if %c > 2 && $(,% $+ %s) {
      p %s
      p %a
      p %b
      p %d
      inc %n
      dec % $+ %s
    }
    dec %s
  }
  if %r = %ø return %n
  goto a
5 SkorpSSS 479 bytes
alias c return $mid($gettok($1,$2,32),$3,$4)
alias f {
  %u = $calc(%i *%s -%s +%j -1+$3)
  return $+($left($1,%u),$2,$mid($1,$calc(2+$4+ %u)))
}
alias w {
  %0 = 0
  %i = 1
  while %i < %s {
    %j = 1
    while %j < %s {
      %c = $c(%h,%i,%j,1) $+ $c(%h,$calc(%i +1),%j,1) * $c(%v,%i,%j,2))
      if (%c > 120) inc %0
      if $1 && 11 isin %c {
        %h = $f(%h,1)
        %h = $f(%h,1,%s)
        %v = $f(%v,11,%i -1,1)
      }
      inc %j
    }
    inc %i
  }
  return %0
}
alias boxes {
  %h = $1
  %v = $2
  %s = $numtok(%h,32)
  %z = $w
  while (%y != $w(1)) var %y $v2
  return $calc(%y -%z)
6 Ag2X 510 bytes
alias boxes {
  tokenize 46 $remove($1. $2. $len($token($1,1,32)),$chr(32)) 
  %a = $1
  %b = $2
  %1 = $°(%a,%b,$3)
  %2 =
  while ($°(%a,%b,$3) != %2) %2 = $v1
  %2 = %2 - %1
  return %2
}
alias ° {
  var %n 0,%x $len($1) - $3,%y $len($2) - 1
  while %x {
    if (1 1 11 = $mid($1,%x,1) $mid($1,$calc(%x +$3),1) $mid($2,%y,2)) inc %n
    elseif $count($v2,0) = 1 {
      %a = $+($left(%a,$({,%x)),1,$mid(%a,$calc(1+%x),$({,$3)),1,$mid(%a,$calc(1+%x +$3)))
      %b = $+($left(%b,$({,%y)),11,$mid(%b,$calc(2+%y)))
    }
    dec %x
    dec %y
    if ($calc(1+$3) // %y) dec %y
  }
  return %n
}
7 Zenexer 669 bytes
alias o return $puttok($1,$base($biton($base($gettok($1,$2,32),2,10),$calc($4)),10,2,$3),$2,32)
alias boxes {
  %d = $numtok($2,32)
  %e = %d + 1
  %1 = $1
  %2 = $2
  %r = n
  :s
  %by =
  %b =
  %y = %d
  while %y > 0 {
    %x = %d
    %t =
    while %x > 0 {
      %p = $gettok(%2,%y,32)
      %t = $calc($mid(%p,%x,1)+ $mid(%p,$calc(%x +1),1)) $+ %t
      dec %x
    }
    %b = $base($calc(%t + $gettok(%1,$calc(%y +1),32)+ $gettok(%1,%y,32)),10,10,%d) %b
    dec %y
  }
  if (%r = n) %r = $pos(%b,4,0)
  if ($pos(%b,3,0) < 1) return $calc($pos(%b,4,0)- %r)
  %p = $pos($remove(%b,$chr(32)),3,1)
  %x = %p % %d
  %x = $iif(%x,%x,%d)
  %y = $calc((%p - %x)/ %d +1)
  %1 = $o($o(%1,%y,%d,%e - %x),$calc(%y +1),%d,%e - %x)
  %2 = $o($o(%2,%y,%e,%e - %x +1),%y,%e,%e - %x)
  goto s


Invalid entries:

A Noniem 355 bytes * Failed on test: 100 010 001 011,1111 1101 1100 = 5 should of returned 4
alias boxes {
  %a = $numtok($2,32)
  bset -t &a 1 $1
  bset -t &b 1 $2
  %t = $^
  $(,$str(. $!^(49),99))
  return $calc($^ -%t)
}
alias ^ {
  %b = 0
  %u =
  while %b < 99 {
    %c = %b / %a
    %e = $calc(2+%a +$or(%c)*(1+%a)+%b % %a)
    %w = $calc(-1+%e -%a)
    %h = %w + %c
    if $pos($bvar(&a,%w) $bvar(&a,%e) $bvar(&b,%h,2) $1,49,4) {
      bset &a %w 49
      bset &a %e 49
      bset &b %h 49 49
      inc %u
    }
    inc %b
  }
  return %u
Albie 368 bytes * Failed on test: /-1: not connected to server (line 33, Albie.mrc)
alias boxes {
  %1 = $1
  %2 = $remove($2,$chr(32))
  %% = 0
  %z = $numtok($2,32)

  x 4 -1
  while ($x(3,return 1)) /
  x 4

  return %%
}
alias x {
  %i = 100
  while %i {
    %a = $calc((%i -1)/%z +%i)
    %b = %a + %z
    inc %b

    if $count($mid(%1,%a,1) $mid(%1,%b,1) $mid(%2,%a,2),1) = $1 {
      bunset &t
      %t = bset -t &t

      %t 1 %2
      %t %a 11
      %2 = $bvar(&t,1-).text

      %t 1 %1
      %t %a 1
      %t %b 1
      %1 = $bvar(&t,1-).text

      $2
      inc %% $2
    }
    dec %i
  }
Kol 546 bytes * Failed on test: 0000000 1111111 1000011 1001000 0000001 0011110 1111111 1000000, 11011011 01011010 01100111 01111001 01100010 01000010 01111011 = 29 should of returned 28
alias x {
  %m = $2-
  %n = $(,% $+ $1)
  inc %3
  set % $+ $1 $+($left(%n,%m),1,$mid(%n,$calc(2+%m)))
}
alias z return $mid($1,$calc($2),1)
alias boxes {
  %1 = $1
  %2 = $2
  %3 = 0
  :o
  %o = 1
  %j = 1
  %l = 0
  %s = $len($gettok(%1,1,32))
  while %o < $len(%2) {
    %c = %j + %l
    %d = %c + %s
    %a = $+($z(%2,%o),$z(%2,1+%o),$z(%1,%c),$z(%1,1+%d))
    %g = goto o
    goto %a
    :0111
    x 2 %o - 1
    %g
    :1011
    if ($z(%1,1+%c) $z(%1,1+%d) $z(%2,2+%o) = 1 1 1) x
    x 2 %o
    %g
    :1101
    x 1 %c - 1
    %g
    :1110
    if ($z(%1,%d +2+%s) $z(%2,%o +2+%s) $z(%2,%o +3+%s) = 1 1 1) x
    x 1 %d
    %g  
    :%a
    if %s // %j {
      inc %o 2
      inc %l
    }
    inc %o
    inc %j 

  }
  return %3
chid 982 bytes * Failed on test: 111111111 111111111 111111111 111111111 111101111 010000010 010000010 110000011 111101111 111111111,1000000001 1000000001 0000000000 1000000001 0000110000 0110110110 0110110110 0010110010 1000000001 = 42 should of returned 44
alias boxes {
  ;let's count boxes
  %r =
  %bc = $count($1,$chr(32))
  inc %bc | ;just because it's convenient
  %i = 
  while !%i {
    %i = 1
    ;loop through all the positions
    %c = 1
    %1 = $1
    %2 = $2
    echo $iif(#,#,-a) START %1 %2
    while $mid(%1,%c,1) isin 1 0 {
      %line = $int($calc(%c / %bc))
      if $calc(%c % %bc) > 0 {  
        ;e h2 %c %bc
        ;if ($count(%c $calc(%c + %bc) $calc(%c + %line) $calc(%c + %line + 1),1) = 3
        ;echo -a %c $calc(%c + %bc) $calc(%c + %line)
        var %s = $mid($1,%c,1) $mid($1,$calc(%c + %bc),1) $mid($2,$calc(%c + %line),2)
        if $count(%s,1) == 3 && $len(%s) == 6 {
          echo 4 $iif(#,#,-a) INC
          inc %r
          echo $iif(#,#,-a) Initial %1 & %2
          %i = 0
          %1 = $ins(%1,%c,1)
          %1 = $ins(%1,$calc(%c + %bc),1)
          %2 = $ins(%2,$calc(%c + %line),1)
          %2 = $ins(%2,$calc(%c + %line + 1),1)
          echo $iif(#,#,-a) Final %1 & %2
          ;return Done
        }
      }      
      inc %c
    }
    ;   echo -a %1 . %2 & % $+ i is currently %i
    ;
    ;clipboard //echo -a $!boxes( $+ %1 $+ , $+ %2 $+ )
    ;break
    tokenize 2 $+(%1,,%2)
  }



  return $calc(%r)




}

alias ins {
  return $left($1,$({,$2)) $+ $3 $+ $mid($1,$calc($2 +1))
}
Natdhib 1388 bytes * Failed on test: 0000000 1111111 1000011 1001000 0000001 0011110 1111111 1000000, 11011011 01011010 01100111 01111001 01100010 01000010 01111011 = 15 should of returned 28
Alias Boxes {
  var %w00a = $1
  var %w00b = $2
  var %s001 = 0
  var %s002 = 0
  var %s003 = 0
  :again
  var %w001 = %w00a
  var %w002 = %w00b
  var %w003 = $numtok(%w001,32)
  var %w004 = $numtok(%w002,32)
  var %w006 = 1
  while (%w006 <= %w004) {
    var %w005 = 1
    while (%w005 <= $len($gettok(%w001,1,32))) {
      var %c001 = $dim(%w001,%w006,%w005,0)
      var %c002 = $dim(%w001,%w006,%w005,1)
      var %c003 = $dim(%w002,%w006,%w005,0)
      var %c004 = $dim(%w002,%w006,%w005,0,1)
      var %w007 = $calc(%c001 + %c002)
      var %w008 = $calc(%c003 + %c004)
      var %w009 = $calc(%w007 + %w008)
      var %w011 = $+(%w011,%w009)
      var %r001 = $iif(%w009 = 3,1,%c001)
      var %r002 = $iif(%w009 = 3,1,%c002)
      var %r003 = $iif(%w009 = 3,1,%c003)
      var %r004 = $iif(%w009 = 3,1,%c004)
      var %r005 = $+(%r005,%r001)
      var %r006 = $+(%r006,%r002)
      var %r007 = $+(%r007,%r003)
      var %r008 = $+(%r008,%r004)
      if (%s001 = 0) {
        if (%w009 = 4) { inc %s002 }
      }
      if (%s001 = 1) {
        if (%w009 = 4) { inc %s003 }
      }
      inc %w005
    }
    var %w012 = %w012 %w011
    var %r009 = %r009 %r005
    var %r010 = %r010 %r006
    var %r011 = %r011 $+($left(%r007,1),%r008)
    var %r005
    var %r006
    var %r007
    var %r008
    var %w011
    inc %w006
  }
  var %r012 = $gettok(%r009,1,32) %r010
  var %r013 = $+(%r012,$chr(44),%r011)
  if (%s001 = 0) { inc %s001 | var %w00a = %r012 | var %w00b = %r011 | goto again }
  echo $color(info) *** %r013 %s003
  return $calc(%s003 - %s002) 
}
Alias Dim {
  var %data = $mid($gettok($1,$iif($4 = 1,$calc($2 + 1),$2),32),$iif($5,$calc($3 + 1),$3),1)
  return %data
}



Regex entries

Top entries:

1 Kylar 297 bytes
alias c return $regex($3,/1(?=.{ $+ $2 $+ }1)(?=.{ $+ $1 $+ }11)/g)
alias boxes {
  var %g $numtok($2,32),%l $len($1),%p $1 $regsubex($2,/ /g,),%i 1,%r 0
  while $pos(%p,0,%i) {
    %n = $regsubex(%p,(.{ $+ $(},$v1) $+ }).,\t1)
    if $c(%l,%g,%p) < $c(%l,%g,%n) {
      %p = %n
      %i = 0
      inc %r $v2
      dec %r $v1    
    }
    inc %i
  }
  return %r
2 urza 316 bytes
alias boxes {
  var %x 1,%b 0,%t #$1@ $2
  while $regsub($replace(%t,A,%r),/^( $str(.,%x) *?)(0)/x,\1A,%t) {
    var %x $regml(2).pos,%1 .,%2,%r 0

    while $regsubex(%t,/^ %1 (.) $str(.,$numtok($2,32)) (.).*@ %1 %2 (..).*/x,\A) != %t {
      if (???? !iswm $v1) %2 = %2 .
      if $regex($v2,^1*A1*$) {
        inc %b
        %r = 1
        %x = 
      }
      %1 = %1 .
    } 
    inc %x
  }
  return %b