HasPlusPattern

HasPlusPattern - { char c = myArray[row][column]; if ( ' '...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
boolean hasPlusPattern(char myArray[][]) { // step through EACH row in the 2-d array int row, column; // the grid is myArray.length x myArray.length // for each row for(row=0;row < myArray.length - 2;row++) { // look in each spot in row "row" for(column=1;column < myArray.length-1;column++)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { char c = myArray[row][column]; if ( ' ' != c) { if ((myArray[row+1][column] == c) &amp;&amp; (myArray[row+1][column-1] == c) &amp;&amp; (myArray[row+1][column+1] == c) &amp;&amp; (myArray[row+2][column] == c)) return true; } } } return false; }...
View Full Document

Ask a homework question - tutors are online