Wed Jan 27, 2010 3:32 am
public class DancingQueen
{
public static int BOARD_SIZE = 8;
public static char SPACE = ' ';
private char [][] board;
public DancingQueen()
{
board = new char [BOARD_SIZE][BOARD_SIZE];
//nested for loop
for (int row =0; row< board.length; row++)
for(int col =0; col<board.length; col++)
{
SPACE = board[row][col];
}
(ERROR COMES HERE) board(int)[(Math.random()*BOARD_SIZE)](int)[(Math.random()*BOARD_SIZE)] = 'Q' ;
int x = (int)'Q';
}
public char[][] getBoard()
{
char[][] temp = new char[board.length][board[0].length];
for(int row = 0; row < board.length; row++)
for(int col = 0; col < board[0].length; col++)
temp[row][col] = board[row][col];
return temp;
}
public String move(int fromRow, int fromCol, int toRow, int toCol)
{
if(fromRow<0 || fromRow>7 || fromCol<0 || fromCol>7){
System.out.println("Invalid from coordinate.");}
if(toRow<0 || toRow>7 || toCol<0 || toCol>7){
System.out.println("Invalid to coordinate.");}
//moves vertical, horizontal,diagnol
//||of fromCol to toCol = || fromRo to toRow
}
}
Wed Jan 27, 2010 11:14 am
board(int)[(Math.random()*BOARD_SIZE)](int)[(Math.random()*BOARD_SIZE)] = 'Q' ;
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.