I am working on a Lua script(cell automation) and now I need to divide the cellularspace into 4 parts, each part has its own function, I use the following code (might looks stupid to some of you) :
if cells:getCell(Coord{x < 25 ,y < 25}) then
cell.P = (cell.past.P + e*i1 + u1*i2)
elseif cells:getCell(Coord{x < 25 ,y > 25})then
cell.P = (cell.past.P + e*i1 + u2*i2)
elseif cells:getCell(Coord{x > 25 ,y < 25})then
cell.P = (cell.past.P + e*i1 + u3*i2)
else
cell.P = (cell.past.P + e*i1 + u4*i2)
end
Now I would like ask what is the right way to rewrite the above code? Any functions? Thank you!