Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: AI search and Java on: 2013-03-17 15:19:49
It's only the piece counters that aren't updated property because the same board is used in the recursion. Placing/undoing a cell position works because it gets the information from the move itself, which btw... doesn't change between and make/unmake.
2  Game Development / Newbie & Debugging Questions / Re: AI search and Java on: 2013-03-17 13:15:30
Your pseudocode snippet is similar to my function. I'm passing the board as one of the parameters and make/unmake the same way.

My make function does:
1. place new piece on the board
2. increment new pieces for current player
3. switch players (opponent is now the current player)

My unmake function does:
1. remove new piece from the board
2. decrement new pieces for current player
3. switch players

However, after a few plies into the search the number of new pieces for each player are way off (eg. 22, -18, etc)

So what could be wrong?
3  Game Development / Newbie & Debugging Questions / AI search and Java on: 2013-03-17 06:59:47
Hi all,

I'm writing a board game and currently implementing the AI using the standard Negamax. This algorithm calls itself recursively.

To speed up things I implemented a makemove/undomove within the function and I don't pass the board object as a parameter to itself. However, due to the nature of Java not passing objects by reference, the changes to the board state when going deeper into the recursion are also reflected into the upper levels.

When I just copy the board state every time, the function works fine because each recursion works on a new copy based on a copy of one level above it. In this case I do have to pass the board state copy as a parameter and this copy copied immediately.

This has serious issues because as I hit a depth of 6 the search slows down considerably. So I'd rather have the move/undo functionality to speed up things.

So my question is: Is it possible in Java, and if yes, how? Or am I restricted to copying the board each and every time with serious performance issues?

Thanks,
C
4  Game Development / Newbie & Debugging Questions / Re: C++ to Java and usigned int64? on: 2013-03-13 08:27:58
I've already tried that approach but the function returns just long which I can't use instead of the bits.
5  Game Development / Newbie & Debugging Questions / C++ to Java and unsigned int64? on: 2013-03-13 07:38:37
Hi all,

Can this code snippet be converted to Java?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
u64 magic_table[24] = {
  0x1000000010000000ull,
  0x1000000000010000ull,
  0x1000000000000001ull,
  0x0100000001000000ull,
  0x0100000000010000ull,
  0x0100000000000010ull,
  0x0010000000100000ull,
  0x0010000000010000ull,
  0x0010000000000100ull,
  0x0001000010000000ull,
  0x0001000001000000ull,
  0x0001000000100000ull,
  0x0000100000000100ull,
  0x0000100000000010ull,
  0x0000100000000001ull,
  0x0000010000100000ull,
  0x0000010000001000ull,
  0x0000010000000100ull,
  0x0000001001000000ull,
  0x0000001000001000ull,
  0x0000001000000010ull,
  0x0000000110000000ull,
  0x0000000100001000ull,
  0x0000000100000001ull
};

u64 test(u64 magic_sum, int square) {
  u64 before = magic_sum & 0x4444444444444444ull;
  u64 afte = (magic_sum + magic_table[square]) & 0x4444444444444444ull;
  return after & ~before;
}
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Pippogeek (37 views)
2014-09-24 16:13:29

Pippogeek (29 views)
2014-09-24 16:12:22

Pippogeek (18 views)
2014-09-24 16:12:06

Grunnt (42 views)
2014-09-23 14:38:19

radar3301 (24 views)
2014-09-21 23:33:17

BurntPizza (61 views)
2014-09-21 02:42:18

BurntPizza (30 views)
2014-09-21 01:30:30

moogie (36 views)
2014-09-21 00:26:15

UprightPath (49 views)
2014-09-20 20:14:06

BurntPizza (52 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!