Description:
In this challenge you are asked to create an alias that will return the winner of the game Rock, Paper, Scissors.
Two parameters will be passed to the alias;
r = Rock
p = Paper
s = Scissors
The alias must return the winner of the game;
-1 if $1- is invalid input i.e. not r/p/s
0 if its a draw
1 if $1 wins
2 if $2 wins
Your alias must be case in-sensitive. You must assume any values of any length can be passed as either $1 or $2. In any event of an invalid input (i.e. anything other than purely r/p/s, your alias should return -1).
You should return -1 if $3- is supplied i.e. $rps(r,p,r) should return -1
Example:
$rps(r,p) = 2
$rps(p,r) = 1
$rps(s,s) = 0
$rps(s,p) = 1
$rps(s,r) = 2
$rps(R,s) = 1
$rps(rr,s) = -1
$rps(1,s) = -1
$rps(;,) = -1
$rps(r,pp) = -1
$rps(p1,s2) = -1
$rps(ppr,s) = -1
$rps(r,r,p) = -1
$rps(r,p,0) = -1
$rps(r,s,$false) = -1
Rules:
Alias name must be 'rps'No dlls, coms, sockets or regular expressionsOne submission per user.Script must give correct results after consecutive runs.
Testing conditions:
Alias will be run on mIRC v6.35 and loaded into the remotes section.Your code will be taken for EXACTLY as-is.Alias will be run on a mIRC with no variables set - a clean mIRC.
Countcode:
(coded by garreh)