Hello, java developers! Im a 4th year Computer Science Student from the Philippines, Im currently Developing a board game and i think im finished with the game proper. Now I want to extend it that it can be played in an Intranet envirom ment. The point is I dont know where to start in network programming, I need help on it. Some advice or may be codes will help.

private BufferedImage img; // image for the background of the game interface. boolean inGameState; // gives true or false if a game is in progress. int currentPlayer; // the current player to move. int rowSelected, colSelected; // the row and column of the selected piece of the current player. private JButton newGameButton; // Button for starting a new game. private JButton quitButton; // Button to quit a game. private JLabel message; // Label for displaying messages to the user. int numberofJapanese; // the number of Japanese pieces.

/* instance of the class Piece, the pieces and the moves * of the game are saved at set here. */ Piece boardPiece;

BataanMoves[] validMoves; //array containing all the valid moves for the current player.

/* The main method creates a new JFrame as the window * and sets the calss Bataan as it's content. */ public static void main(String args[]) { JFrame window = new JFrame("Bataan: Battle of the Philippines"); Bataan game = new Bataan(); window.setSize(700, 700); window.add(game); window.setLocation(400, 20); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setResizable(false); window.setVisible(true); }

/* The class contructor sets all the properties of the class * and initializes the background image. */ public Bataan() {

/** * An object of this class holds data about the game of Bataan: Battle of the Philippines. * It knows what kind of piece is on each square of the board. * Methods are provided to return lists of available legal moves. */ private static class Piece {

static final int American = 1, Japanese = 2, Empty = 0, NotPartofBoard = -1; //constants that hold the players and the empty slot in the board. int[][] myBoard; //array to store the contents of the board in specifis row and column.

public Piece() { //contructor to save the pieces in the board and set it up for a new game. myBoard = new int[9][9]; setGame(); }

//returns the content of the specific pair of row and column in the board. int pieceAt(int Row, int Col) { return myBoard[Row][Col]; }

/** * Make the specified move. It is assumed that move * is non-null and that the move it represents is legal. */ void piecedoMove(BataanMoves move) { piecedoMove(move.currentRow, move.currentCol, move.nxtRow, move.nxtCol, pieceAt(move.currentRow, move.currentCol)); }

/** * Make the move from (currentRow,currentCol) to (nxtRow,nxtCol). It is * assumed that this move is legal. If the move is a jump, the * jumped piece is removed from the board. */ void piecedoMove(int currentRow, int currentCol, int nxtRow, int nxtCol, int player) {

/** * This is called by the two getValidMoves() and getValidJumps() methods to check whether the * player can legally jump from (r1,c1) to (r3,c3). It is assumed * that the player has a piece at (r1,c1), that (r3,c3) is a position * that is 2 rows and 2 columns distant from (r1,c1) and that * (r2,c2) is the square between (r1,c1) and (r3,c3). */ private boolean pieceCanJump(int player, int r1, int c1, int r2, int c2, int r3, int c3) { //only the American piece can do a jump. if (player == American && myBoard[r1][c1] == American) { //(r3,c3) is out of the board. if (r3 < 0 || r3 >8 || c3 < 0 || c3 >8 || myBoard[r3][c3] == NotPartofBoard) { return false; } //(r3,c3) contains a piece. if (myBoard[r3][c3] != Empty) { return false; } //there is no Japanese piece to jump on. if (myBoard[r2][c2] != Japanese) { return false; }

/** * Return an array containing all the legal BataanMoves * for the specified player on the current board. If the player * has no legal moves, null is returned. The value of player * should be one of the constants American and Japanese; if not, null * is returned. If the returned value is non-null, it consists * entirely of jump moves if the player is an American or entirely of regular moves if Japanese, since * if the player can jump, only jumps are legal moves. */ BataanMoves[] getValidMoves(int player) { //player is not an American or a Japanese. if (player != American && player != Japanese) { return null; }

/* Check all squares on the board for any possible jumps for the current * player if the player is Japanese nothing will be stored. If the player is an American * it checks the eight possible directions from that square if a jump is available it is * stored in the array list. */ for (int row = 0; row <= 8; row++) { for (int col = 0; col <= 8; col++) { if (myBoard[row][col] == player) { if(row%2 == col%2){

/*After checking if there are available jumps and the array list is still empty, * the second check is if there are valid normal move for the player,still every * square of the board is checked for all the valid moves in the players piece. */ if (moves.isEmpty()) { for (int row = 0; row <= 8; row++) { for (int col = 0; col <= 8; col++) { if (myBoard[row][col] == player) { if(row%2 == col%2){

/** * Return a list of the legal jumps that the specified player can * make starting from the specified row and column. If no such * jumps are possible, null is returned. The logic is similar * to the logic of the getLegalMoves() method. */ BataanMoves[] getValidJumps(int player, int row, int col) { if (player != American) { return null; }

private BufferedImage img; // image for the background of the game interface. boolean inGameState; // gives true or false if a game is in progress. int currentPlayer; // the current player to move. int rowSelected, colSelected; // the row and column of the selected piece of the current player. private JButton newGameButton; // Button for starting a new game. private JButton quitButton; // Button to quit a game. private JLabel message; // Label for displaying messages to the user. int numberofJapanese; // the number of Japanese pieces.

/* instance of the class Piece, the pieces and the moves * of the game are saved at set here. */ Piece boardPiece;

BataanMoves[] validMoves; //array containing all the valid moves for the current player.

/* The main method creates a new JFrame as the window * and sets the calss Bataan as it's content. */ public static void main(String args[]) { JFrame window = new JFrame("Bataan: Battle of the Philippines"); Bataan game = new Bataan(); window.setSize(700, 700); window.add(game); window.setLocation(400, 20); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setResizable(false); window.setVisible(true); }

/* The class contructor sets all the properties of the class * and initializes the background image. */ public Bataan() {

/** * An object of this class holds data about the game of Bataan: Battle of the Philippines. * It knows what kind of piece is on each square of the board. * Methods are provided to return lists of available legal moves. */ private static class Piece {

static final int American = 1, Japanese = 2, Empty = 0, NotPartofBoard = -1; //constants that hold the players and the empty slot in the board. int[][] myBoard; //array to store the contents of the board in specifis row and column.

public Piece() { //contructor to save the pieces in the board and set it up for a new game. myBoard = new int[9][9]; setGame(); }

//returns the content of the specific pair of row and column in the board. int pieceAt(int Row, int Col) { return myBoard[Row][Col]; }

/** * Make the specified move. It is assumed that move * is non-null and that the move it represents is legal. */ void piecedoMove(BataanMoves move) { piecedoMove(move.currentRow, move.currentCol, move.nxtRow, move.nxtCol, pieceAt(move.currentRow, move.currentCol)); }

/** * Make the move from (currentRow,currentCol) to (nxtRow,nxtCol). It is * assumed that this move is legal. If the move is a jump, the * jumped piece is removed from the board. */ void piecedoMove(int currentRow, int currentCol, int nxtRow, int nxtCol, int player) {

/** * This is called by the two getValidMoves() and getValidJumps() methods to check whether the * player can legally jump from (r1,c1) to (r3,c3). It is assumed * that the player has a piece at (r1,c1), that (r3,c3) is a position * that is 2 rows and 2 columns distant from (r1,c1) and that * (r2,c2) is the square between (r1,c1) and (r3,c3). */ private boolean pieceCanJump(int player, int r1, int c1, int r2, int c2, int r3, int c3) { //only the American piece can do a jump. if (player == American && myBoard[r1][c1] == American) { //(r3,c3) is out of the board. if (r3 < 0 || r3 >8 || c3 < 0 || c3 >8 || myBoard[r3][c3] == NotPartofBoard) { return false; } //(r3,c3) contains a piece. if (myBoard[r3][c3] != Empty) { return false; } //there is no Japanese piece to jump on. if (myBoard[r2][c2] != Japanese) { return false; }

/** * Return an array containing all the legal BataanMoves * for the specified player on the current board. If the player * has no legal moves, null is returned. The value of player * should be one of the constants American and Japanese; if not, null * is returned. If the returned value is non-null, it consists * entirely of jump moves if the player is an American or entirely of regular moves if Japanese, since * if the player can jump, only jumps are legal moves. */ BataanMoves[] getValidMoves(int player) { //player is not an American or a Japanese. if (player != American && player != Japanese) { return null; }

/* Check all squares on the board for any possible jumps for the current * player if the player is Japanese nothing will be stored. If the player is an American * it checks the eight possible directions from that square if a jump is available it is * stored in the array list. */ for (int row = 0; row <= 8; row++) { for (int col = 0; col <= 8; col++) { if (myBoard[row][col] == player) { if(row%2 == col%2){

/*After checking if there are available jumps and the array list is still empty, * the second check is if there are valid normal move for the player,still every * square of the board is checked for all the valid moves in the players piece. */ if (moves.isEmpty()) { for (int row = 0; row <= 8; row++) { for (int col = 0; col <= 8; col++) { if (myBoard[row][col] == player) { if(row%2 == col%2){

/** * Return a list of the legal jumps that the specified player can * make starting from the specified row and column. If no such * jumps are possible, null is returned. The logic is similar * to the logic of the getLegalMoves() method. */ BataanMoves[] getValidJumps(int player, int row, int col) { if (player != American) { return null; }

I'm planning to develop a board game in an intranet environment for my Thesis, this game is somewhat similar to Checkers.The game is called "Bataan: Battle of the Philippines". I need some help on where to start or what to implement first. Any help or advice from you guys is a big help for me.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org