source: java/ecj/cecj/app/othello/OthelloRandomPlayer1.java @ 64

Last change on this file since 64 was 44, checked in by mszubert, 15 years ago

cecj, framsticks and games packages imported

File size: 516 bytes
RevLine 
[44]1package cecj.app.othello;
2
3import java.util.Random;
4
5public 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.