Last change
on this file since 741 was
193,
checked in by Maciej Komosinski, 11 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
516 bytes
|
Line | |
---|
1 | package cecj.app.othello; |
---|
2 | |
---|
3 | import java.util.Random; |
---|
4 | |
---|
5 | public class OthelloRandomPlayer1 extends OthelloPlayerFitnessCalculator { |
---|
6 | |
---|
7 | private static final float WPC_POSITION_RANGE = 5; |
---|
8 | |
---|
9 | @Override |
---|
10 | protected OthelloPlayer getPlayer() { |
---|
11 | double[] wpc = new double[WPC_LENGTH]; |
---|
12 | Random r = new Random(System.currentTimeMillis()); |
---|
13 | |
---|
14 | for (int i = 0; i < WPC_LENGTH; i++) { |
---|
15 | wpc[i] = r.nextDouble() * WPC_POSITION_RANGE; |
---|
16 | if (r.nextBoolean()) { |
---|
17 | wpc[i] *= -1; |
---|
18 | } |
---|
19 | } |
---|
20 | |
---|
21 | return new OthelloPlayer(wpc); |
---|
22 | } |
---|
23 | |
---|
24 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.