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

Last change on this file since 473 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 
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.