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 patje 114
  14 Auron956 114
  15 chid 110
  16 Ohad2121 92
  17 SkorpSSS 87
  18 DixrouE 84
  19 Suchorski 83
  20 ^Vampire^ 74
Challenge:Smallest $redist
Start:August 24th 2009
End:August 29th 2009
Description:

In this challenge, you are asked to create an alias that will 'redistribute' the given 'liquids' so that each 'container' is filled to its maximum capacity.

Simple example

$redist(4,a2,a2,a2) = a4 a2
Let's take a look at the above example. You have been given an unlimited amount of new, unfilled containers, each can hold 4 units ($1). You have been given 3 containers, each holding 2 units of liquid 'a' ($2-) so a total of 6 units of liquid 'a'. If I was to redistribute the liquids so that as many containers were filled to their maximum capacity as possible (4) -- I would get a4 a2.

Specifications

Input:

  • $1 will always be a whole number >= 1 (representing the maximum capacity of a container)
  • $2 will always be a letter from a-z (lowercase) followed by a whole number >= 1 (representing a container, a liquid within it and how many units of that liquid are in it)
  • Amount of liquid in the single container $2- MAY be more than $1
  • There can be infintely more parameters following the same format as $2 representing other containers
  • In $2-, there may be multiple types of liquids, it must support something like $redist(3,a4,b3,b2,a2) (which is a3 a3 b3 b2)

Output:

  • Must return all the liquids in containers that are filled to $1 and if is any liquid left over, a separate container for that too eg. $redist(4,a2,a2,a2) -> a4 a2 NOT a4
  • Each container should be space delimited, with the type of liquid first, followed by the amount of units that container may hold
  • The containers may be returned in any order, e.g. $redist(4,a3,a3) -> 'a4 a2' OR 'a2 a4' (all examples above may have other combinations that I didn't specify)
  • Update: your alias can return either upper case or lower case output


Example:

$redist(4,a2,a2,a2) = a4 a2

$redist(4,x3,x3,x3) = x4 x4 x1

$redist(4,a1,a1) = a2

$redist(8,k3,k6,k4,k9) = k8 k8 k6

$redist(111,m145,z54,m195,m12,z64) = m111 m111 m111 m19 z111 z7

$redist(2,b50) = b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2

$redist(4,a4,a3,a7,b2,b8,d5,d9,e2,e3,e1,a2,c4,c3) = a4 a4 a4 a4 b4 b4 b2 c4 c3 d4 d4 d4 d2 e4 e2

$redist(18315031,a13853102,a1375135,a15385325,b10857135,b1249531,b14752495) = a18315031 a12298531 b18315031 b8544130
Since the output can be in any order, the above examples are just returned in alphabetical order.

Your alias does not have to match the output as long as all the tokens are returned.


Rules:

  • Tested in a clean, offline mIRC 6.35
  • Will be loaded in ALIASES section (i.e "redist {" -- NOT "alias redist {"
  • MUST HAVE closing bracket -- if not supplied it WILL be added on
  • No COMs, DLLs, or sockets
  • Alias must give correct results after consecutive runs
  • As stated before, the alias must work in THEORY with any numbers/amount of parameters.
    Obviously mIRC's calculation and line-length limits prevent it from practically working with any number but if these limits didn't exist, the alias would be able to support things like $redist(2,a108235171208457213850135)