For a project we need to make the Abalone game completely in java. Now, for the communication we agreed with other groups upon using indexes to send marble locations to the server. The thing is, I have this huge board with axial coordinates, looking like this:
| 0,4 | 0,5 | 0,6 | 0,7 | 0,8 |
-------------------------------------------------
| 1,3 | 1,4 | 1,5 | 1,6 | 1,7 | 1,8 |
---------------------------------------------------------
| 2,2 | 2,3 | 2,4 | 2,5 | 2,6 | 2,7 | 2,8 |
-----------------------------------------------------------------
| 3,1 | 3,2 | 3,3 | 3,4 | 3,5 | 3,6 | 3,7 | 3,8 |
-------------------------------------------------------------------------
| 4,0 | 4,1 | 4,2 | 4,3 | 4,4 | 4,5 | 4,6 | 4,7 | 4,8 |
-------------------------------------------------------------------------
| 5,0 | 5,1 | 5,2 | 5,3 | 5,4 | 5,5 | 5,6 | 5,7 |
-----------------------------------------------------------------
| 6,0 | 6,1 | 6,2 | 6,3 | 6,4 | 6,5 | 6,6 |
---------------------------------------------------------
| 7,0 | 7,1 | 7,2 | 7,3 | 7,4 | 7,5 |
-------------------------------------------------
| 8,0 | 8,1 | 8,2 | 8,3 | 8,4 |
How do I write a function where it takes the row and colomn as parameters, and converts them to an index (starting in the top left with 0, and ending with 60 in the bottom right), without just hard coding that row 0, colomn 4 = 0.
Thanks in advance!