I am programming a game that has a board sort of like chess. You move around a cursor and different buttons do different things (lol, I'm so vague). The board has an underlying matrix that has a slot for each square on the board.
To know if the player won or not, I need to check the sum of all elements in the matrix to see if it is equal to the goal number. It'd make sense to do that every main loop. Now here's the fun part: there is no sum( command for matrices. It doesn't make much sense to me, but you have to write your own formula for this. I know there's a wiki page on this, but the formula stated there seemed wrong to me after studying the Matr>list( command. It also doesn't work.
I tried making my own formula for calculating the sum of all elements in a matrix: cumSum(cumSum([A])T). This gives you a matrix from which you need to take the value in the very last slot. It does the job, but it makes the game loop really slow, so I'll need something faster. Anyone any suggestions on what I should use?