Commit Graph

65 Commits (master)

Author SHA1 Message Date
Leandro Doctors 2733516cb9 Organize imports 2020-01-16 08:21:24 +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
Martin Petricek 4313c14b41 Configurable time limits for running AI game. (#1505) 2018-03-18 10:40:19 +08:00
lodici 1eb94c6811 remove unused 'duplicate' field from DeckStrCal. 2017-06-19 12:34:57 +01:00
melvinzhang c8f1262b45 remove trailing space from java code 2015-12-31 18:54:52 +08:00
lodici 54e0bb753f move DeckUtils and FileIO classes into magic.utility package. 2015-06-01 13:48:50 +01:00
lodici c708cb1192 convert InvalidDeckException to unchecked exception and de-clutter code by removing related "throws" clauses. 2015-04-24 15:56:59 +01:00
lodici fbe61b36ae rename MagicPlayerDefinition to DuelPlayerConfig. 2015-04-19 20:21:25 +01:00
melvinzhang 7c82eac981 add factory method 'create' to AiProfile and HumanProfile 2015-04-19 09:37:13 +08:00
lodici 6bfa6a0784 rename AiPlayer to AiProfile. 2015-04-05 14:48:12 +01:00
melvinzhang 7d639c0c12 replace call to setDifficulty and setAIs with MagicPlayerDefinition constructor that takes a player profile 2015-04-04 21:46:33 +08:00
melvinzhang 32b1518b51 replace nextRNGInt(999999) with nextRNGInt() 2015-03-10 21:15:39 +08:00
melvinzhang e7257460b3 add stub option --duplicate to DeckStrCal 2015-03-08 22:52:05 +08:00
melvinzhang d836801f56 define profile and player names explicitly instead of using current profile 2015-02-25 09:49:04 +08:00
lodici f553cb67ca Invalid deck throws new InvalidDeckException instead of IOException and propagates up to UI/console layer for handling. 2015-02-22 17:18:36 +00:00
lodici 98df5770ed rename loadDeck() to loadAndSetPlayerDeck() in DeckUtils. 2015-02-22 16:23:41 +00:00
melvinzhang 7d53c8484b remove setMaxTestGameDuration, max duration must be set in constructor 2015-02-18 12:55:21 +08:00
melvinzhang e6eac493c3 consolidate initialization code from MagicMain and DeckStrCal into MagicSystem 2015-02-18 09:51:51 +08:00
lodici 7f516c3347 - implement HeadlessGameController with no UI dependencies from DeckStrCal.
- Use a much simplified initialize() for DeckStrCal.
2015-02-17 19:14:50 +00:00
lodici 438522c356 rename GameController to SwingGameController. 2015-02-17 19:07:23 +00:00
lodici 83fd9f588e Update DeckStrCal to use new ConsoleExceptionHandler instead of MagicGameReport. 2015-02-16 11:14:54 +00:00
melvinzhang 320b6e6bf9 remove sound from MagicGame constructor 2014-11-29 21:00:45 +08:00
ShawnieBoy b611eaae48 Import reorganise/remove unused 2014-04-18 22:43:01 +01:00
melvin e4cba2dc5d close game log after completing duels 2014-04-02 13:52:28 +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 42866224ba add method to disable notification in crash reporter 2014-03-25 14:25:57 +08:00
melvin 37439f8829 use custom condition instead of isFinished 2014-03-08 16:58:54 +08:00
melvin f6233ac7c6 replace MersenneTwisterFast with Xorshift 2013-09-24 11:55:52 +08:00
melvin 64368e1b9a remove extraneous whitespace 2013-06-24 09:33:35 +08:00
melvin f1b27c586c convert to UNIX line endings 2013-04-13 10:32:25 +08:00
melvin ca4ae7af9b remove redundant field initialization 2012-10-03 16:17:01 +08:00
melvin dcc8d38484 optimized imports 2012-09-27 14:11:44 +08:00
melvin 9d46f2e2af use the full range of int for seed 2012-09-27 11:09:34 +08:00
melvin db6568f9f4 added option seed to set the random seed on for each duel 2012-09-27 09:59:26 +08:00
melvin be6d8d75a6 added uncaught exception handler to DeckStrCal.main 2012-09-23 13:36:57 +08:00
melvin 52c02cb880 allow decks to be unspecified, allow starting life (--life) to be specified, allow number of repetitions (--repeat) to be specified 2012-09-23 10:14:10 +08:00
melvin b0c3fce47b fixed cli documentation 2012-09-04 19:52:49 +08:00
wait321 af64d8aff8 code refactoring - 'tournament' changed to 'duel' to standardize terminology 2011-10-16 16:45:26 -07:00
melvin cdd4815821 improved command line help message 2011-09-23 19:36:40 +08:00
melvin 0e25839dd8 swap order of String equals and added final annotation 2011-09-08 17:11:59 +08:00
melvin 6b37c9ecae instantiate the constroller from single arg constructor 2011-09-03 23:13:38 +08:00
melvin 850d01d3d1 optimized import statements with IntelliJ 2011-08-10 23:28:35 +08:00
melvin e9cd14b43c removed unused imports 2011-08-10 22:43:46 +08:00
melvin f59ba1d693 documented each try block for more systematic exception handling 2011-08-06 10:49:03 +08:00
melvin cd7d35a16d make sure Exception are final and variable is named ex for consistency 2011-08-04 13:17:26 +08:00
melvin 51181c43b5 replaced new RuntimeException(ex.getMessage()) with new RuntimeException(ex) 2011-08-03 22:47:43 +08:00
melvin 012e51da13 replaced Error with ERROR 2011-08-03 15:24:28 +08:00
melvin 91ee8d731d replaced Exception with more specfic subclass 2011-08-03 14:51:01 +08:00
melvin 82148c8a0c replaced default parameters in MCTSAI with tuned ones, increased duration of AI game to 1 hr 2011-07-21 10:52:07 +08:00
melvin f2a0577ca0 removed DEFAULT from MagicAIImpl 2011-07-01 17:34:10 +08:00