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)