Commit Graph

386 Commits (master)

Author SHA1 Message Date
Leandro Doctors 2733516cb9 Organize imports 2020-01-16 08:21:24 +08:00
melvinzhang b87f60e99e add comment on how robust child was chosen 2018-06-06 10:20:26 +08:00
melvinzhang bfe43870b1 add comment that we are using the robust child strategy 2018-06-06 10:17:27 +08:00
melvinzhang 7640332133 replace member S with more descriptive member named variance 2018-06-06 10:09:13 +08:00
Martin Petricek bd5ae5fd7a Refactoring (#1543)
* Fix typos.

* Remove unnecessary boxing/unboxing.

* Replace traditional 'for' loops with 'foreach' loops.

* Replace explicit types with <> (diamonds) where they can be inferred.

* Collapse identical catch branches.

* Replace statement lambda with expression lambda for short statements.

* Remove unnecessary imports.

* Replace some lambdas with Comparator.comparing

* Replace Runnables with lambdas.

* Use addAll instead of adding whole collection manually.

* Simplify boolean expressions.

* Remove redundant 'else'.

* Simplify some boolean conditions that are always true or false.

* Inline redundant local variables.

* Remove extraneous semicolons.

* Fix Javadoc errors.

* Replace anonymous classes with lambdas.

* Replace chain of 'if's with switch.

* Remove delaration of exception that is never thrown.

* Use String/StringBuilder properly.
2018-04-08 08:59:14 +08:00
melvinzhang ac42c8acc4 make skipping phases in AI game model optional and disabled by default, for #815 2017-07-29 21:39:58 +08:00
lodici 9788037dbf remove unused methods in MCTSAI. 2017-06-19 12:38:30 +01:00
melvinzhang b1dba6619c add static to inner classes that do not refer to outer context 2017-06-17 12:10:18 +08:00
melvinzhang bbbdcac9ef add override annotation to overridden methods 2017-06-17 11:19:03 +08:00
lodici 2660653acb adds "--threads" command line arg to limit threads used by AI when running simulated games. 2017-05-09 23:02:55 +01:00
lodici 1915195aeb Remove imports in same package. 2017-04-08 11:29:49 +01:00
lodici 0c1a7d5ae8 remove unused import statements and sort. 2017-04-08 08:26:41 +01:00
melvinzhang 104b6898ca show debug into in log on error 2016-01-07 12:10:42 +08:00
melvinzhang 0516c5e87b wrap out of bounds exception in game exception to show game context 2016-01-07 12:03:42 +08:00
melvinzhang c8f1262b45 remove trailing space from java code 2015-12-31 18:54:52 +08:00
melvinzhang 96fddc9483 add stub MovesBlackList and integrate it with MMAB 2015-11-12 18:02:43 +08:00
melvinzhang 14dcb5ac95 prevent RCHOICES from being shared across calls, to address #479
the next call always clobbers this global and will cause the previous
running thread to crash, its value is only useful in the current call
2015-10-30 21:43:47 +08:00
melvinzhang a91b8418b2 check for interupt in loops and exit early 2015-10-30 21:43:47 +08:00
melvinzhang b8b45d24b8 Revert "exit from runSimulation when time has run out, attempt at #479"
This reverts commit 73bf205c9c.
2015-10-30 21:43:47 +08:00
melvinzhang 73bf205c9c exit from runSimulation when time has run out, attempt at #479 2015-10-29 21:45:46 +08:00
melvinzhang 5ba1abf2de immediately return if InteruptedException or RejectedExecutionException occurs 2015-10-06 20:31:07 +08:00
melvinzhang f9aaca1488 remove custom try/catch with Task, use execute instead of submit for executing runnable so that exceptions are propagated automatically 2015-06-08 11:27:34 +08:00
melvinzhang dcb6cc5a87 use handler for current thread instead of always using default 2015-06-08 11:12:13 +08:00
melvinzhang 9024be57e8 update VegasAI to use Task instead of Runnable so that exceptions are caught and logged correctly 2015-06-08 11:01:39 +08:00
melvinzhang 179f64369d use Task class so that exception is handled with currently registered DefaultUncaughtExceptionHandler, fixes no log issue 2015-06-08 10:57:27 +08:00
melvinzhang 54ec11e13b create Task class that handles exceptions with DefaultUncaughtExceptionHandler 2015-06-08 10:57:27 +08:00
melvinzhang 201018db2a replace player and source from getArtificialOptions, getArtificialChoiceResults, and getPlayerChoiceResults 2015-05-16 09:41:33 +08:00
melvinzhang 3440f158e0 improve indentation 2015-05-16 09:41:33 +08:00
melvinzhang 7a56763a47 compute child desc before executeNextEvent as the executeEvent may alter result of choice[0].toString, for example, in the case of revealing cards 2015-04-29 23:28:28 +08:00
melvinzhang 32f6449cc2 catch errors in runnable 2015-04-29 23:28:27 +08:00
melvinzhang 4f953e2283 submit tasks only if there is still time 2015-04-28 22:40:29 +08:00
melvinzhang 9ed5d5663a construct update task once, ensure it runs at least once 2015-04-26 18:59:25 +08:00
melvinzhang bd96a3e081 rename MAX_TIME to DURATION 2015-04-25 08:47:35 +08:00
melvinzhang ee325582cb sourceGame might be modified when worker is still running, move workerGame creation outside of runnable to fix ConcurrentModificationException 2015-04-06 10:10:22 +08:00
melvinzhang 039e39c9f3 remove AI specific methods from PlayerProfile, add MagicPlayer.getAiProfile convenience method 2015-04-04 21:46:34 +08:00
melvinzhang 147be0efdc retrieve AI level from player profile 2015-04-04 21:46:33 +08:00
melvinzhang 9a305659f2 constant that represent AIs used in deck strength viewer 2015-04-04 21:46:33 +08:00
melvinzhang 49ccc53ad1 move workGame and worker creation into worker thread so that worker gets correct id 2015-04-01 10:05:55 +08:00
melvinzhang e93ee8a30b increase MAX_CHOICES from 500 to 1000 to reduce early termination of simulation 2015-03-21 12:09:13 +08:00
melvinzhang 51cf462af2 remove duplicate AI code in next package 2015-03-10 15:13:26 +08:00
melvinzhang 9ba1ce1956 remove unused instance member, random 2015-03-08 20:44:07 +08:00
melvinzhang 27d62484fe enable fast choices at start as choices are passed as arguments 2015-02-22 16:44:15 +08:00
melvinzhang 0b7c5f6697 make use of advanceToNextEventWithChoices to skip event with single choice 2015-02-22 16:41:39 +08:00
melvinzhang a56a7f5617 only decrease depth when there is more than one child node 2015-02-22 16:20:39 +08:00
melvinzhang 533dcb7f19 move end time into member END and add method hasTime which is checked in tree search 2015-02-21 21:56:11 +08:00
melvinzhang 226aa3ebd3 show value of CHEAT in MTDF log output 2015-02-21 14:28:24 +08:00
melvinzhang c526c22fc9 add cheat/honest version of MTDF 2015-02-21 12:39:22 +08:00
melvinzhang 38b9d50dab improve estimatination of when to terminate 2015-02-21 12:36:12 +08:00
melvinzhang 1e47fda141 enable fast choices for levels below the first 2015-02-21 10:13:48 +08:00
melvinzhang 0e82ab4dc3 remove search depth, stop base on time limit 2015-02-21 10:12:53 +08:00