I'm trying to quickly access the bottom right corner of a 2 dimensional arr

Hi. I'm trying to quickly access the bottom right corner of any 2 dimensional array. It's giving me some problems. It appears that "arrayName".length.length is incorrect. What is the correct way to do it? Help would be greatly appreciated. Thanks.
  if(gameGrid.length.length == 'X')
    cell = "alive";
    if(xCounter == 2 || xCounter == 3)
      // cell remains alive
    else
      cell = "dead";
      gameGrid.length.length = ' '; // this needs to be the bottom right [][]
  else
    if(xCounter == 3)
      gameGrid.length.length = 'X'; // this needs to be the bottom right [][]
      cell = "alive";
  xCounter = 0; // resets the counter

gameGrid.length is an int containing the length of an array
If you have an array
gameGrid[][] = new char[3][3]
then:
gameGrid is a 2-dimensional array
gameGrid.length = 3 (3 1-dimensional arrays)
gameGrid[0].length = 3 (gameGrid[0] is an array on itself)
gameGrid[1].length = 3 etc
In a 1-dimmensional array you get the last element with
myArray[ myArray.length - 1 ]
In a 2-dimmensional array its getting a bit trickier:
a = myArray.length - 1;
b = myArray[a].length;
bottomRight = myArray[a];

Similar Messages

Maybe you are looking for

  • Flex compilation error

    Hi All, I am getting flex compilation error when i deploy the models which were developed in older version7.0, now it is 7.01.I am getting the following error in 7.01 version. Flex2Compiler.Build: Error in executing a process for Flex compilation: /u

  • Drop Down by Index in Table

    Hi I wish to have a drop down by index field in my table but only in certain cells in one particular row. Once the value has been chosen I wish to then colour the two cells above the drop down. Is this possible? Regards Ian

  • Data level Security in Essbase

    I have an requirement to implement data level security in Essbase. For ex: A user can only see those data which are from Asia region or an user will be able to see those data which are from America. Asia and America are defined in my location dimensi

  • Daily Invoice Posting Summary Query

    Hello -- Question about this Query below: SELECT T1.RefDate, SUM(T0.Debit - T0.Credit) as 'Net Balance' from JDT1 T0 Inner Join OJDT T1 ON T1.TransId = T0.TransID and (T1.TransType = '13' or T1.TransType = '14') Inner Join OCRD T2 ON T2.CardCode = T0

  • Regarding hr function modules

    if to read the data from a RT table which of the following function module will be best . <b>pyxx_read_payroll_result</b> or <b>RP_FILL_WAGE_TYPE_TABLE</b> what i am doing is i am filling the rgdir table using the function module <b>cu_read_rgdir</b>