Never mind, I just needed to increase the line buffer.
Type: Posts; User: Scotty
Never mind, I just needed to increase the line buffer.
Hiya, I have a java exercise I have to do, on which I cannot change the code only add statements. The trouble is, if it gets into an infinite loop the results of the program run off the terminal...
I am writing a game. If you assume I have the game tree, can you suggest a good minimaxing algorithm. I have one, but it doesnt always work brilliantly. Any suggestions.
I basicly find the...
The code below works, but index.add(j, i) does not update when highest does? I need to know which ones in the array were selected to be the highest. I have also tried using a variable and using...
Sorry it was an example and not typed well. It returns an int
public int token(int col, int row) {
return array[col][row] }
simply
Hiya, I have been working on a program that looks for 4 in a line in a 2D array. I have made several methods such as
if(token(i,j) == token(i+1,j) {
if(token(i+1,j) == token(i+2,j) {
...
But is it a deep copy? As when I replace the data in the first arrayList (array) then both the arrayLists change. (That or I have another error)
Does:
array.add(data.get(y));
make a deep or shallow copy? I am trying to get an arrayList to collect data but iterating though an algorithm and then place that data into a new arrayList...
Ive got it now anyway, thanks!
Problem solved. Sorry dont want to leave notes...
I can use other methods, for example
state.setArray(2);
Which puts a value in row 2 and then prints the array. These work fine.
It is definitely initialised. I cannot post code.
I have a 2D-array in a class, and methods that affect the array.
From another class I can call a method to add to the array which works fine.
My method to get a value from an array is:
...
Sorry, i have used arraylists so much lately i forgot i used an array there.
Thanks, i will check and see what i get
In a class (State):
private int[][] array = board.startArray();
public int[][] getArray() {
return array;
Works now, Thank you! (And I set the classpath so my terminal works in Ubuntu too :)) )
Build automatically was not selected, but how I have selected it, it looks right. I still get the error though. Anything else I would need to do?
The command line doesnt work - thats why I am using eclipse. Eclipse suddenly doesnt work...
All the classes disappeared when I started getting that error - I thought it created the classes when it ran the java files? Or as it went along, as I could also run them from the terminal, but never...
I am assuming this makes no sense to anyone. Thanks anyway.
Eclipse was running running fine, but now I get this error every time I try to compile:
Exception in thread "main" java.lang.NoClassDefFoundError: DrawConnect4
Caused by:...
If you have a multidimensional array in a class and some methods. A state class.
And other classes that built on that:
State: including your array
Play
PlayerTypeA
PlayerTypeB
And you had...
I assume to do with the fact I have GameState gameState = new GameState(); in both player classes, but I get a null pointer exception at move(mov) in both if I take out the new.
It sets up the board by adding the first elements to the array, but then, because move(mov), is called from different classes:.
red -- > adds R to the board. yellow --> adds R to a NEW board?!....
Hiya,
I am creating a game. I have two player classes, a gameState class and a gamePlay class (and a few other classes).
-computerPlayer extends Player
-keyboardPlayer extends Player
-...
HashSet<String> Cats = map.getAll();
int numCats = Cats.size()
I have tried in so many different ways, but I always get an unchecked exception. getAll generates a HashSet.
int numCats =...