0

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);

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

2
Contributors
2
Replies
5
Views
6 Years
Discussion Span
Last Post by mathews123
0

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

0

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..

Edited by mathews123: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.