Results:
Another very successful challenge with
40 entries total and because of no validation, almost every entry passed.
For the first time ever we have three way tie winners
(below is in order of submission date).
Winner! jaytea (135 bytes!)
alias tictac {
%a =
:)
inc %b $mid($1,$mid(123456789147258369159357,%a,1),1) 0
%c = %b / 3
if 3 // %a {
%b =
if 1 // %c return %c
}
dec %a
goto )
Winner! Kol (135 bytes!)
CG
42
2C
1K
7L
21
84
7
0
alias tictac {
%x =
:3
inc %x
%y = 0
:%y
if $replace($base($read($script,%x),36,2,9),0,?,1,%y) iswm $1 return %y
inc %y
goto %y
Winner! Chessnut (135 bytes!)
alias tictac {
%i = 24
:3
%o = 0
while %i {
%o = $or(%o,$mid($1,$mid(123456789147258369159357,%i,1),1))
dec %i
if 3 // %i goto %o
}
:%o
return %o
Top Entries
Invalid Entries
| bindi | 42 bytes | * Failed on all tests ;) |
| Kylar | 81 bytes | * Passes all tests but uses regex -- against the rules. Nice entry though :) |
| blink | 176 bytes | * Incomplete entry |
| myndzi | 201 bytes | * Couldn't get it working even after adding $qt() :( |
| WorldDMT | 237 bytes | * Disqualified because submitted under new name |
| kopper | 262 bytes | * Failed on test 28 $tictac(112221112) returned 2 should of returned 0 |
| vliedel | 9133 bytes | * /hadd: no such table 'tictac' (line 293, vliedel.mrc) -- but fun multiplayer game over mirc |
Description:
In this challenge you are asked to create an alias that will return the winner of a game of Tic-Tac-Toe.
One parameter will be passed to the alias -- the grid. The grid can consist of the following:
1 for Player 1
2 for Player 2
Specifications
- Grid will be standard 3x3 size
- Grid will be passed on one line in the format: [row1][row2][row3]
- You must return the winning player number;
- Player 1 wins, return '1'
- Player 2 wins return '2'
- Draw return '0'
Validation
You can assume the correct input is always passed to the alias. There is no need for validation in this challenge.
This includes validating if the board/grid makes sense i.e. if there are multiple winners, incorrect characters/length and if $2- is passed.
Always assume the correct parameters are passed.
Example:
$tictac(112221211) = 2
$tictac(122111122) = 1
$tictac(019jgaj) = anything you like! no validation required i.e. it won't be tested
Rules:
Alias name must be 'tictac'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)