of     1   

Shalaen
#182497904Wednesday, January 27, 2016 12:05 PM GMT

What would be the most efficient way to check whether a player had gotten a 'combination' or whatever, a line?
128Gigabytes
#182498216Wednesday, January 27, 2016 12:26 PM GMT

local tic = { {1, 1, 1}; {2, 2, 1}; {0, 0, 0}; } local function getMatch() if ((tic[1][1] == tic[1][2]) and (tic[1][2] == tic[1][3]) and (tic[1][1] ~= 0)) then return (((tic[1][1] == 1) and "x" or "o") .. " across top"); elseif ((tic[2][1] == tic[2][2]) and (tic[2][2] == tic[2][3]) and (tic[2][1] ~= 0)) then return (((tic[2][1] == 1) and "x" or "o") .. " across middle"); end end You get the idea, I don't want to right it all out
HuskiesPancake
#182502022Wednesday, January 27, 2016 3:19 PM GMT

*write* GRAMMAR POLICE SiggyWigi
128Gigabytes
#182508425Wednesday, January 27, 2016 6:27 PM GMT

I went ahead and finished it Its not super efficient because I didn't want to do so much typing so I just put my check in a function, but you get the idea and with something as simple as this (I mean processing wise, I'm not trying to talk bad about you OP) you don't really need to worry about that. local tic = { {1, 2, 1}; {2, 2, 1}; {0, 2, 0}; } local function check(x, y, z) return (((tic[tonumber(tostring(x):sub(1, 1))][tonumber(tostring(x):sub(2, 2))] == tic[tonumber(tostring(y):sub(1, 1))][tonumber(tostring(y):sub(2, 2))]) and (tic[tonumber(tostring(y):sub(1, 1))][tonumber(tostring(y):sub(2, 2))] == tic[tonumber(tostring(z):sub(1, 1))][tonumber(tostring(z):sub(2, 2))])) and (tic[tonumber(tostring(x):sub(1, 1))][tonumber(tostring(x):sub(2, 2))] ~= 0)); end local function getMatch() if (check(11, 12, 13)) then print(((tic[1][1] == 1) and "x" or "o") .. " across top") elseif (check(21, 22, 23)) then print(((tic[2][1] == 1) and "x" or "o") .. " across middle") elseif (check(31, 32, 33)) then print(((tic[3][1] == 1) and "x" or "o") .. " across bottom") elseif (check(11, 21, 31)) then print(((tic[1][1] == 1) and "x" or "o") .. " down left") elseif (check(12, 22, 32)) then print(((tic[1][2] == 1) and "x" or "o") .. " down middle") elseif (check(13, 23, 33)) then print(((tic[1][3] == 1) and "x" or "o") .. " down right") elseif (check(11, 22, 33)) then print(((tic[1][1] == 1) and "x" or "o") .. " across from top left") elseif (check(31, 22, 13)) then print(((tic[3][1] == 1) and "x" or "o") .. " across from bottom left") end end print(getMatch())

    of     1