summaryrefslogtreecommitdiff
path: root/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test35.java
diff options
context:
space:
mode:
Diffstat (limited to 'BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test35.java')
-rw-r--r--BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test35.java134
1 files changed, 134 insertions, 0 deletions
diff --git a/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test35.java b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test35.java
new file mode 100644
index 0000000..e7f7d06
--- /dev/null
+++ b/BenchmarkFramework/app/src/main/java/org/linaro/iasenov/benchmarkframework/Test35.java
@@ -0,0 +1,134 @@
+package org.linaro.iasenov.benchmarkframework;
+
+import android.util.Log;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
+import java.text.DecimalFormat;
+
+
+import fhourstones.Game;
+import fhourstones.SearchGame;
+import fhourstones.TransGame;
+
+/**
+ * Created by iasenov on 10/24/16.
+ */
+public class Test35 extends BaseBenchmark{
+
+ private String TAG = "Fhourstones";
+ static boolean isJavaCanceled = false;
+
+ public String startBenchmark(int count) {
+
+ isJavaCanceled = false;
+
+ version = " Fhourstones ";
+ benchmarkName = "Test35";
+ integrationType = "SL";
+ chartName = "Fhourstones";
+
+ long before;
+ long after;
+
+
+ clear();
+
+ //****Redirect System.out and Syste.err****
+ PrintStream stdOut = System.out;
+ PrintStream stdErrt = System.err;
+
+ PrintStream interceptor_stdout = new Interceptor(stdOut);
+ PrintStream interceptor_err = new Interceptor(stdErrt);
+ System.setOut(interceptor_stdout);// just add the interceptor
+ System.setErr(interceptor_err);// just add the interceptor
+ //****Redirect System.out and Syste.err****
+
+ startTest = System.currentTimeMillis();
+
+
+ if(isJavaCanceled) return "";
+ //***********SearchGame*************
+
+ before = System.currentTimeMillis();
+
+
+ System.out.println("Fhourstones 3.1 (Java)");
+ System.out.println("Boardsize = " + Game.WIDTH + "x" + Game.HEIGHT);
+ System.out.println("Using " + TransGame.TRANSIZE + " transposition table entries.");
+ SearchGame c4 = new SearchGame();
+
+
+ String inputs = "45461667\n" +
+ "35333571\n" +
+ "13333111";
+
+ InputStream istream = new ByteArrayInputStream(inputs.getBytes());
+
+
+ BufferedReader dis = new BufferedReader(new InputStreamReader(istream/*System.in*/));
+ DecimalFormat df = new DecimalFormat("######.###");
+
+ for (;;) {
+ String line=null;
+ try {
+ line = dis.readLine();
+ } catch (IOException e) {
+ System.out.println(e);
+ //System.exit(0);
+ }
+ if (line == null)
+ break;
+ c4.reset();
+ for (int i=0; i < line.length(); i++)
+ c4.makemove(line.charAt(i) - '1');
+ System.out.println("\nSolving " + c4.nplies + "-ply position after "
+ + c4.toString() + " . . .");
+
+ c4.emptyTT();
+ int result = c4.solve();
+ long poscnt = c4.posed;
+ int work;
+ for (work=0; (poscnt>>=1) != 0; work++) ; //work = log #transpositions
+ System.out.println("score = " + result + " (" +
+ "#-<=>+".charAt(result) + ") work = " + work);
+ System.out.println("" + c4.nodes + " pos / " + c4.msecs +
+ " msec = " + df.format((double)c4.nodes/c4.msecs) + " Kpos/sec");
+ System.out.println(c4.htstat());
+ }
+
+
+ after = System.currentTimeMillis();
+
+ System.out.println("fhourstones/SearchGame: " + (after - before));
+ //***********AccessNBody*************
+
+
+
+
+
+ xout[2] = Interceptor.outputTxt;
+ Interceptor.clear();
+
+ endTest = System.currentTimeMillis();
+
+ sendElapsedTimeToChart();
+
+ submitElapsedTime(endTest-startTest);
+
+ return benchmarkName + ":" + getBenchmarkResult(5, integrationType);
+ }
+
+ public boolean stopBenchmark(){
+ isJavaCanceled = true;
+ Log.i(TAG, "stopBenchmark: isJNICanceled");
+ return true;
+ }
+}