View Javadoc

1   /**********************************************
2    * Copyright (C) 2009 Lukas Laag
3    * This file is part of carballo-gwt.
4    * 
5    * carballo-gwt is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU General Public License as published by
7    * the Free Software Foundation, either version 3 of the License, or
8    * (at your option) any later version.
9    * 
10   * carballo-gwt is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   * 
15   * You should have received a copy of the GNU General Public License
16   * along with carballo-gwt.  If not, see http://www.gnu.org/licenses/
17   **********************************************/
18  package com.alonsoruibal.chess;
19  
20  import java.util.HashMap;
21  import java.util.Map;
22  
23  public class StaticConfig implements Config {
24  
25  	//private static ResourceBundle config = ResourceBundle.getBundle("chess"); 
26  	private Map<String, String> config;
27  	public StaticConfig() {
28  		config = new HashMap<String, String>();
29  		config.put("book", "/book_small.json");
30  
31  		// Evaluator
32  		config.put("evaluator", "complete");
33  		//valuator=completenew
34  		//evaluator=simplified
35  
36  		// Search configuration
37  		//search.negascout=true
38  		config.put("search.nullmove", "true");
39  		config.put("search.iid", "true");
40  		config.put("search.extensions", "true");
41  		config.put("search.lmr", "true");
42  		//search.futility=true
43  		//search.futility.margin=300
44  		//search.aggressiveFutility=true
45  		//search.aggressiveFutility.margin=500
46  
47  		// Aspiration window and size in centipawns
48  		config.put("aspirationWindow", "true");
49  		config.put("aspirationWindow.size", "10");
50  
51  		// Size of the transposition table, in MB
52  		//config.put("transpositionTable.size", "256");
53  		config.put("transpositionTable.size", "256");
54  	}
55  	
56  	public String getProperty(String name) {
57  		//return config.getString(name);
58  		return config.get(name);
59  	}
60  
61  	public boolean getBoolean(String name) {
62  		if (!config.containsKey(name)) return false;
63  		//String value = config.getString(name);
64  		String value = config.get(name);
65  		return "1".equals(value) || "true".equals(value);
66  	}
67  	
68  	public boolean containsProperty(String name) {
69  		return config.containsKey(name);
70  	}
71  }