Nick Stevens

Greenhorn
+ Follow
since Nov 13, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nick Stevens

I just did a search for 'ktoolbar'and found all the files in java/bin/, hurray!
10 years ago
I installed j2me yesterday and it ran automatically after installing but now I don't know how to run it - I've looked in files in the j2mewtk directories and can't see anything to run. I'm using Ubuntu and any suggestions would be much appreciated.
10 years ago
Thanks both of you for your help, I've added an l and it compiles okay - hurray! I wonder why the compiler assumes a long 'literal' is an int? I'll be unscrambling anagrams again now :-)
11 years ago
I'm working on an anagram solver and I've found that

int 1234567890;

compiles okay (as does long 1234567890);

long 12345678901;

generates the error ': integer number too large 12345678901'. I thought 'long' variables could consist of more digits than 'int' variables? Any suggestions would be much appreciated!
11 years ago
Thanks for your replies. I've spent quite a lot of time trying to install a profiler. I've got Mandrake Linux on my pc and I've installed other things (like Firefox and Thunderbird) without any problems, but I'm still trying to get a profiler to work! Anwyay, I recently decided to take David's advice and changed all the code to use two 64-bit longs to represent the black and white board positions. The program now runs faster than it did, which is great, but from what I've read I think it could be a bit better. My pc is a Pentium II, with 500MB of RAM and the game can only really look 4 moves ahead (if it tries to search any deeper than this, it takes a long time to determine the next move). I'm already using alpha-beta pruning - good suggestion though. I'd say using alpha-beta pruning has had the biggest effect on the game speed so far.
I've recently read that a particular board position can potentially be reached by more than one sequence of moves. This means that a board might be evaluated more than once, but this can be avoided by storing boards (and the best move for the board) in a hashtable. Before a board is evaluated, the hash table is searched and if the board is found the best move is just read from the table, saving time. On one website I read this can speed up a program by 20 to 50% :-)
14 years ago
I don't think there is a limit for variable name length, but if you
make the variable names too long then your code will run slower :-)
14 years ago
Thanks a lot for your replies. It doesn't sounds like changing the board representation will make much difference, so I'll leave it for now (if I did do it I'd use two 32-bit integers to represent the locations of the white pieces and another two to represent the black positions). I haven't used a profiler before but I think it will be very useful - I'll download one and give it a go :-) I think having looking at the evaluation algorithm is a good idea since it's used so much (perhaps the profiler will show how much?). Also, while tranversing the move tree the board *is* copied for each move - this is done lots of times so any improvement here would be very helpful (I'll have to think about that..).
14 years ago
A yellow card. Doh! How will I know when I've posted a reply that is deemed sufficiently useful?
14 years ago
C++ was written by Bjarne Stroustrup between 1983 and 1985. I have his book
'The C++ Programming Language' on my desk.
14 years ago
Thanks a lot for your reply - you're right it *does* work!
I feel stupid now. I tried lots of other things before I
tried that last line and my code was a lot messier with many
extra lines and I didn't test the last line properly. Ahem.
14 years ago
Hello,

I'm trying to make a hash table that will store
many sets of four integers. As part of this
I thought I could store each set of integers
in an 4 x 1 integer array and then store the
arrays in a linked list. I've added arrays
okay using the LinkedList class but I can't work
out how to access the arrays once they are in
the linked list. Here's some of the code:

int[] arrayOne = new int[4];
int[] arrayTwo = new int[4];

List aList = new LinkedList();

aList.add(arrayOne);
aList.add(arrayTwo);

int listIndex = aList.indexof(arrayTwo);

// This line doesn't work:
int[] myArray = (int[])aList.get(listIndex);


Any help would be much appreciated!
14 years ago
Hello,

I' written a Othello game (that uses the mini-max algorithm)
and I'm looking for ways to speed it up. I've represented
the board using a 8 x 8 array of integers, but I've read
that using four (32) bit integers and setting the individual
bits can speed things up. Do you think this would have
much effect?

many thanks

N.
14 years ago
I've written a reversi game and I'm currently trying to improve the edge play (which is not great at the moment!). After looking at some web sites I decided to this by generating all the possible arrangements of an edge of 8 squares and evaluating each edge configuration, using the mini-max algorithm. The edge and the evaluation result can then be savedin a file, which can be used by an evaluation method in the reversi game. In order to assess an edge I've tried counting the number of black and white wins found by mini-max, but I'm not sure whether this will work. For example, starting with an empty edge of 8 squares, playing a reversi game to the end gives twice as many wins for black as for white - I would have thought they should have the same number of wins? (I've written a gui and tried playing the edge game against the computer and it does seem to play well)

Any help would be much appreciated!
14 years ago
Jeanne,

Thanks for your speedy reply. The files are all in the same directory and javac *.java works fine. It makes sense now :-)
14 years ago
I've written a Reversi game that runs ok and I'm working on improving the gameplay. The game consists of a main file called 'Reversi.java' and to compile I type 'javac Reversi.java' (using Mandrake Linux). In this file there are calls to methods that are in several separate files and I've recently noticed that the compiler seems to be ignoring changes to these files. If I create an error in the Reversi.java file, the compiler spots it immediately, but if I do the same with the other files it appears to compile anyway - I've even tried renaming some of the files so it couldn't find them but no error messages were displayed when I compiled it. Any suggestions would be much appreciated!
14 years ago