Skip to content

Commit ed9bb54

Browse files
Tree growing (#6)
Overall a lot of changes. Mainly added functionality related to parsing of tokens from tokenizer to make a forest. As well as related outputs form such. * Grumble Packages External JAR Corrected issue with using external JAR and named packages. * Subroutine For Cases Added subroutine to be use internally for switch cases. * Minor Changes Reranaged Simularion.java. Reremovd TEST_RESTRICTED_CHARS.java which was accidently readded. Added subroutines to Tree_Assembler.java. * House Keeping Fixed 5 Card Poker Test.txt. Added some notes in various places. Continued Tree_Assembler.java. * Added Concrete_Parent Updated affected classes. Continued Tree_Assembler.java. * Forest be Growing Added a few more subroutines, such that the rest should just be function calls until getting to the tree part. * Fixed Tokenizer Added forgotten true and false values. Corrected edge case that could have resulted in a keyword being mistaken for an id. * Finished handling of literal values Adjusted grammar slightly to have both = and ; be the result of a simple production rule. Finished adding all cases relating to literal values. Also reworked some subroutines. * Removed Unused file Forgot to remove this in a past commit. * Corrected Compatibility Issue Was using List.of which is from Java 9, though this project is meant to be compatible with Java 8. * Committed Patricide Essentially merged Concreate_Parent with Evaluable for Tree_Assembler's syntactical_stack. * Final Massive Commit Regarding generated files. Essentially they have been updated to latest version. They can be somewhat ignored for views, though is a way to check what outputs look like. For parser section: corrected minor oversights in Tree_Assembler.java. * Minor change to Decklist output Did not bother recreating them though. * Minor Renaming No functional changes. * Update README.md Updated to be more complete. * Update Simulation.java * Update Deck_Card.java Removed redundant code. Corrections. Added --simulation_results_console flag description. * Added Javadoc to Reservable. * Fixed 5 Card Poker Test Had logical error and syntax errors regarding Single Pair * Removed Evaluable's Generic Essentially the generic associated to the class itself was useless, thus was removed. Any errors caused with creating a Simulation Object can be resolved by removing its first generic. That being T. * Added Javadocs
1 parent c90eacc commit ed9bb54

File tree

108 files changed

+25283
-1377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+25283
-1377
lines changed

Notes.txt

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
1-
Configuration File:
2-
3-
-deck list
4-
-throw away none main deck parts
5-
-maybe read a ydk file instead of in same file.
6-
-declare scenarios
7-
-state which to display at the end
8-
9-
Structure:
10-
11-
-store scenarios to do not repeat evaluation
12-
-tree of nodes
13-
-operators and scenarios
14-
-short circuit operator evaluation
15-
-node per operator
16-
-node per single match as leaf
17-
-TODO: figure out duplicates and overlap of sub-scenarios.
18-
19-
Parser:
20-
21-
-Like a compiler going over expressions.
22-
-Table driven?
23-
24-
Later Versions:
25-
26-
-add special ability to cards
27-
-example, when a hand includes a draw card, apply draw to look at more cards for evaluations
28-
29-
-provide more options for writing configuration file?
30-
-allow some regex for stating cards?
31-
32-
-additional options for command line arguments?
33-
-maybe put in the planned (yet to be written) command line argument parser
1+
Configuration File:
2+
3+
-deck list
4+
-throw away none main deck parts
5+
-maybe read a ydk file instead of in same file.
6+
-declare scenarios
7+
-state which to display at the end
8+
9+
Structure:
10+
11+
-store scenarios to do not repeat evaluation
12+
-tree of nodes
13+
-operators and scenarios
14+
-short circuit operator evaluation
15+
-node per operator
16+
-node per single match as leaf
17+
-TODO: figure out duplicates and overlap of sub-scenarios.
18+
19+
Parser:
20+
21+
-Like a compiler going over expressions.
22+
-Table driven?
23+
24+
Later Versions:
25+
26+
-add special ability to cards
27+
-example, when a hand includes a draw card, apply draw to look at more cards for evaluations
28+
-draw, example Pot of Greed
29+
-excavate, Pot of Duality
30+
-draw then discard, Graceful Charity
31+
-other such as Pot of Desires, Reasoning, "Chaos Ruler, the Chaotic Magical Dragon"
32+
33+
-provide more options for writing configuration file?
34+
-allow some regex for stating cards?
35+
36+
-additional options for command line arguments?
37+
-maybe put in the planned (yet to be written) command line argument parser
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[Card name: First, Card name: Second, Card name: Third, Card name: Forth, Card name: Fifth, Card name: 6th, Card name: 7th, Card name: Ash Blossom & Joyous Spring, Card name: First]

Output/Default Configuration 2021-8-13_324.outderivation

Lines changed: 404 additions & 0 deletions
Large diffs are not rendered by default.

Output/Default Configuration 2021-7-30_2319.outlextokens renamed to Output/Default Configuration 2021-8-13_324.outlextokens

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,26 @@
1111
[Lexeme TYPE: ID, LEXEME: First, line number: 11][Lexeme TYPE: SEMI_COLON, LEXEME: ;, line number: 11]
1212
[Lexeme TYPE: SENTINEL_END, LEXEME: }, line number: 12]
1313

