i tried using this where ros and cols is an integer which is equals to 8

if (i == ros || j == cols) {
										
if (i == ros && j > cols) {
											cols++;
										
} else if (i == ros && j < cols) {
											cols--;
										
} else if (j == cols && i > ros) {
											ros++;
										
} else if (j == cols && i < ros) {
											ros--;
										
}

									
										
int k = secret.nextInt();
										
Tile boardtile = playersarray[currentPlayer].gettile(k);								
										
b.add(i, j, boardtile);
										System.out.println("");
										b.Print_Board();
										System.out.println("");
										playersarray[currentPlayer].add_Tile(boardtile);
																						playersarray[currentPlayer].gettiles().remove(k);

Recommended Answers

All 2 Replies

Member Avatar for Javam

hm, I for one can not understand you question on this.
For 1: You have bad variable names.
2: well, maybe 1 is enough

basically i in this case is next row and j is next column
k is the index of letter i want to place on the board..
on first occasion my code places the letter on 8th row and 8th column of the board (middle basically)
on second occasion my code asks user where he wants to place the letter on the board thts where i and j comes in.
so basically i want my code to do as exactly as a Scrabble game online where you can only place letters next to letters you already have placed on the board either horizontally or vertically..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.