Write a method that takes a 2d array of ints and
two ints representing possible row and column indexes into
the array. Return a boolean indicating whether the two ints
are valid indexes into the array. (Hint: this method may be useful when
writing some of the subsequent methods.)
Write a method that takes a 2d array of ints and
two ints representing valid row and column indexes into the
array. Return an int which is the sum of the four neighbors
to the north, south, east, and west of the give row and column.
Write a method that takes a 2d array of ints and
two ints representing valid row and column indexes into the
array. Return an int which is the sum of all eight
surrounding neighbors (north, south, east, and west and also northeast,
northwest, southeast, and southwast) of the given now and column.
Write a method that takes four int arguments representing, in
order, one row and column and then a second row and column and returns
a boolean indicating whether the two points are horizontal,
vertical, or diagonal neighbors in a 2d array. You can assume that all the
indexes are valid.
Write a method that takes a 3x3 array of Strings representing
a tic tac toe board, with each element set to
either "X", "O", or null and
returns the winner ("X" or "O") if there is one
and null otherwise. Note: you may want to write one or more
helper methods, such as a method that tells you whether there is a winner
in a specific row, etc.