14-
[Lexeme TYPE: PROBABILITY_START, LEXEME: scenarios:, line number: 14]
14+
[Lexeme TYPE: PROBABILITY_START, LEXEME: scenarios:, line number: 14]
1515
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 15]
1616
[Lexeme TYPE: ID, LEXEME: Contains "First" Card, line number: 16][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 16]
1717
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 17]
18-
[Lexeme TYPE: TREE_START, LEXEME: scenario, line number: 18][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 18]
18+
[Lexeme TYPE: TREE_START, LEXEME: scenario, line number: 18] [Lexeme TYPE: ASSIGN, LEXEME: =, line number: 18]
1919
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 19]
2020
[Lexeme TYPE: CONDITION_CARD_START, LEXEME: [, line number: 20][Lexeme TYPE: ID, LEXEME: First, line number: 20][Lexeme TYPE: CONDITION_CARD_END, LEXEME: ], line number: 20]
2121
[Lexeme TYPE: SENTINEL_END, LEXEME: }, line number: 21][Lexeme TYPE: SEMI_COLON, LEXEME: ;, line number: 21]
2222
[Lexeme TYPE: SENTINEL_END, LEXEME: }, line number: 22]
2323
[Lexeme TYPE: ID, LEXEME: Contains "Second" Card, line number: 23][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 23]
2424
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 24]
25-
[Lexeme TYPE: TREE_START, LEXEME: scenario, line number: 25][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 25]
25+
[Lexeme TYPE: TREE_START, LEXEME: scenario, line number: 25] [Lexeme TYPE: ASSIGN, LEXEME: =, line number: 25]
2626
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 26]
2727
[Lexeme TYPE: CONDITION_CARD_START, LEXEME: [, line number: 27][Lexeme TYPE: ID, LEXEME: Second, line number: 27][Lexeme TYPE: CONDITION_CARD_END, LEXEME: ], line number: 27]
2828
[Lexeme TYPE: SENTINEL_END, LEXEME: }, line number: 28][Lexeme TYPE: SEMI_COLON, LEXEME: ;, line number: 28]
29-
[Lexeme TYPE: DISPLAY_START, LEXEME: display, line number: 29][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 29] [Lexeme TYPE: ID, LEXEME: false, line number: 29][Lexeme TYPE: SEMI_COLON, LEXEME: ;, line number: 29]
29+
[Lexeme TYPE: DISPLAY_START, LEXEME: display, line number: 29] [Lexeme TYPE: ASSIGN, LEXEME: =, line number: 29] [Lexeme TYPE: FALSE, LEXEME: false, line number: 29][Lexeme TYPE: SEMI_COLON, LEXEME: ;, line number: 29]
3030
[Lexeme TYPE: SENTINEL_END, LEXEME: }, line number: 30]
3131
[Lexeme TYPE: ID, LEXEME: Contains Ash Blossom & Joyous Spring, line number: 31][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 31]
3232
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 32]
33-
[Lexeme TYPE: TREE_START, LEXEME: scenario, line number: 33][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 33]
33+
[Lexeme TYPE: TREE_START, LEXEME: scenario, line number: 33] [Lexeme TYPE: ASSIGN, LEXEME: =, line number: 33]
3434
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 34]
3535
[Lexeme TYPE: CONDITION_CARD_START, LEXEME: [, line number: 35][Lexeme TYPE: ID, LEXEME: Ash Blossom & Joyous Spring, line number: 35][Lexeme TYPE: CONDITION_CARD_END, LEXEME: ], line number: 35]
3636
[Lexeme TYPE: SENTINEL_END, LEXEME: }, line number: 36][Lexeme TYPE: SEMI_COLON, LEXEME: ;, line number: 36]
@@ -39,7 +39,7 @@
3939
[Lexeme TYPE: LINE_COMMENT, LEXEME: //should be the highest, line number: 39]
4040
[Lexeme TYPE: ID, LEXEME: First | Ash, line number: 40][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 40]
4141
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 41]
42-
[Lexeme TYPE: TREE_START, LEXEME: scenario, line number: 42][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 42]
42+
[Lexeme TYPE: TREE_START, LEXEME: scenario, line number: 42] [Lexeme TYPE: ASSIGN, LEXEME: =, line number: 42]
4343
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 43]
4444
[Lexeme TYPE: CONDITION_SCENARIO_START, LEXEME: <, line number: 44][Lexeme TYPE: ID, LEXEME: Contains "First" Card, line number: 44][Lexeme TYPE: CONDITION_SCENARIO_END, LEXEME: >, line number: 44] [Lexeme TYPE: OR, LEXEME: OR, line number: 44] [Lexeme TYPE: CONDITION_SCENARIO_START, LEXEME: <, line number: 44][Lexeme TYPE: ID, LEXEME: Contains Ash Blossom & Joyous Spring, line number: 44][Lexeme TYPE: CONDITION_SCENARIO_END, LEXEME: >, line number: 44]
4545
[Lexeme TYPE: SENTINEL_END, LEXEME: }, line number: 45][Lexeme TYPE: SEMI_COLON, LEXEME: ;, line number: 45]
@@ -48,15 +48,15 @@
4848
[Lexeme TYPE: LINE_COMMENT, LEXEME: //should be the lowest, line number: 48]
4949
[Lexeme TYPE: ID, LEXEME: First & Ash, line number: 49][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 49]
5050
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 50]
51-
[Lexeme TYPE: TREE_START, LEXEME: scenario, line number: 51][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 51]
51+
[Lexeme TYPE: TREE_START, LEXEME: scenario, line number: 51] [Lexeme TYPE: ASSIGN, LEXEME: =, line number: 51]
5252
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 52]
5353
[Lexeme TYPE: CONDITION_SCENARIO_START, LEXEME: <, line number: 53][Lexeme TYPE: ID, LEXEME: Contains "First" Card, line number: 53][Lexeme TYPE: CONDITION_SCENARIO_END, LEXEME: >, line number: 53] [Lexeme TYPE: AND, LEXEME: AND, line number: 53] [Lexeme TYPE: CONDITION_SCENARIO_START, LEXEME: <, line number: 53][Lexeme TYPE: ID, LEXEME: Contains Ash Blossom & Joyous Spring, line number: 53][Lexeme TYPE: CONDITION_SCENARIO_END, LEXEME: >, line number: 53]
5454
[Lexeme TYPE: SENTINEL_END, LEXEME: }, line number: 54][Lexeme TYPE: SEMI_COLON, LEXEME: ;, line number: 54]
5555
[Lexeme TYPE: SENTINEL_END, LEXEME: }, line number: 55]
5656
[Lexeme TYPE: LINE_COMMENT, LEXEME: //should be the same as First & Ash, line number: 56]
5757
[Lexeme TYPE: ID, LEXEME: First AND Ash, line number: 57][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 57][Lexeme TYPE: LINE_COMMENT, LEXEME: //legal name, line number: 57]
5858
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 58]
59-
[Lexeme TYPE: TREE_START, LEXEME: scenario, line number: 59][Lexeme TYPE: ASSIGN, LEXEME: =, line number: 59]
59+
[Lexeme TYPE: TREE_START, LEXEME: scenario, line number: 59] [Lexeme TYPE: ASSIGN, LEXEME: =, line number: 59]
6060
[Lexeme TYPE: SENTINEL_START, LEXEME: {, line number: 60]
6161
[Lexeme TYPE: CONDITION_EXPR_START, LEXEME: (, line number: 61][Lexeme TYPE: CONDITION_CARD_START, LEXEME: [, line number: 61][Lexeme TYPE: ID, LEXEME: First, line number: 61][Lexeme TYPE: CONDITION_CARD_END, LEXEME: ], line number: 61][Lexeme TYPE: CONDITION_EXPR_END, LEXEME: ), line number: 61] [Lexeme TYPE: AND, LEXEME: AND, line number: 61] [Lexeme TYPE: NOT, LEXEME: NOT, line number: 61] [Lexeme TYPE: NOT, LEXEME: NOT, line number: 61] [Lexeme TYPE: CONDITION_CARD_START, LEXEME: [, line number: 61][Lexeme TYPE: ID, LEXEME: Ash Blossom & Joyous Spring, line number: 61][Lexeme TYPE: CONDITION_CARD_END, LEXEME: ], line number: 61]
6262
[Lexeme TYPE: SENTINEL_END, LEXEME: }, line number: 62][Lexeme TYPE: SEMI_COLON, LEXEME: ;, line number: 62]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
digraph {
2+
node [shape=record];
3+
node [fontname=Sans];charset="UTF-8" splines=true splines=spline rankdir =LR
4+
22[label="Ash Blossom & Joyous Spring"];
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
digraph {
2+
node [shape=record];
3+
node [fontname=Sans];charset="UTF-8" splines=true splines=spline rankdir =LR
4+
12[label="First"];
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
digraph {
2+
node [shape=record];
3+
node [fontname=Sans];charset="UTF-8" splines=true splines=spline rankdir =LR
4+
17[label="Second"];
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
digraph {
2+
node [shape=record];
3+
node [fontname=Sans];charset="UTF-8" splines=true splines=spline rankdir =LR
4+
29[label="OR"];
5+
29->14;
6+
29->24;
7+
14[label="Contains \"First\" Card"];
8+
24[label="Contains Ash Blossom & Joyous Spring"];
9+
}

0 commit comments

Comments
 (0)