# Line of Action Game Help plz

• April 22nd, 2013, 05:06 PM
walid
Line of Action Game Help plz
Lines of Action is a two player strategy board game where each player aims to connect all his/her checkers
into one group. The board is a standard 88 chessboard. The game starts with each player having 12
checkers. The black checkers are placed horizontally on the two rows along the top and bottom of the
board, while the white checkers are placed vertically on the two columns at the left and right of the
board. The 2 players alternate at moving their checkers in the three lines of action: vertical, horizontal
and diagonal. The first player to get all her/his checkers into a single connected group wins.
rules of game
1. Players alternate turns. The white moves rst.
2. Checkers move in the 3 lines of action: horizontally, vertically, or diagonally.
3. The number of squares moved by a checker must be exaclty the same as the number of checkers
(belonging to both players) in that line of action.
4. A checker belonging to a player may jump over other checkers belonging to that player, but it may
not jump over checkers belonging to the opponent.
5. A checker captures an opponent's checker by landing on it.
**game over
The first player to connect all her/his checkers into a single group is the winner.
2. If one player is reduced by captures to a single piece, that is a win for the captured player.
3. If a move lead to both players being winners, the player who made that move is the winner.

--- Update ---

i have problem with the method GameOver i used recrusion method but it doesn't work on the tests
recrusion method to check the 8 directions around the given point on the 2D array
any idea

--- Update ---

Norm can you help me
• April 22nd, 2013, 05:49 PM
Norm
Re: Line of Action Game Help plz
Quote:

it doesn't work
Please explain what happens and what the problem is.
• April 22nd, 2013, 06:28 PM
Norm
Re: Line of Action Game Help plz
Please edit the code and format it so that nested statements are indented 3-4 spaces. Statements should NOT all start in the first column.

Make a small complete program that compiles and executes for testing. Hardcode whatever arrays,etc are needed for testing the method and call the method for testing.

The posted code is useless for testing. There needs to be code that compiles and executes.
• April 22nd, 2013, 06:53 PM
walid
Re: Line of Action Game Help plz
in method isGameOver i made a loop on boolean array to catch the first piece count around region in 8 direction . can you tell me another idea to count the around region to count the connected checker

--- Update ---

??
• April 22nd, 2013, 07:01 PM
Norm
Re: Line of Action Game Help plz
Is the code supposed to check the 8 squares that surround a square in the middle of a 2 dim array?
• April 22nd, 2013, 07:18 PM
walid
Re: Line of Action Game Help plz
No it supposed to check the 8 squares everywhere in 2D array not only in the middle

--- Update ---

??
• April 22nd, 2013, 07:25 PM
Norm
Re: Line of Action Game Help plz
If the square is at an edge, will there be 8 squares to check?
• April 23rd, 2013, 11:56 AM
walid
Re: Line of Action Game Help plz
no will be 4 squares but the game Board is constant 8*8 my problem with the recursion method can you check it . i made another boolean array to check if this piece is counted turn it into true. ??!!
• April 23rd, 2013, 12:01 PM
Norm
Re: Line of Action Game Help plz
Quote:

problem with the recursion method
Is there a small, complete program you can post that can be compiled and executed for testing?

When you post code, be sure to properly format it. The code in post#3 needs formatting.
• April 23rd, 2013, 12:06 PM
walid
Re: Line of Action Game Help plz
sorry how can i post my code formatting
and what code can i posted the testing or my code
• April 23rd, 2013, 12:12 PM
Norm
Re: Line of Action Game Help plz
Formatting conventions: Code Conventions for the Java Programming Language: Contents

Look at other threads with code on this forum. Many have code that is properly formatted.

Here's a sample:
Code :

``` public ExtractBoards(String inFile, String folder, String pfx) { if(inFile.endsWith(HTML_Ext)) { readHtmlFile(inFile);   }else if(inFile.endsWith(LIN_Ext)){ readLinFile(inFile);   }else { JOptionPane.showMessageDialog(null, "Unknown file type: "+inFile, "Error", JOptionPane.ERROR_MESSAGE); return; }   if(boards.size() < 1) { System.out.println("No boards found"); return; // exit now }   // Show some for(int i=0; i < Math.min(boards.size(),MaxBoards); i++) { System.out.println(boards.get(i)); }```

Quote:

what code can i posted the testing or my code
Make a class with the minimum variable definitions needed to execute the method. Call the method to be tested from the testing class's constructor.
• April 23rd, 2013, 12:43 PM
walid
Re: Line of Action Game Help plz
can you tell me a another way to check the winner with connected checkers and i make in the move method if your destination is the opponent decrement the number of checkers of the opponent