Commit Graph

212 Commits (2733516cb9cdad7ac4cef98b819d4d01846e5c66)

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
lodici 9788037dbf remove unused methods in MCTSAI. 2017-06-19 12:38:30 +01: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
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 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 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 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 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 e93ee8a30b increase MAX_CHOICES from 500 to 1000 to reduce early termination of simulation 2015-03-21 12:09:13 +08:00
melvinzhang 72a49d3ac9 simplify game simulation using advanceToNextEventWithChoice 2015-02-19 12:48:56 +08:00
melvinzhang a22fc6e4a8 verified that counting choices instead of actions does not negatively impact MCTS strength, apply changes to current MCTS 2015-02-07 18:25:05 +08:00
melvinzhang 3fd280367d update MCTSAI.next to match MCTSAI 2015-02-05 17:29:44 +08:00
ShawnieBoy b611eaae48 Import reorganise/remove unused 2014-04-18 22:43:01 +01:00
melvin df80ef9128 lock-free MCTSAI no longer experimental as it has a better win percentage than the current MCTSAI implementation 2014-04-03 10:37:06 +08:00
melvin 725fe30fa9 output diagnostics to log instead of std err 2014-04-02 13:53:33 +08:00
melvin bb16c2b3ee revert changes toString method of MagicBuilderPayManaCostResult as it affects choice result displayed in UI 2014-04-02 09:58:59 +08:00
melvin b69b37f986 AIs to only log in game.log and stop printing to std err 2014-04-01 19:39:28 +08:00
melvin c43b6b9109 show count, weight, x, amountLeft in toString 2014-04-01 13:56:40 +08:00
melvin b90d04bbc6 set hidden card once when creating aiGame from startGame to improve node caching 2014-03-27 14:49:42 +08:00
melvin 458a1cf404 make MCTS parallel by syncing with next.MCTS 2014-03-25 10:01:44 +08:00
melvin 387527d8e4 always output AI choice to System.err regardless of debug setting 2014-03-12 10:30:48 +08:00
melvin 6a79b9ec5f move experiment next version of AI into package next 2014-03-11 18:51:48 +08:00
melvin cbb6969d4d enhance MTCS2 to use multiple cores with tree parallelization 2014-03-11 17:42:31 +08:00
melvin 3bda4a0945 add turn to output of AI log 2013-11-29 12:48:59 +08:00
melvin f7ac1bf8bc printPath and printNode directly output to System.err instead of calling log, comment out asserts that call these methods directly 2013-11-11 11:36:40 +08:00
melvin 64368e1b9a remove extraneous whitespace 2013-06-24 09:33:35 +08:00
melvin 464748de27 fix getSum 2013-05-13 14:05:51 +08:00
melvin cd1a007d7c added MCTSAI2 for testing modifications to MCTS AI 2013-05-11 09:37:45 +08:00
melvin 805165949b rename hasChoices to hasChoice, added no args version of executeNextEvent 2013-05-05 13:32:10 +08:00
melvin a60d22b65b simplify AI constructors 2013-04-30 13:19:35 +08:00