import java.util.Stack; /** * Write a description of class Board here. * * @author (your name) * @version (a version number or a date) */ public class Game { int[][] board; public Game() { board = new int[4][4]; for(int r=0;r temp = new Stack(); while(tcol=board.length) tcol--; if(board[row][tcol]==player) { while(!temp.empty()) { t=temp.pop(); r=t.getRow(); c=t.getCol(); board[r][c] = player; } } } /** * Checks left of the last players piece for possible switches */ public void checkl(int player,int row,int col) { int tcol = col-1; int r=0,c=0; Loc t; Stack temp = new Stack(); while(tcol>=0 && board[row][tcol] != player && board[row][tcol]!=0 ) { temp.push(new Loc(row,tcol)); tcol--; } if(tcol==-1) tcol=0; if(board[row][tcol]==player) { while(!temp.empty()) { t=temp.pop(); r=t.getRow(); c=t.getCol(); board[r][c] = player; } } } /** * Checks below the last players peice for possible switches */ public void checkd(int player, int row, int col) { int trow = row + 1; int r=0,c=0; Loc t; Stack temp = new Stack(); while(trow=board.length) trow--; if(board[trow][col]==player) { while(!temp.empty()) { t=temp.pop(); r=t.getRow(); c=t.getCol(); board[r][c] = player; } } } /** * Checks above the last players piece for possible switches */ public void checku(int player,int row,int col) { int trow = row-1; int r=0,c=0; Loc t; Stack temp = new Stack(); while(trow>=0 && board[trow][col] != player && board[trow][col]!=0 ) { temp.push(new Loc(trow,col)); trow--; } if(trow==-1) trow=0; if(board[trow][col]==player) { while(!temp.empty()) { t=temp.pop(); r=t.getRow(); c=t.getCol(); board[r][c] = player; } } } /** * Checks diagonally bottom right */ public void checkbr(int player,int row, int col) { int trow = row+1, tcol = col+1; int r=0,c=0; Loc t; Stack temp = new Stack(); while(trow