client_plugin_logic_deb 1.8.468 → 1.8.469
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Kosi-Kaverit-kaverit.js +73 -73
- package/Kosi-Kodein-kodein-di.js +608 -608
- package/Kotlin-DateTime-library-kotlinx-datetime.js +1620 -1620
- package/Logic_Debertz-ai_module.js +583 -583
- package/Logic_Debertz-bot_engine.js +3274 -0
- package/Logic_Debertz-bot_engine.js.map +1 -0
- package/Logic_Debertz-client_plugin.d.ts +4 -2
- package/Logic_Debertz-client_plugin.js +5221 -5038
- package/Logic_Debertz-client_plugin.js.map +1 -1
- package/Logic_Debertz-core.js +2129 -2129
- package/Logic_Debertz-core.js.map +1 -1
- package/Logic_Debertz-engine.js +18320 -18143
- package/Logic_Debertz-engine.js.map +1 -1
- package/Logic_Debertz-game_client.js +12500 -12443
- package/Logic_Debertz-game_client.js.map +1 -1
- package/Logic_Debertz-game_server.js +2118 -2059
- package/Logic_Debertz-game_server.js.map +1 -1
- package/error-library-error.js +5 -5
- package/kotlin-kotlin-stdlib.js +2514 -2329
- package/kotlin-kotlin-stdlib.js.map +1 -1
- package/kotlinx-atomicfu.js +22 -22
- package/kotlinx-coroutines-core.js +3367 -3367
- package/kotlinx-coroutines-core.js.map +1 -1
- package/kotlinx-io-kotlinx-io-bytestring.js +46 -46
- package/kotlinx-io-kotlinx-io-core.js +576 -576
- package/kotlinx-serialization-kotlinx-serialization-core.js +1857 -1857
- package/kotlinx-serialization-kotlinx-serialization-json.js +1447 -1447
- package/ktor-ktor-client-content-negotiation.js +210 -210
- package/ktor-ktor-client-core.js +3042 -3042
- package/ktor-ktor-client-logging.js +1120 -1120
- package/ktor-ktor-events.js +11 -11
- package/ktor-ktor-http-cio.js +522 -522
- package/ktor-ktor-http.js +733 -733
- package/ktor-ktor-io.js +1101 -1101
- package/ktor-ktor-serialization-kotlinx-json.js +6 -6
- package/ktor-ktor-serialization-kotlinx.js +246 -246
- package/ktor-ktor-serialization.js +119 -119
- package/ktor-ktor-utils.js +834 -834
- package/ktor-ktor-websockets.js +50 -50
- package/package.json +1 -1
- package/random-library-crypto-rand.js +12 -12
- package/random-library-secure-random.js +7 -7
- package/raspberry-cardgame-lib-core.js +256 -256
- package/raspberry-cardgame-lib-logger.js +102 -102
- package/raspberry-cardgame-lib-random.js +997 -997
- package/uuid.js +27 -27
|
@@ -0,0 +1,3274 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof define === 'function' && define.amd)
|
|
3
|
+
define(['exports', './kotlin-kotlin-stdlib.js', './Logic_Debertz-core.js', './Logic_Debertz-engine.js', './raspberry-cardgame-lib-core.js'], factory);
|
|
4
|
+
else if (typeof exports === 'object')
|
|
5
|
+
factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./Logic_Debertz-core.js'), require('./Logic_Debertz-engine.js'), require('./raspberry-cardgame-lib-core.js'));
|
|
6
|
+
else {
|
|
7
|
+
if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
|
|
8
|
+
throw new Error("Error loading module 'Logic_Debertz-bot_engine'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to 'Logic_Debertz-bot_engine'.");
|
|
9
|
+
}
|
|
10
|
+
if (typeof globalThis['Logic_Debertz-core'] === 'undefined') {
|
|
11
|
+
throw new Error("Error loading module 'Logic_Debertz-bot_engine'. Its dependency 'Logic_Debertz-core' was not found. Please, check whether 'Logic_Debertz-core' is loaded prior to 'Logic_Debertz-bot_engine'.");
|
|
12
|
+
}
|
|
13
|
+
if (typeof globalThis['Logic_Debertz-engine'] === 'undefined') {
|
|
14
|
+
throw new Error("Error loading module 'Logic_Debertz-bot_engine'. Its dependency 'Logic_Debertz-engine' was not found. Please, check whether 'Logic_Debertz-engine' is loaded prior to 'Logic_Debertz-bot_engine'.");
|
|
15
|
+
}
|
|
16
|
+
if (typeof globalThis['raspberry-cardgame-lib-core'] === 'undefined') {
|
|
17
|
+
throw new Error("Error loading module 'Logic_Debertz-bot_engine'. Its dependency 'raspberry-cardgame-lib-core' was not found. Please, check whether 'raspberry-cardgame-lib-core' is loaded prior to 'Logic_Debertz-bot_engine'.");
|
|
18
|
+
}
|
|
19
|
+
globalThis['Logic_Debertz-bot_engine'] = factory(typeof globalThis['Logic_Debertz-bot_engine'] === 'undefined' ? {} : globalThis['Logic_Debertz-bot_engine'], globalThis['kotlin-kotlin-stdlib'], globalThis['Logic_Debertz-core'], globalThis['Logic_Debertz-engine'], globalThis['raspberry-cardgame-lib-core']);
|
|
20
|
+
}
|
|
21
|
+
}(function (_, kotlin_kotlin, kotlin_io_raspberryapps_game_engine_core, kotlin_io_raspberryapps_game_engine_engine, kotlin_io_raspberryapps_cardgame_core) {
|
|
22
|
+
'use strict';
|
|
23
|
+
//region block: imports
|
|
24
|
+
var imul = Math.imul;
|
|
25
|
+
var VOID = kotlin_kotlin.$_$.b;
|
|
26
|
+
var toString = kotlin_kotlin.$_$.gk;
|
|
27
|
+
var protoOf = kotlin_kotlin.$_$.ne;
|
|
28
|
+
var hashCode = kotlin_kotlin.$_$.ld;
|
|
29
|
+
var equals = kotlin_kotlin.$_$.ed;
|
|
30
|
+
var initMetadataForClass = kotlin_kotlin.$_$.md;
|
|
31
|
+
var getBooleanHashCode = kotlin_kotlin.$_$.hd;
|
|
32
|
+
var emptyList = kotlin_kotlin.$_$.o7;
|
|
33
|
+
var toString_0 = kotlin_kotlin.$_$.qe;
|
|
34
|
+
var getStringHashCode = kotlin_kotlin.$_$.kd;
|
|
35
|
+
var Unit_instance = kotlin_kotlin.$_$.k5;
|
|
36
|
+
var initMetadataForCompanion = kotlin_kotlin.$_$.nd;
|
|
37
|
+
var FunctionAdapter = kotlin_kotlin.$_$.rc;
|
|
38
|
+
var isInterface = kotlin_kotlin.$_$.be;
|
|
39
|
+
var Comparator = kotlin_kotlin.$_$.oi;
|
|
40
|
+
var compareValues = kotlin_kotlin.$_$.wa;
|
|
41
|
+
var sortedWith = kotlin_kotlin.$_$.w9;
|
|
42
|
+
var getOrNull = kotlin_kotlin.$_$.c8;
|
|
43
|
+
var Collection = kotlin_kotlin.$_$.m5;
|
|
44
|
+
var coerceIn = kotlin_kotlin.$_$.af;
|
|
45
|
+
var coerceAtLeast = kotlin_kotlin.$_$.we;
|
|
46
|
+
var coerceAtLeast_0 = kotlin_kotlin.$_$.ve;
|
|
47
|
+
var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.s1;
|
|
48
|
+
var booleanArray = kotlin_kotlin.$_$.uc;
|
|
49
|
+
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.j;
|
|
50
|
+
var toIntArray = kotlin_kotlin.$_$.fa;
|
|
51
|
+
var getKClassFromExpression = kotlin_kotlin.$_$.jf;
|
|
52
|
+
var THROW_CCE = kotlin_kotlin.$_$.cj;
|
|
53
|
+
var get_indices = kotlin_kotlin.$_$.h8;
|
|
54
|
+
var contentEquals = kotlin_kotlin.$_$.s6;
|
|
55
|
+
var contentEquals_0 = kotlin_kotlin.$_$.t6;
|
|
56
|
+
var contentHashCode = kotlin_kotlin.$_$.w6;
|
|
57
|
+
var contentDeepHashCode = kotlin_kotlin.$_$.q6;
|
|
58
|
+
var initMetadataForObject = kotlin_kotlin.$_$.sd;
|
|
59
|
+
var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.s;
|
|
60
|
+
var collectionSizeOrDefault = kotlin_kotlin.$_$.o6;
|
|
61
|
+
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.i;
|
|
62
|
+
var getPlayer = kotlin_io_raspberryapps_game_engine_core.$_$.q;
|
|
63
|
+
var addAll = kotlin_kotlin.$_$.c6;
|
|
64
|
+
var CombinationState_ACCEPTED_getInstance = kotlin_io_raspberryapps_game_engine_engine.$_$.x9;
|
|
65
|
+
var get_isEarnPointScene = kotlin_io_raspberryapps_game_engine_engine.$_$.x3;
|
|
66
|
+
var get_entries = kotlin_io_raspberryapps_cardgame_core.$_$.s;
|
|
67
|
+
var plus = kotlin_kotlin.$_$.j9;
|
|
68
|
+
var get_isTradeScene = kotlin_io_raspberryapps_game_engine_engine.$_$.a4;
|
|
69
|
+
var listOf = kotlin_kotlin.$_$.v8;
|
|
70
|
+
var noWhenBranchMatchedException = kotlin_kotlin.$_$.bk;
|
|
71
|
+
var CombinationChoiceFromClientAction = kotlin_io_raspberryapps_game_engine_engine.$_$.d5;
|
|
72
|
+
var emptySet = kotlin_kotlin.$_$.q7;
|
|
73
|
+
var Combination = kotlin_io_raspberryapps_game_engine_engine.$_$.n3;
|
|
74
|
+
var CardFromClientAction = kotlin_io_raspberryapps_game_engine_engine.$_$.c5;
|
|
75
|
+
var SuitChoiceFromClientAction = kotlin_io_raspberryapps_game_engine_engine.$_$.l5;
|
|
76
|
+
var WaitingActData = kotlin_io_raspberryapps_game_engine_engine.$_$.q1;
|
|
77
|
+
var getKClass = kotlin_kotlin.$_$.kf;
|
|
78
|
+
var MechanicException = kotlin_io_raspberryapps_game_engine_core.$_$.b;
|
|
79
|
+
var Companion_instance = kotlin_io_raspberryapps_game_engine_engine.$_$.hb;
|
|
80
|
+
var RequestedCardDecksFromClientAction = kotlin_io_raspberryapps_game_engine_engine.$_$.k5;
|
|
81
|
+
var CardDeckRequest = kotlin_io_raspberryapps_game_engine_engine.$_$.p1;
|
|
82
|
+
var PartnerSelectedFromClientAction = kotlin_io_raspberryapps_game_engine_engine.$_$.i5;
|
|
83
|
+
var CalcPointsSceneData = kotlin_io_raspberryapps_game_engine_engine.$_$.k1;
|
|
84
|
+
var ExitFromClientAction = kotlin_io_raspberryapps_game_engine_engine.$_$.e5;
|
|
85
|
+
var PlayerReadyFromClientAction = kotlin_io_raspberryapps_game_engine_engine.$_$.j5;
|
|
86
|
+
var get_isCalcPointScene = kotlin_io_raspberryapps_game_engine_engine.$_$.v3;
|
|
87
|
+
var get_isChoosePartnerScene = kotlin_io_raspberryapps_game_engine_engine.$_$.w3;
|
|
88
|
+
var ExternalBotAnswerProvider = kotlin_io_raspberryapps_game_engine_engine.$_$.h8;
|
|
89
|
+
var Enum = kotlin_kotlin.$_$.ri;
|
|
90
|
+
var max = kotlin_kotlin.$_$.a9;
|
|
91
|
+
var sum = kotlin_kotlin.$_$.z9;
|
|
92
|
+
var FloatCompanionObject_instance = kotlin_kotlin.$_$.s4;
|
|
93
|
+
var floatFromBits = kotlin_kotlin.$_$.gd;
|
|
94
|
+
var toSet = kotlin_kotlin.$_$.qa;
|
|
95
|
+
var setOf = kotlin_kotlin.$_$.r9;
|
|
96
|
+
var setOf_0 = kotlin_kotlin.$_$.s9;
|
|
97
|
+
var first = kotlin_kotlin.$_$.x7;
|
|
98
|
+
var getGrowth = kotlin_io_raspberryapps_game_engine_core.$_$.p1;
|
|
99
|
+
var compareTo = kotlin_kotlin.$_$.cd;
|
|
100
|
+
var getNumberHashCode = kotlin_kotlin.$_$.id;
|
|
101
|
+
var emptyMap = kotlin_kotlin.$_$.p7;
|
|
102
|
+
var distinct = kotlin_kotlin.$_$.l7;
|
|
103
|
+
var mapCapacity = kotlin_kotlin.$_$.w8;
|
|
104
|
+
var LinkedHashMap_init_$Create$_0 = kotlin_kotlin.$_$.r;
|
|
105
|
+
var sum_0 = kotlin_kotlin.$_$.y9;
|
|
106
|
+
var NoSuchElementException_init_$Create$ = kotlin_kotlin.$_$.w1;
|
|
107
|
+
var toMutableList = kotlin_kotlin.$_$.na;
|
|
108
|
+
var Default_getInstance = kotlin_kotlin.$_$.w4;
|
|
109
|
+
var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.o1;
|
|
110
|
+
var ensureNotNull = kotlin_kotlin.$_$.uj;
|
|
111
|
+
var getPoint = kotlin_io_raspberryapps_game_engine_core.$_$.q1;
|
|
112
|
+
var Companion_instance_0 = kotlin_io_raspberryapps_cardgame_core.$_$.n;
|
|
113
|
+
var get_indices_0 = kotlin_kotlin.$_$.g8;
|
|
114
|
+
var toList = kotlin_kotlin.$_$.ha;
|
|
115
|
+
var get_lastIndex = kotlin_kotlin.$_$.o8;
|
|
116
|
+
var CardName_ACE_getInstance = kotlin_io_raspberryapps_cardgame_core.$_$.a;
|
|
117
|
+
var CardName_KING_getInstance = kotlin_io_raspberryapps_cardgame_core.$_$.d;
|
|
118
|
+
var CardName_QUEEN_getInstance = kotlin_io_raspberryapps_cardgame_core.$_$.f;
|
|
119
|
+
var CardName_JACK_getInstance = kotlin_io_raspberryapps_cardgame_core.$_$.c;
|
|
120
|
+
var CardName_TEN_getInstance = kotlin_io_raspberryapps_cardgame_core.$_$.h;
|
|
121
|
+
var CardName_NINE_getInstance = kotlin_io_raspberryapps_cardgame_core.$_$.e;
|
|
122
|
+
var CardName_EIGHT_getInstance = kotlin_io_raspberryapps_cardgame_core.$_$.b;
|
|
123
|
+
var CardName_SEVEN_getInstance = kotlin_io_raspberryapps_cardgame_core.$_$.g;
|
|
124
|
+
var until = kotlin_kotlin.$_$.ff;
|
|
125
|
+
var checkCountOverflow = kotlin_kotlin.$_$.m6;
|
|
126
|
+
var objectCreate = kotlin_kotlin.$_$.me;
|
|
127
|
+
var getValueInHand = kotlin_io_raspberryapps_game_engine_core.$_$.r1;
|
|
128
|
+
var to = kotlin_kotlin.$_$.hk;
|
|
129
|
+
var firstOrNull = kotlin_kotlin.$_$.u7;
|
|
130
|
+
//endregion
|
|
131
|
+
//region block: pre-declaration
|
|
132
|
+
initMetadataForClass(BotAction, 'BotAction');
|
|
133
|
+
initMetadataForClass(PlayCard, 'PlayCard', VOID, BotAction);
|
|
134
|
+
initMetadataForClass(SelectSuit, 'SelectSuit', VOID, BotAction);
|
|
135
|
+
initMetadataForClass(AcceptCombinations, 'AcceptCombinations', VOID, BotAction);
|
|
136
|
+
initMetadataForClass(BotGameState, 'BotGameState');
|
|
137
|
+
initMetadataForCompanion(Companion);
|
|
138
|
+
initMetadataForClass(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
|
|
139
|
+
initMetadataForClass(BeliefFeatureEncoder, 'BeliefFeatureEncoder');
|
|
140
|
+
initMetadataForClass(CardBeliefNetwork, 'CardBeliefNetwork');
|
|
141
|
+
initMetadataForClass(CardBeliefResult, 'CardBeliefResult');
|
|
142
|
+
initMetadataForObject(CardLocationIndex, 'CardLocationIndex');
|
|
143
|
+
initMetadataForClass(BotModelConfig, 'BotModelConfig');
|
|
144
|
+
initMetadataForClass(BotModelRegistry, 'BotModelRegistry', BotModelRegistry);
|
|
145
|
+
initMetadataForClass(BotModelKey, 'BotModelKey');
|
|
146
|
+
initMetadataForClass(BotPolicyAnswerProvider, 'BotPolicyAnswerProvider', VOID, VOID, [ExternalBotAnswerProvider]);
|
|
147
|
+
initMetadataForCompanion(Companion_0);
|
|
148
|
+
initMetadataForClass(PimcBotAnswerProvider, 'PimcBotAnswerProvider', VOID, VOID, [ExternalBotAnswerProvider]);
|
|
149
|
+
initMetadataForClass(Layer, 'Layer');
|
|
150
|
+
initMetadataForClass(BatchNormParams, 'BatchNormParams');
|
|
151
|
+
initMetadataForClass(Activation, 'Activation', VOID, Enum);
|
|
152
|
+
initMetadataForCompanion(Companion_1);
|
|
153
|
+
initMetadataForClass(PureKotlinInferenceEngine, 'PureKotlinInferenceEngine', PureKotlinInferenceEngine);
|
|
154
|
+
initMetadataForClass(ByteArrayReader, 'ByteArrayReader');
|
|
155
|
+
initMetadataForCompanion(Companion_2);
|
|
156
|
+
initMetadataForClass(DeterministicRollout, 'DeterministicRollout');
|
|
157
|
+
initMetadataForClass(RolloutState, 'RolloutState');
|
|
158
|
+
initMetadataForClass(RolloutResult, 'RolloutResult');
|
|
159
|
+
initMetadataForClass(WorldMoveScore, 'WorldMoveScore');
|
|
160
|
+
initMetadataForObject(MoveScoreAggregator, 'MoveScoreAggregator');
|
|
161
|
+
initMetadataForClass(PimcConfig, 'PimcConfig', PimcConfig);
|
|
162
|
+
initMetadataForClass(PimcEngine, 'PimcEngine');
|
|
163
|
+
initMetadataForClass(SimCard, 'SimCard');
|
|
164
|
+
initMetadataForObject(TrickSimulator, 'TrickSimulator');
|
|
165
|
+
initMetadataForClass(TrickResult, 'TrickResult');
|
|
166
|
+
initMetadataForCompanion(Companion_3);
|
|
167
|
+
initMetadataForClass(sam$kotlin_Comparator$0_0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
|
|
168
|
+
initMetadataForClass(WorldSampler, 'WorldSampler');
|
|
169
|
+
initMetadataForClass(SampledWorld, 'SampledWorld');
|
|
170
|
+
initMetadataForClass(FirstLegalActionPolicy, 'FirstLegalActionPolicy', FirstLegalActionPolicy);
|
|
171
|
+
initMetadataForClass(PimcBotPolicy, 'PimcBotPolicy');
|
|
172
|
+
initMetadataForClass(RolloutPolicy, 'RolloutPolicy', RolloutPolicy);
|
|
173
|
+
initMetadataForClass(SuitSelectionPolicy, 'SuitSelectionPolicy', SuitSelectionPolicy);
|
|
174
|
+
//endregion
|
|
175
|
+
function PlayCard(card, combinations) {
|
|
176
|
+
combinations = combinations === VOID ? null : combinations;
|
|
177
|
+
BotAction.call(this);
|
|
178
|
+
this.kb4_1 = card;
|
|
179
|
+
this.lb4_1 = combinations;
|
|
180
|
+
}
|
|
181
|
+
protoOf(PlayCard).toString = function () {
|
|
182
|
+
return 'PlayCard(card=' + this.kb4_1.toString() + ', combinations=' + toString(this.lb4_1) + ')';
|
|
183
|
+
};
|
|
184
|
+
protoOf(PlayCard).hashCode = function () {
|
|
185
|
+
var result = this.kb4_1.hashCode();
|
|
186
|
+
result = imul(result, 31) + (this.lb4_1 == null ? 0 : hashCode(this.lb4_1)) | 0;
|
|
187
|
+
return result;
|
|
188
|
+
};
|
|
189
|
+
protoOf(PlayCard).equals = function (other) {
|
|
190
|
+
if (this === other)
|
|
191
|
+
return true;
|
|
192
|
+
if (!(other instanceof PlayCard))
|
|
193
|
+
return false;
|
|
194
|
+
if (!this.kb4_1.equals(other.kb4_1))
|
|
195
|
+
return false;
|
|
196
|
+
if (!equals(this.lb4_1, other.lb4_1))
|
|
197
|
+
return false;
|
|
198
|
+
return true;
|
|
199
|
+
};
|
|
200
|
+
function SelectSuit(suit) {
|
|
201
|
+
BotAction.call(this);
|
|
202
|
+
this.mb4_1 = suit;
|
|
203
|
+
}
|
|
204
|
+
protoOf(SelectSuit).toString = function () {
|
|
205
|
+
return 'SelectSuit(suit=' + toString(this.mb4_1) + ')';
|
|
206
|
+
};
|
|
207
|
+
protoOf(SelectSuit).hashCode = function () {
|
|
208
|
+
return this.mb4_1 == null ? 0 : this.mb4_1.hashCode();
|
|
209
|
+
};
|
|
210
|
+
protoOf(SelectSuit).equals = function (other) {
|
|
211
|
+
if (this === other)
|
|
212
|
+
return true;
|
|
213
|
+
if (!(other instanceof SelectSuit))
|
|
214
|
+
return false;
|
|
215
|
+
if (!equals(this.mb4_1, other.mb4_1))
|
|
216
|
+
return false;
|
|
217
|
+
return true;
|
|
218
|
+
};
|
|
219
|
+
function AcceptCombinations(isAccepted) {
|
|
220
|
+
BotAction.call(this);
|
|
221
|
+
this.nb4_1 = isAccepted;
|
|
222
|
+
}
|
|
223
|
+
protoOf(AcceptCombinations).toString = function () {
|
|
224
|
+
return 'AcceptCombinations(isAccepted=' + this.nb4_1 + ')';
|
|
225
|
+
};
|
|
226
|
+
protoOf(AcceptCombinations).hashCode = function () {
|
|
227
|
+
return getBooleanHashCode(this.nb4_1);
|
|
228
|
+
};
|
|
229
|
+
protoOf(AcceptCombinations).equals = function (other) {
|
|
230
|
+
if (this === other)
|
|
231
|
+
return true;
|
|
232
|
+
if (!(other instanceof AcceptCombinations))
|
|
233
|
+
return false;
|
|
234
|
+
if (!(this.nb4_1 === other.nb4_1))
|
|
235
|
+
return false;
|
|
236
|
+
return true;
|
|
237
|
+
};
|
|
238
|
+
function BotAction() {
|
|
239
|
+
}
|
|
240
|
+
function BotGameState(focalPlayerId, playerOrder, ownCards, playedCards, currentTrick, trump, trumpCard, isTrumpDeclarer, suitSelectionHistory, ownTeamScore, opponentTeamScore, ownRoundPoints, opponentRoundPoints, trickNumber, positionInTrick, ownTeamWonLastTrick, declaredCombinations, rules, playersMode, handSize) {
|
|
241
|
+
trumpCard = trumpCard === VOID ? null : trumpCard;
|
|
242
|
+
suitSelectionHistory = suitSelectionHistory === VOID ? emptyList() : suitSelectionHistory;
|
|
243
|
+
handSize = handSize === VOID ? 8 : handSize;
|
|
244
|
+
this.ob4_1 = focalPlayerId;
|
|
245
|
+
this.pb4_1 = playerOrder;
|
|
246
|
+
this.qb4_1 = ownCards;
|
|
247
|
+
this.rb4_1 = playedCards;
|
|
248
|
+
this.sb4_1 = currentTrick;
|
|
249
|
+
this.tb4_1 = trump;
|
|
250
|
+
this.ub4_1 = trumpCard;
|
|
251
|
+
this.vb4_1 = isTrumpDeclarer;
|
|
252
|
+
this.wb4_1 = suitSelectionHistory;
|
|
253
|
+
this.xb4_1 = ownTeamScore;
|
|
254
|
+
this.yb4_1 = opponentTeamScore;
|
|
255
|
+
this.zb4_1 = ownRoundPoints;
|
|
256
|
+
this.ab5_1 = opponentRoundPoints;
|
|
257
|
+
this.bb5_1 = trickNumber;
|
|
258
|
+
this.cb5_1 = positionInTrick;
|
|
259
|
+
this.db5_1 = ownTeamWonLastTrick;
|
|
260
|
+
this.eb5_1 = declaredCombinations;
|
|
261
|
+
this.fb5_1 = rules;
|
|
262
|
+
this.gb5_1 = playersMode;
|
|
263
|
+
this.hb5_1 = handSize;
|
|
264
|
+
}
|
|
265
|
+
protoOf(BotGameState).toString = function () {
|
|
266
|
+
return 'BotGameState(focalPlayerId=' + this.ob4_1 + ', playerOrder=' + toString_0(this.pb4_1) + ', ownCards=' + toString_0(this.qb4_1) + ', playedCards=' + toString_0(this.rb4_1) + ', currentTrick=' + toString_0(this.sb4_1) + ', trump=' + toString(this.tb4_1) + ', trumpCard=' + toString(this.ub4_1) + ', isTrumpDeclarer=' + this.vb4_1 + ', suitSelectionHistory=' + toString_0(this.wb4_1) + ', ownTeamScore=' + this.xb4_1 + ', opponentTeamScore=' + this.yb4_1 + ', ownRoundPoints=' + this.zb4_1 + ', opponentRoundPoints=' + this.ab5_1 + ', trickNumber=' + this.bb5_1 + ', positionInTrick=' + this.cb5_1 + ', ownTeamWonLastTrick=' + this.db5_1 + ', declaredCombinations=' + toString_0(this.eb5_1) + ', rules=' + this.fb5_1.toString() + ', playersMode=' + this.gb5_1.toString() + ', handSize=' + this.hb5_1 + ')';
|
|
267
|
+
};
|
|
268
|
+
protoOf(BotGameState).hashCode = function () {
|
|
269
|
+
var result = getStringHashCode(this.ob4_1);
|
|
270
|
+
result = imul(result, 31) + hashCode(this.pb4_1) | 0;
|
|
271
|
+
result = imul(result, 31) + hashCode(this.qb4_1) | 0;
|
|
272
|
+
result = imul(result, 31) + hashCode(this.rb4_1) | 0;
|
|
273
|
+
result = imul(result, 31) + hashCode(this.sb4_1) | 0;
|
|
274
|
+
result = imul(result, 31) + (this.tb4_1 == null ? 0 : this.tb4_1.hashCode()) | 0;
|
|
275
|
+
result = imul(result, 31) + (this.ub4_1 == null ? 0 : this.ub4_1.hashCode()) | 0;
|
|
276
|
+
result = imul(result, 31) + getBooleanHashCode(this.vb4_1) | 0;
|
|
277
|
+
result = imul(result, 31) + hashCode(this.wb4_1) | 0;
|
|
278
|
+
result = imul(result, 31) + this.xb4_1 | 0;
|
|
279
|
+
result = imul(result, 31) + this.yb4_1 | 0;
|
|
280
|
+
result = imul(result, 31) + this.zb4_1 | 0;
|
|
281
|
+
result = imul(result, 31) + this.ab5_1 | 0;
|
|
282
|
+
result = imul(result, 31) + this.bb5_1 | 0;
|
|
283
|
+
result = imul(result, 31) + this.cb5_1 | 0;
|
|
284
|
+
result = imul(result, 31) + getBooleanHashCode(this.db5_1) | 0;
|
|
285
|
+
result = imul(result, 31) + hashCode(this.eb5_1) | 0;
|
|
286
|
+
result = imul(result, 31) + this.fb5_1.hashCode() | 0;
|
|
287
|
+
result = imul(result, 31) + this.gb5_1.hashCode() | 0;
|
|
288
|
+
result = imul(result, 31) + this.hb5_1 | 0;
|
|
289
|
+
return result;
|
|
290
|
+
};
|
|
291
|
+
protoOf(BotGameState).equals = function (other) {
|
|
292
|
+
if (this === other)
|
|
293
|
+
return true;
|
|
294
|
+
if (!(other instanceof BotGameState))
|
|
295
|
+
return false;
|
|
296
|
+
if (!(this.ob4_1 === other.ob4_1))
|
|
297
|
+
return false;
|
|
298
|
+
if (!equals(this.pb4_1, other.pb4_1))
|
|
299
|
+
return false;
|
|
300
|
+
if (!equals(this.qb4_1, other.qb4_1))
|
|
301
|
+
return false;
|
|
302
|
+
if (!equals(this.rb4_1, other.rb4_1))
|
|
303
|
+
return false;
|
|
304
|
+
if (!equals(this.sb4_1, other.sb4_1))
|
|
305
|
+
return false;
|
|
306
|
+
if (!equals(this.tb4_1, other.tb4_1))
|
|
307
|
+
return false;
|
|
308
|
+
if (!equals(this.ub4_1, other.ub4_1))
|
|
309
|
+
return false;
|
|
310
|
+
if (!(this.vb4_1 === other.vb4_1))
|
|
311
|
+
return false;
|
|
312
|
+
if (!equals(this.wb4_1, other.wb4_1))
|
|
313
|
+
return false;
|
|
314
|
+
if (!(this.xb4_1 === other.xb4_1))
|
|
315
|
+
return false;
|
|
316
|
+
if (!(this.yb4_1 === other.yb4_1))
|
|
317
|
+
return false;
|
|
318
|
+
if (!(this.zb4_1 === other.zb4_1))
|
|
319
|
+
return false;
|
|
320
|
+
if (!(this.ab5_1 === other.ab5_1))
|
|
321
|
+
return false;
|
|
322
|
+
if (!(this.bb5_1 === other.bb5_1))
|
|
323
|
+
return false;
|
|
324
|
+
if (!(this.cb5_1 === other.cb5_1))
|
|
325
|
+
return false;
|
|
326
|
+
if (!(this.db5_1 === other.db5_1))
|
|
327
|
+
return false;
|
|
328
|
+
if (!equals(this.eb5_1, other.eb5_1))
|
|
329
|
+
return false;
|
|
330
|
+
if (!this.fb5_1.equals(other.fb5_1))
|
|
331
|
+
return false;
|
|
332
|
+
if (!this.gb5_1.equals(other.gb5_1))
|
|
333
|
+
return false;
|
|
334
|
+
if (!(this.hb5_1 === other.hb5_1))
|
|
335
|
+
return false;
|
|
336
|
+
return true;
|
|
337
|
+
};
|
|
338
|
+
function encodeCardSet($this, vec, offset, cards) {
|
|
339
|
+
var _iterator__ex2g4s = cards.t();
|
|
340
|
+
while (_iterator__ex2g4s.u()) {
|
|
341
|
+
var card = _iterator__ex2g4s.v();
|
|
342
|
+
vec[offset + CardLocationIndex_instance.lb5(card) | 0] = 1.0;
|
|
343
|
+
}
|
|
344
|
+
return offset + 32 | 0;
|
|
345
|
+
}
|
|
346
|
+
function encodeCardOneHot($this, vec, offset, card) {
|
|
347
|
+
if (!(card == null)) {
|
|
348
|
+
vec[offset + CardLocationIndex_instance.lb5(card) | 0] = 1.0;
|
|
349
|
+
}
|
|
350
|
+
return offset + 32 | 0;
|
|
351
|
+
}
|
|
352
|
+
function Companion() {
|
|
353
|
+
this.mb5_1 = 32;
|
|
354
|
+
this.nb5_1 = 162.0;
|
|
355
|
+
}
|
|
356
|
+
var Companion_instance_1;
|
|
357
|
+
function Companion_getInstance() {
|
|
358
|
+
return Companion_instance_1;
|
|
359
|
+
}
|
|
360
|
+
function sam$kotlin_Comparator$0(function_0) {
|
|
361
|
+
this.ob5_1 = function_0;
|
|
362
|
+
}
|
|
363
|
+
protoOf(sam$kotlin_Comparator$0).hd = function (a, b) {
|
|
364
|
+
return this.ob5_1(a, b);
|
|
365
|
+
};
|
|
366
|
+
protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
|
|
367
|
+
return this.hd(a, b);
|
|
368
|
+
};
|
|
369
|
+
protoOf(sam$kotlin_Comparator$0).s3 = function () {
|
|
370
|
+
return this.ob5_1;
|
|
371
|
+
};
|
|
372
|
+
protoOf(sam$kotlin_Comparator$0).equals = function (other) {
|
|
373
|
+
var tmp;
|
|
374
|
+
if (!(other == null) ? isInterface(other, Comparator) : false) {
|
|
375
|
+
var tmp_0;
|
|
376
|
+
if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
|
|
377
|
+
tmp_0 = equals(this.s3(), other.s3());
|
|
378
|
+
} else {
|
|
379
|
+
tmp_0 = false;
|
|
380
|
+
}
|
|
381
|
+
tmp = tmp_0;
|
|
382
|
+
} else {
|
|
383
|
+
tmp = false;
|
|
384
|
+
}
|
|
385
|
+
return tmp;
|
|
386
|
+
};
|
|
387
|
+
protoOf(sam$kotlin_Comparator$0).hashCode = function () {
|
|
388
|
+
return hashCode(this.s3());
|
|
389
|
+
};
|
|
390
|
+
function BeliefFeatureEncoder$encode$lambda(a, b) {
|
|
391
|
+
// Inline function 'kotlin.comparisons.compareValuesBy' call
|
|
392
|
+
var tmp = a.h8i_1;
|
|
393
|
+
var tmp$ret$1 = b.h8i_1;
|
|
394
|
+
return compareValues(tmp, tmp$ret$1);
|
|
395
|
+
}
|
|
396
|
+
function BeliefFeatureEncoder(playersMode) {
|
|
397
|
+
this.pb5_1 = playersMode;
|
|
398
|
+
this.qb5_1 = this.pb5_1.count;
|
|
399
|
+
this.rb5_1 = this.qb5_1 - 1 | 0;
|
|
400
|
+
var tmp = this;
|
|
401
|
+
// Inline function 'kotlin.run' call
|
|
402
|
+
tmp.sb5_1 = (((((((((32 + imul(32, this.qb5_1) | 0) + 96 | 0) + 4 | 0) + 32 | 0) + 1 | 0) + imul(this.qb5_1, 4) | 0) + 8 | 0) + 4 | 0) + 4 | 0) + this.rb5_1 | 0;
|
|
403
|
+
}
|
|
404
|
+
protoOf(BeliefFeatureEncoder).tb5 = function (state) {
|
|
405
|
+
var vec = new Float32Array(this.sb5_1);
|
|
406
|
+
var offset = 0;
|
|
407
|
+
var focalIndex = state.pb4_1.o2(state.ob4_1);
|
|
408
|
+
var n = state.pb4_1.g1();
|
|
409
|
+
offset = encodeCardSet(this, vec, offset, state.qb4_1);
|
|
410
|
+
var inductionVariable = 0;
|
|
411
|
+
var last = this.qb5_1;
|
|
412
|
+
if (inductionVariable < last)
|
|
413
|
+
do {
|
|
414
|
+
var relPos = inductionVariable;
|
|
415
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
416
|
+
var absIdx = (focalIndex + relPos | 0) % n | 0;
|
|
417
|
+
// Inline function 'kotlin.collections.getOrElse' call
|
|
418
|
+
var this_0 = state.pb4_1;
|
|
419
|
+
var tmp;
|
|
420
|
+
if (0 <= absIdx ? absIdx < this_0.g1() : false) {
|
|
421
|
+
tmp = this_0.h1(absIdx);
|
|
422
|
+
} else {
|
|
423
|
+
tmp = '';
|
|
424
|
+
}
|
|
425
|
+
var pid = tmp;
|
|
426
|
+
var tmp_0 = offset;
|
|
427
|
+
var tmp0_elvis_lhs = state.rb4_1.v2(pid);
|
|
428
|
+
offset = encodeCardSet(this, vec, tmp_0, tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs);
|
|
429
|
+
}
|
|
430
|
+
while (inductionVariable < last);
|
|
431
|
+
// Inline function 'kotlin.collections.sortedBy' call
|
|
432
|
+
var this_1 = state.sb4_1;
|
|
433
|
+
// Inline function 'kotlin.comparisons.compareBy' call
|
|
434
|
+
var tmp_1 = BeliefFeatureEncoder$encode$lambda;
|
|
435
|
+
var tmp$ret$2 = new sam$kotlin_Comparator$0(tmp_1);
|
|
436
|
+
var sortedTrick = sortedWith(this_1, tmp$ret$2);
|
|
437
|
+
var inductionVariable_0 = 0;
|
|
438
|
+
if (inductionVariable_0 <= 2)
|
|
439
|
+
do {
|
|
440
|
+
var slot = inductionVariable_0;
|
|
441
|
+
inductionVariable_0 = inductionVariable_0 + 1 | 0;
|
|
442
|
+
var tmp1_safe_receiver = getOrNull(sortedTrick, slot);
|
|
443
|
+
var card = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.i8i_1;
|
|
444
|
+
offset = encodeCardOneHot(this, vec, offset, card);
|
|
445
|
+
}
|
|
446
|
+
while (inductionVariable_0 <= 2);
|
|
447
|
+
var trump = state.tb4_1;
|
|
448
|
+
if (!(trump == null)) {
|
|
449
|
+
vec[offset + trump.a1_1 | 0] = 1.0;
|
|
450
|
+
}
|
|
451
|
+
offset = offset + 4 | 0;
|
|
452
|
+
offset = encodeCardOneHot(this, vec, offset, state.ub4_1);
|
|
453
|
+
var _unary__edvuaz = offset;
|
|
454
|
+
offset = _unary__edvuaz + 1 | 0;
|
|
455
|
+
vec[_unary__edvuaz] = state.vb4_1 ? 1.0 : 0.0;
|
|
456
|
+
var inductionVariable_1 = 0;
|
|
457
|
+
var last_0 = this.qb5_1;
|
|
458
|
+
if (inductionVariable_1 < last_0)
|
|
459
|
+
do {
|
|
460
|
+
var relPos_0 = inductionVariable_1;
|
|
461
|
+
inductionVariable_1 = inductionVariable_1 + 1 | 0;
|
|
462
|
+
var absIdx_0 = (focalIndex + relPos_0 | 0) % n | 0;
|
|
463
|
+
// Inline function 'kotlin.collections.getOrElse' call
|
|
464
|
+
var this_2 = state.pb4_1;
|
|
465
|
+
var tmp_2;
|
|
466
|
+
if (0 <= absIdx_0 ? absIdx_0 < this_2.g1() : false) {
|
|
467
|
+
tmp_2 = this_2.h1(absIdx_0);
|
|
468
|
+
} else {
|
|
469
|
+
tmp_2 = '';
|
|
470
|
+
}
|
|
471
|
+
var pid_0 = tmp_2;
|
|
472
|
+
var inductionVariable_2 = 0;
|
|
473
|
+
if (inductionVariable_2 < 4)
|
|
474
|
+
do {
|
|
475
|
+
var suitOrd = inductionVariable_2;
|
|
476
|
+
inductionVariable_2 = inductionVariable_2 + 1 | 0;
|
|
477
|
+
var tmp0 = state.wb4_1;
|
|
478
|
+
var tmp$ret$6;
|
|
479
|
+
$l$block_0: {
|
|
480
|
+
// Inline function 'kotlin.collections.any' call
|
|
481
|
+
var tmp_3;
|
|
482
|
+
if (isInterface(tmp0, Collection)) {
|
|
483
|
+
tmp_3 = tmp0.r();
|
|
484
|
+
} else {
|
|
485
|
+
tmp_3 = false;
|
|
486
|
+
}
|
|
487
|
+
if (tmp_3) {
|
|
488
|
+
tmp$ret$6 = false;
|
|
489
|
+
break $l$block_0;
|
|
490
|
+
}
|
|
491
|
+
var _iterator__ex2g4s = tmp0.t();
|
|
492
|
+
while (_iterator__ex2g4s.u()) {
|
|
493
|
+
var element = _iterator__ex2g4s.v();
|
|
494
|
+
if (element.ub5_1 === pid_0 && element.vb5_1 == null) {
|
|
495
|
+
tmp$ret$6 = true;
|
|
496
|
+
break $l$block_0;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
tmp$ret$6 = false;
|
|
500
|
+
}
|
|
501
|
+
var passed = tmp$ret$6;
|
|
502
|
+
var _unary__edvuaz_0 = offset;
|
|
503
|
+
offset = _unary__edvuaz_0 + 1 | 0;
|
|
504
|
+
vec[_unary__edvuaz_0] = passed ? 1.0 : 0.0;
|
|
505
|
+
}
|
|
506
|
+
while (inductionVariable_2 < 4);
|
|
507
|
+
}
|
|
508
|
+
while (inductionVariable_1 < last_0);
|
|
509
|
+
var trickIdx = coerceIn(state.bb5_1, 0, 7);
|
|
510
|
+
vec[offset + trickIdx | 0] = 1.0;
|
|
511
|
+
offset = offset + 8 | 0;
|
|
512
|
+
var posIdx = coerceIn(state.cb5_1, 0, 3);
|
|
513
|
+
vec[offset + posIdx | 0] = 1.0;
|
|
514
|
+
offset = offset + 4 | 0;
|
|
515
|
+
var winTarget = coerceAtLeast(state.fb5_1.winTargetPoints, 1.0);
|
|
516
|
+
var _unary__edvuaz_1 = offset;
|
|
517
|
+
offset = _unary__edvuaz_1 + 1 | 0;
|
|
518
|
+
vec[_unary__edvuaz_1] = state.xb4_1 / winTarget;
|
|
519
|
+
var _unary__edvuaz_2 = offset;
|
|
520
|
+
offset = _unary__edvuaz_2 + 1 | 0;
|
|
521
|
+
vec[_unary__edvuaz_2] = state.yb4_1 / winTarget;
|
|
522
|
+
var _unary__edvuaz_3 = offset;
|
|
523
|
+
offset = _unary__edvuaz_3 + 1 | 0;
|
|
524
|
+
vec[_unary__edvuaz_3] = state.zb4_1 / 162.0;
|
|
525
|
+
var _unary__edvuaz_4 = offset;
|
|
526
|
+
offset = _unary__edvuaz_4 + 1 | 0;
|
|
527
|
+
vec[_unary__edvuaz_4] = state.ab5_1 / 162.0;
|
|
528
|
+
var inductionVariable_3 = 1;
|
|
529
|
+
var last_1 = this.rb5_1;
|
|
530
|
+
if (inductionVariable_3 <= last_1)
|
|
531
|
+
do {
|
|
532
|
+
var relPos_1 = inductionVariable_3;
|
|
533
|
+
inductionVariable_3 = inductionVariable_3 + 1 | 0;
|
|
534
|
+
var absIdx_1 = (focalIndex + relPos_1 | 0) % n | 0;
|
|
535
|
+
// Inline function 'kotlin.collections.getOrElse' call
|
|
536
|
+
var this_3 = state.pb4_1;
|
|
537
|
+
var tmp_4;
|
|
538
|
+
if (0 <= absIdx_1 ? absIdx_1 < this_3.g1() : false) {
|
|
539
|
+
tmp_4 = this_3.h1(absIdx_1);
|
|
540
|
+
} else {
|
|
541
|
+
tmp_4 = '';
|
|
542
|
+
}
|
|
543
|
+
var pid_1 = tmp_4;
|
|
544
|
+
var tmp2_elvis_lhs = state.rb4_1.v2(pid_1);
|
|
545
|
+
var played = (tmp2_elvis_lhs == null ? emptyList() : tmp2_elvis_lhs).g1();
|
|
546
|
+
var remaining = coerceAtLeast_0(state.hb5_1 - played | 0, 0);
|
|
547
|
+
var _unary__edvuaz_5 = offset;
|
|
548
|
+
offset = _unary__edvuaz_5 + 1 | 0;
|
|
549
|
+
vec[_unary__edvuaz_5] = remaining / coerceAtLeast(state.hb5_1, 1.0);
|
|
550
|
+
}
|
|
551
|
+
while (!(relPos_1 === last_1));
|
|
552
|
+
// Inline function 'kotlin.check' call
|
|
553
|
+
if (!(offset === this.sb5_1)) {
|
|
554
|
+
var message = 'BeliefFeatureEncoder: wrote ' + offset + ' floats but expected ' + this.sb5_1;
|
|
555
|
+
throw IllegalStateException_init_$Create$(toString_0(message));
|
|
556
|
+
}
|
|
557
|
+
return vec;
|
|
558
|
+
};
|
|
559
|
+
function CardBeliefNetwork(engine, encoder, playersMode) {
|
|
560
|
+
this.xb5_1 = engine;
|
|
561
|
+
this.yb5_1 = encoder;
|
|
562
|
+
this.zb5_1 = playersMode;
|
|
563
|
+
this.ab6_1 = CardLocationIndex_instance.cb6(this.zb5_1);
|
|
564
|
+
this.bb6_1 = false;
|
|
565
|
+
}
|
|
566
|
+
protoOf(CardBeliefNetwork).db6 = function (modelBytes) {
|
|
567
|
+
this.xb5_1.db6(modelBytes);
|
|
568
|
+
this.bb6_1 = true;
|
|
569
|
+
};
|
|
570
|
+
protoOf(CardBeliefNetwork).eb6 = function (state) {
|
|
571
|
+
var knownCards = booleanArray(32);
|
|
572
|
+
var _iterator__ex2g4s = state.qb4_1.t();
|
|
573
|
+
while (_iterator__ex2g4s.u()) {
|
|
574
|
+
var card = _iterator__ex2g4s.v();
|
|
575
|
+
knownCards[CardLocationIndex_instance.lb5(card)] = true;
|
|
576
|
+
}
|
|
577
|
+
// Inline function 'kotlin.collections.iterator' call
|
|
578
|
+
var _iterator__ex2g4s_0 = state.rb4_1.m1().t();
|
|
579
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
580
|
+
// Inline function 'kotlin.collections.component2' call
|
|
581
|
+
var cards = _iterator__ex2g4s_0.v().o1();
|
|
582
|
+
var _iterator__ex2g4s_1 = cards.t();
|
|
583
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
584
|
+
var card_0 = _iterator__ex2g4s_1.v();
|
|
585
|
+
knownCards[CardLocationIndex_instance.lb5(card_0)] = true;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
var _iterator__ex2g4s_2 = state.sb4_1.t();
|
|
589
|
+
while (_iterator__ex2g4s_2.u()) {
|
|
590
|
+
var cot = _iterator__ex2g4s_2.v();
|
|
591
|
+
knownCards[CardLocationIndex_instance.lb5(cot.i8i_1)] = true;
|
|
592
|
+
}
|
|
593
|
+
// Inline function 'kotlin.collections.mutableListOf' call
|
|
594
|
+
var hiddenIndices = ArrayList_init_$Create$();
|
|
595
|
+
var inductionVariable = 0;
|
|
596
|
+
if (inductionVariable < 32)
|
|
597
|
+
do {
|
|
598
|
+
var i = inductionVariable;
|
|
599
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
600
|
+
if (!knownCards[i]) {
|
|
601
|
+
hiddenIndices.e1(i);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
while (inductionVariable < 32);
|
|
605
|
+
if (!this.bb6_1) {
|
|
606
|
+
var uniform = 1.0 / this.ab6_1;
|
|
607
|
+
var tmp = 0;
|
|
608
|
+
var tmp_0 = hiddenIndices.g1();
|
|
609
|
+
// Inline function 'kotlin.arrayOfNulls' call
|
|
610
|
+
var tmp_1 = Array(tmp_0);
|
|
611
|
+
while (tmp < tmp_0) {
|
|
612
|
+
var tmp_2 = tmp;
|
|
613
|
+
var tmp_3 = 0;
|
|
614
|
+
var tmp_4 = this.ab6_1;
|
|
615
|
+
var tmp_5 = new Float32Array(tmp_4);
|
|
616
|
+
while (tmp_3 < tmp_4) {
|
|
617
|
+
tmp_5[tmp_3] = uniform;
|
|
618
|
+
tmp_3 = tmp_3 + 1 | 0;
|
|
619
|
+
}
|
|
620
|
+
tmp_1[tmp_2] = tmp_5;
|
|
621
|
+
tmp = tmp + 1 | 0;
|
|
622
|
+
}
|
|
623
|
+
var matrix = tmp_1;
|
|
624
|
+
return new CardBeliefResult(matrix, toIntArray(hiddenIndices));
|
|
625
|
+
}
|
|
626
|
+
var features = this.yb5_1.tb5(state);
|
|
627
|
+
var rawOutput = this.xb5_1.fb6(features);
|
|
628
|
+
var tmp_6 = 0;
|
|
629
|
+
var tmp_7 = hiddenIndices.g1();
|
|
630
|
+
// Inline function 'kotlin.arrayOfNulls' call
|
|
631
|
+
var tmp_8 = Array(tmp_7);
|
|
632
|
+
while (tmp_6 < tmp_7) {
|
|
633
|
+
var tmp_9 = tmp_6;
|
|
634
|
+
var cardIdx = hiddenIndices.h1(tmp_9);
|
|
635
|
+
var rowStart = imul(cardIdx, this.ab6_1);
|
|
636
|
+
var tmp_10 = 0;
|
|
637
|
+
var tmp_11 = this.ab6_1;
|
|
638
|
+
var tmp_12 = new Float32Array(tmp_11);
|
|
639
|
+
while (tmp_10 < tmp_11) {
|
|
640
|
+
var tmp_13 = tmp_10;
|
|
641
|
+
// Inline function 'kotlin.collections.getOrElse' call
|
|
642
|
+
var index = rowStart + tmp_13 | 0;
|
|
643
|
+
var tmp_14;
|
|
644
|
+
if (0 <= index ? index <= (rawOutput.length - 1 | 0) : false) {
|
|
645
|
+
tmp_14 = rawOutput[index];
|
|
646
|
+
} else {
|
|
647
|
+
tmp_14 = 0.0;
|
|
648
|
+
}
|
|
649
|
+
tmp_12[tmp_13] = tmp_14;
|
|
650
|
+
tmp_10 = tmp_10 + 1 | 0;
|
|
651
|
+
}
|
|
652
|
+
var logits = tmp_12;
|
|
653
|
+
tmp_8[tmp_9] = Companion_instance_3.hb6(logits);
|
|
654
|
+
tmp_6 = tmp_6 + 1 | 0;
|
|
655
|
+
}
|
|
656
|
+
var matrix_0 = tmp_8;
|
|
657
|
+
return new CardBeliefResult(matrix_0, toIntArray(hiddenIndices));
|
|
658
|
+
};
|
|
659
|
+
function CardBeliefResult(beliefMatrix, hiddenCardIndices) {
|
|
660
|
+
this.ib6_1 = beliefMatrix;
|
|
661
|
+
this.jb6_1 = hiddenCardIndices;
|
|
662
|
+
}
|
|
663
|
+
protoOf(CardBeliefResult).equals = function (other) {
|
|
664
|
+
if (this === other)
|
|
665
|
+
return true;
|
|
666
|
+
if (other == null || !getKClassFromExpression(this).equals(getKClassFromExpression(other)))
|
|
667
|
+
return false;
|
|
668
|
+
if (!(other instanceof CardBeliefResult))
|
|
669
|
+
THROW_CCE();
|
|
670
|
+
var tmp;
|
|
671
|
+
if (contentEquals_0(this.jb6_1, other.jb6_1) && this.ib6_1.length === other.ib6_1.length) {
|
|
672
|
+
var tmp0 = get_indices(this.ib6_1);
|
|
673
|
+
var tmp$ret$0;
|
|
674
|
+
$l$block_0: {
|
|
675
|
+
// Inline function 'kotlin.collections.all' call
|
|
676
|
+
var tmp_0;
|
|
677
|
+
if (isInterface(tmp0, Collection)) {
|
|
678
|
+
tmp_0 = tmp0.r();
|
|
679
|
+
} else {
|
|
680
|
+
tmp_0 = false;
|
|
681
|
+
}
|
|
682
|
+
if (tmp_0) {
|
|
683
|
+
tmp$ret$0 = true;
|
|
684
|
+
break $l$block_0;
|
|
685
|
+
}
|
|
686
|
+
var inductionVariable = tmp0.r1_1;
|
|
687
|
+
var last = tmp0.s1_1;
|
|
688
|
+
if (inductionVariable <= last)
|
|
689
|
+
do {
|
|
690
|
+
var element = inductionVariable;
|
|
691
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
692
|
+
var it = element;
|
|
693
|
+
if (!contentEquals(this.ib6_1[it], other.ib6_1[it])) {
|
|
694
|
+
tmp$ret$0 = false;
|
|
695
|
+
break $l$block_0;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
while (!(element === last));
|
|
699
|
+
tmp$ret$0 = true;
|
|
700
|
+
}
|
|
701
|
+
tmp = tmp$ret$0;
|
|
702
|
+
} else {
|
|
703
|
+
tmp = false;
|
|
704
|
+
}
|
|
705
|
+
return tmp;
|
|
706
|
+
};
|
|
707
|
+
protoOf(CardBeliefResult).hashCode = function () {
|
|
708
|
+
var result = contentHashCode(this.jb6_1);
|
|
709
|
+
result = imul(31, result) + contentDeepHashCode(this.ib6_1) | 0;
|
|
710
|
+
return result;
|
|
711
|
+
};
|
|
712
|
+
protoOf(CardBeliefResult).toString = function () {
|
|
713
|
+
return 'CardBeliefResult(beliefMatrix=' + toString_0(this.ib6_1) + ', hiddenCardIndices=' + toString_0(this.jb6_1) + ')';
|
|
714
|
+
};
|
|
715
|
+
function CardLocationIndex() {
|
|
716
|
+
this.ib5_1 = 32;
|
|
717
|
+
this.jb5_1 = 4;
|
|
718
|
+
this.kb5_1 = 8;
|
|
719
|
+
}
|
|
720
|
+
protoOf(CardLocationIndex).lb5 = function (card) {
|
|
721
|
+
return imul(card.u6k().a1_1, 8) + card.m().a1_1 | 0;
|
|
722
|
+
};
|
|
723
|
+
protoOf(CardLocationIndex).cb6 = function (mode) {
|
|
724
|
+
return mode.count - 1 | 0;
|
|
725
|
+
};
|
|
726
|
+
var CardLocationIndex_instance;
|
|
727
|
+
function CardLocationIndex_getInstance() {
|
|
728
|
+
return CardLocationIndex_instance;
|
|
729
|
+
}
|
|
730
|
+
function BotModelConfig(playersMode, rulesSetType, modelBytes) {
|
|
731
|
+
this.kb6_1 = playersMode;
|
|
732
|
+
this.lb6_1 = rulesSetType;
|
|
733
|
+
this.mb6_1 = modelBytes;
|
|
734
|
+
}
|
|
735
|
+
protoOf(BotModelConfig).toString = function () {
|
|
736
|
+
return 'BotModelConfig(playersMode=' + this.kb6_1.toString() + ', rulesSetType=' + this.lb6_1.toString() + ', modelBytes=' + toString_0(this.mb6_1) + ')';
|
|
737
|
+
};
|
|
738
|
+
protoOf(BotModelConfig).hashCode = function () {
|
|
739
|
+
var result = this.kb6_1.hashCode();
|
|
740
|
+
result = imul(result, 31) + this.lb6_1.hashCode() | 0;
|
|
741
|
+
result = imul(result, 31) + hashCode(this.mb6_1) | 0;
|
|
742
|
+
return result;
|
|
743
|
+
};
|
|
744
|
+
protoOf(BotModelConfig).equals = function (other) {
|
|
745
|
+
if (this === other)
|
|
746
|
+
return true;
|
|
747
|
+
if (!(other instanceof BotModelConfig))
|
|
748
|
+
return false;
|
|
749
|
+
if (!this.kb6_1.equals(other.kb6_1))
|
|
750
|
+
return false;
|
|
751
|
+
if (!this.lb6_1.equals(other.lb6_1))
|
|
752
|
+
return false;
|
|
753
|
+
if (!equals(this.mb6_1, other.mb6_1))
|
|
754
|
+
return false;
|
|
755
|
+
return true;
|
|
756
|
+
};
|
|
757
|
+
function BotModelRegistry() {
|
|
758
|
+
var tmp = this;
|
|
759
|
+
// Inline function 'kotlin.collections.mutableMapOf' call
|
|
760
|
+
tmp.nb6_1 = LinkedHashMap_init_$Create$();
|
|
761
|
+
}
|
|
762
|
+
protoOf(BotModelRegistry).ob6 = function (config) {
|
|
763
|
+
var tmp0 = this.nb6_1;
|
|
764
|
+
var tmp2 = new BotModelKey(config.kb6_1, config.lb6_1);
|
|
765
|
+
// Inline function 'kotlin.collections.set' call
|
|
766
|
+
var value = config.mb6_1;
|
|
767
|
+
tmp0.g3(tmp2, value);
|
|
768
|
+
};
|
|
769
|
+
protoOf(BotModelRegistry).pb6 = function (playersMode, rulesSetType) {
|
|
770
|
+
return this.nb6_1.v2(new BotModelKey(playersMode, rulesSetType));
|
|
771
|
+
};
|
|
772
|
+
protoOf(BotModelRegistry).qb6 = function () {
|
|
773
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
774
|
+
return !this.nb6_1.r();
|
|
775
|
+
};
|
|
776
|
+
function BotModelKey(playersMode, rulesSetType) {
|
|
777
|
+
this.rb6_1 = playersMode;
|
|
778
|
+
this.sb6_1 = rulesSetType;
|
|
779
|
+
}
|
|
780
|
+
protoOf(BotModelKey).toString = function () {
|
|
781
|
+
return 'BotModelKey(playersMode=' + this.rb6_1.toString() + ', rulesSetType=' + this.sb6_1.toString() + ')';
|
|
782
|
+
};
|
|
783
|
+
protoOf(BotModelKey).hashCode = function () {
|
|
784
|
+
var result = this.rb6_1.hashCode();
|
|
785
|
+
result = imul(result, 31) + this.sb6_1.hashCode() | 0;
|
|
786
|
+
return result;
|
|
787
|
+
};
|
|
788
|
+
protoOf(BotModelKey).equals = function (other) {
|
|
789
|
+
if (this === other)
|
|
790
|
+
return true;
|
|
791
|
+
if (!(other instanceof BotModelKey))
|
|
792
|
+
return false;
|
|
793
|
+
if (!this.rb6_1.equals(other.rb6_1))
|
|
794
|
+
return false;
|
|
795
|
+
if (!this.sb6_1.equals(other.sb6_1))
|
|
796
|
+
return false;
|
|
797
|
+
return true;
|
|
798
|
+
};
|
|
799
|
+
function mapToBotState($this, playerId, table) {
|
|
800
|
+
// Inline function 'kotlin.collections.map' call
|
|
801
|
+
var this_0 = table.players;
|
|
802
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
803
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
804
|
+
var _iterator__ex2g4s = this_0.t();
|
|
805
|
+
while (_iterator__ex2g4s.u()) {
|
|
806
|
+
var item = _iterator__ex2g4s.v();
|
|
807
|
+
var tmp$ret$0 = item.playerId;
|
|
808
|
+
destination.e1(tmp$ret$0);
|
|
809
|
+
}
|
|
810
|
+
var players = destination;
|
|
811
|
+
var focalIndex = players.o2(playerId);
|
|
812
|
+
var player = getPlayer(table.players, playerId);
|
|
813
|
+
var playersMode = table.config.playersMode;
|
|
814
|
+
var rules = table.config.rules;
|
|
815
|
+
// Inline function 'kotlin.collections.mutableMapOf' call
|
|
816
|
+
var playedCards = LinkedHashMap_init_$Create$();
|
|
817
|
+
var _iterator__ex2g4s_0 = players.t();
|
|
818
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
819
|
+
var p = _iterator__ex2g4s_0.v();
|
|
820
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
821
|
+
var tmp0 = table.bribes;
|
|
822
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
823
|
+
var destination_0 = ArrayList_init_$Create$();
|
|
824
|
+
var _iterator__ex2g4s_1 = tmp0.t();
|
|
825
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
826
|
+
var element = _iterator__ex2g4s_1.v();
|
|
827
|
+
// Inline function 'kotlin.collections.filter' call
|
|
828
|
+
var tmp0_0 = element.m90_1;
|
|
829
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
830
|
+
var destination_1 = ArrayList_init_$Create$();
|
|
831
|
+
var _iterator__ex2g4s_2 = tmp0_0.t();
|
|
832
|
+
while (_iterator__ex2g4s_2.u()) {
|
|
833
|
+
var element_0 = _iterator__ex2g4s_2.v();
|
|
834
|
+
if (element_0.g8i_1 === p) {
|
|
835
|
+
destination_1.e1(element_0);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
// Inline function 'kotlin.collections.map' call
|
|
839
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
840
|
+
var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_1, 10));
|
|
841
|
+
var _iterator__ex2g4s_3 = destination_1.t();
|
|
842
|
+
while (_iterator__ex2g4s_3.u()) {
|
|
843
|
+
var item_0 = _iterator__ex2g4s_3.v();
|
|
844
|
+
var tmp$ret$7 = item_0.i8i_1;
|
|
845
|
+
destination_2.e1(tmp$ret$7);
|
|
846
|
+
}
|
|
847
|
+
var list = destination_2;
|
|
848
|
+
addAll(destination_0, list);
|
|
849
|
+
}
|
|
850
|
+
// Inline function 'kotlin.collections.set' call
|
|
851
|
+
playedCards.g3(p, destination_0);
|
|
852
|
+
}
|
|
853
|
+
var ownRoundPoints;
|
|
854
|
+
var opponentRoundPoints;
|
|
855
|
+
if (playersMode.isTeamGame && players.g1() === 4) {
|
|
856
|
+
var partnerIndex = (focalIndex + 2 | 0) % 4 | 0;
|
|
857
|
+
ownRoundPoints = table.players.h1(focalIndex).y7x_1.p84_1 + table.players.h1(partnerIndex).y7x_1.p84_1 | 0;
|
|
858
|
+
opponentRoundPoints = table.players.h1((focalIndex + 1 | 0) % 4 | 0).y7x_1.p84_1 + table.players.h1((focalIndex + 3 | 0) % 4 | 0).y7x_1.p84_1 | 0;
|
|
859
|
+
} else {
|
|
860
|
+
ownRoundPoints = table.players.h1(focalIndex).y7x_1.p84_1;
|
|
861
|
+
// Inline function 'kotlin.collections.filter' call
|
|
862
|
+
var tmp0_1 = table.players;
|
|
863
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
864
|
+
var destination_3 = ArrayList_init_$Create$();
|
|
865
|
+
var _iterator__ex2g4s_4 = tmp0_1.t();
|
|
866
|
+
while (_iterator__ex2g4s_4.u()) {
|
|
867
|
+
var element_1 = _iterator__ex2g4s_4.v();
|
|
868
|
+
if (!(element_1.playerId === playerId)) {
|
|
869
|
+
destination_3.e1(element_1);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
// Inline function 'kotlin.collections.sumOf' call
|
|
873
|
+
var sum = 0;
|
|
874
|
+
var _iterator__ex2g4s_5 = destination_3.t();
|
|
875
|
+
while (_iterator__ex2g4s_5.u()) {
|
|
876
|
+
var element_2 = _iterator__ex2g4s_5.v();
|
|
877
|
+
var tmp = sum;
|
|
878
|
+
sum = tmp + element_2.y7x_1.p84_1 | 0;
|
|
879
|
+
}
|
|
880
|
+
opponentRoundPoints = sum;
|
|
881
|
+
}
|
|
882
|
+
var cardsOnTable = table.cardsOnTable;
|
|
883
|
+
var trickNumber = table.bribes.g1();
|
|
884
|
+
var positionInTrick = cardsOnTable.g1();
|
|
885
|
+
var tmp0_2 = table.players;
|
|
886
|
+
var tmp$ret$20;
|
|
887
|
+
$l$block: {
|
|
888
|
+
// Inline function 'kotlin.collections.firstOrNull' call
|
|
889
|
+
var _iterator__ex2g4s_6 = tmp0_2.t();
|
|
890
|
+
while (_iterator__ex2g4s_6.u()) {
|
|
891
|
+
var element_3 = _iterator__ex2g4s_6.v();
|
|
892
|
+
if (element_3.w7x_1.n83_1) {
|
|
893
|
+
tmp$ret$20 = element_3;
|
|
894
|
+
break $l$block;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
tmp$ret$20 = null;
|
|
898
|
+
}
|
|
899
|
+
var tmp0_safe_receiver = tmp$ret$20;
|
|
900
|
+
var trumpDeclarerId = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.playerId;
|
|
901
|
+
// Inline function 'kotlin.collections.mutableMapOf' call
|
|
902
|
+
var declaredCombinations = LinkedHashMap_init_$Create$();
|
|
903
|
+
var _iterator__ex2g4s_7 = table.players.t();
|
|
904
|
+
while (_iterator__ex2g4s_7.u()) {
|
|
905
|
+
var p_0 = _iterator__ex2g4s_7.v();
|
|
906
|
+
// Inline function 'kotlin.collections.filter' call
|
|
907
|
+
var tmp0_3 = p_0.y7x_1.q84_1;
|
|
908
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
909
|
+
var destination_4 = ArrayList_init_$Create$();
|
|
910
|
+
var _iterator__ex2g4s_8 = tmp0_3.t();
|
|
911
|
+
while (_iterator__ex2g4s_8.u()) {
|
|
912
|
+
var element_4 = _iterator__ex2g4s_8.v();
|
|
913
|
+
if (element_4.c89_1.equals(CombinationState_ACCEPTED_getInstance())) {
|
|
914
|
+
destination_4.e1(element_4);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
// Inline function 'kotlin.collections.map' call
|
|
918
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
919
|
+
var destination_5 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_4, 10));
|
|
920
|
+
var _iterator__ex2g4s_9 = destination_4.t();
|
|
921
|
+
while (_iterator__ex2g4s_9.u()) {
|
|
922
|
+
var item_1 = _iterator__ex2g4s_9.v();
|
|
923
|
+
var tmp$ret$25 = item_1.b89_1;
|
|
924
|
+
destination_5.e1(tmp$ret$25);
|
|
925
|
+
}
|
|
926
|
+
var combos = destination_5;
|
|
927
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
928
|
+
if (!combos.r()) {
|
|
929
|
+
// Inline function 'kotlin.collections.set' call
|
|
930
|
+
var key = p_0.playerId;
|
|
931
|
+
declaredCombinations.g3(key, combos);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
var tmp_0;
|
|
935
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
936
|
+
if (!table.bribes.r()) {
|
|
937
|
+
var focalPlayer = table.players.h1(focalIndex);
|
|
938
|
+
var tmp_1;
|
|
939
|
+
if (focalPlayer.w7x_1.l83_1) {
|
|
940
|
+
tmp_1 = true;
|
|
941
|
+
} else if (playersMode.isTeamGame && players.g1() === 4) {
|
|
942
|
+
var partnerIndex_0 = (focalIndex + 2 | 0) % 4 | 0;
|
|
943
|
+
tmp_1 = table.players.h1(partnerIndex_0).w7x_1.l83_1;
|
|
944
|
+
} else {
|
|
945
|
+
tmp_1 = false;
|
|
946
|
+
}
|
|
947
|
+
tmp_0 = tmp_1;
|
|
948
|
+
} else {
|
|
949
|
+
tmp_0 = false;
|
|
950
|
+
}
|
|
951
|
+
var ownTeamWonLastTrick = tmp_0;
|
|
952
|
+
var tmp_2 = table.currentTrump;
|
|
953
|
+
var tmp1_safe_receiver = table.cardDeck;
|
|
954
|
+
return new BotGameState(playerId, players, player.v7x_1, playedCards, cardsOnTable, tmp_2, tmp1_safe_receiver == null ? null : tmp1_safe_receiver.p90_1, trumpDeclarerId === playerId, emptyList(), 0, 0, ownRoundPoints, opponentRoundPoints, trickNumber, positionInTrick, ownTeamWonLastTrick, declaredCombinations, rules, playersMode, rules.dealerFinalCardsCount);
|
|
955
|
+
}
|
|
956
|
+
function computeLegalActions($this, playerId, table) {
|
|
957
|
+
var sceneId = table.sceneInfo.a9e_1;
|
|
958
|
+
var actId = table.sceneInfo.c9e_1;
|
|
959
|
+
var tmp;
|
|
960
|
+
if (actId === 'COMBINATION') {
|
|
961
|
+
tmp = listOf([new AcceptCombinations(true), new AcceptCombinations(false)]);
|
|
962
|
+
} else if (get_isTradeScene(sceneId) && actId === 'PLAYER_TURN') {
|
|
963
|
+
// Inline function 'kotlin.collections.map' call
|
|
964
|
+
var this_0 = get_entries();
|
|
965
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
966
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
967
|
+
var _iterator__ex2g4s = this_0.t();
|
|
968
|
+
while (_iterator__ex2g4s.u()) {
|
|
969
|
+
var item = _iterator__ex2g4s.v();
|
|
970
|
+
var tmp$ret$0 = new SelectSuit(item);
|
|
971
|
+
destination.e1(tmp$ret$0);
|
|
972
|
+
}
|
|
973
|
+
var suits = destination;
|
|
974
|
+
tmp = plus(suits, new SelectSuit(null));
|
|
975
|
+
} else if (get_isEarnPointScene(sceneId) && actId === 'PLAYER_TURN') {
|
|
976
|
+
var player = getPlayer(table.players, playerId);
|
|
977
|
+
// Inline function 'kotlin.collections.map' call
|
|
978
|
+
var this_1 = player.v7x_1;
|
|
979
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
980
|
+
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
|
|
981
|
+
var _iterator__ex2g4s_0 = this_1.t();
|
|
982
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
983
|
+
var item_0 = _iterator__ex2g4s_0.v();
|
|
984
|
+
var tmp$ret$3 = new PlayCard(item_0);
|
|
985
|
+
destination_0.e1(tmp$ret$3);
|
|
986
|
+
}
|
|
987
|
+
tmp = destination_0;
|
|
988
|
+
} else {
|
|
989
|
+
tmp = emptyList();
|
|
990
|
+
}
|
|
991
|
+
return tmp;
|
|
992
|
+
}
|
|
993
|
+
function mapToClientAction($this, action, playerId, table) {
|
|
994
|
+
var tmp;
|
|
995
|
+
if (action instanceof SelectSuit) {
|
|
996
|
+
var tmp4_suit = action.mb4_1;
|
|
997
|
+
var tmp1_$this = $this.vb6_1;
|
|
998
|
+
var tmp2_player = getPlayer(table.players, playerId);
|
|
999
|
+
var tmp3_round = table.gameInfo.round;
|
|
1000
|
+
var tmp5_tag = tmp1_$this.ja8(tmp3_round, tmp2_player);
|
|
1001
|
+
tmp = new SuitChoiceFromClientAction(playerId, true, tmp5_tag, tmp4_suit);
|
|
1002
|
+
} else {
|
|
1003
|
+
if (action instanceof PlayCard) {
|
|
1004
|
+
var tmp7_card = action.kb4_1;
|
|
1005
|
+
var tmp6_safe_receiver = action.lb4_1;
|
|
1006
|
+
var tmp_0;
|
|
1007
|
+
if (tmp6_safe_receiver == null) {
|
|
1008
|
+
tmp_0 = null;
|
|
1009
|
+
} else {
|
|
1010
|
+
// Inline function 'kotlin.collections.map' call
|
|
1011
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1012
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp6_safe_receiver, 10));
|
|
1013
|
+
var _iterator__ex2g4s = tmp6_safe_receiver.t();
|
|
1014
|
+
while (_iterator__ex2g4s.u()) {
|
|
1015
|
+
var item = _iterator__ex2g4s.v();
|
|
1016
|
+
var tmp$ret$0 = new Combination(item.z_1, item, null, emptySet());
|
|
1017
|
+
destination.e1(tmp$ret$0);
|
|
1018
|
+
}
|
|
1019
|
+
tmp_0 = destination;
|
|
1020
|
+
}
|
|
1021
|
+
var tmp8_combinations = tmp_0;
|
|
1022
|
+
var tmp9_tag = $this.vb6_1.ka8(table.gameInfo.round, VOID, table.cardsOnTable.g1());
|
|
1023
|
+
tmp = new CardFromClientAction(playerId, true, tmp9_tag, tmp7_card, tmp8_combinations);
|
|
1024
|
+
} else {
|
|
1025
|
+
if (action instanceof AcceptCombinations) {
|
|
1026
|
+
var tmp13_isAccepted = action.nb4_1;
|
|
1027
|
+
var tmp10_$this = $this.vb6_1;
|
|
1028
|
+
var tmp11_round = table.gameInfo.round;
|
|
1029
|
+
var tmp12_sceneInfo = table.sceneInfo;
|
|
1030
|
+
var tmp14_tag = tmp10_$this.ia8(tmp12_sceneInfo, tmp11_round);
|
|
1031
|
+
tmp = new CombinationChoiceFromClientAction(playerId, true, tmp14_tag, tmp13_isAccepted);
|
|
1032
|
+
} else {
|
|
1033
|
+
noWhenBranchMatchedException();
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
return tmp;
|
|
1038
|
+
}
|
|
1039
|
+
function handleWaitingAct($this, playerId, table) {
|
|
1040
|
+
if (!(table.sceneInfo.c9e_1 === 'WAITING_ACT'))
|
|
1041
|
+
return null;
|
|
1042
|
+
var tmp0 = table.sceneInfo.e9e_1;
|
|
1043
|
+
var tmp$ret$0;
|
|
1044
|
+
$l$block: {
|
|
1045
|
+
// Inline function 'games.jass.logic.data.models.scenes.requireActData' call
|
|
1046
|
+
if (tmp0 instanceof WaitingActData) {
|
|
1047
|
+
tmp$ret$0 = tmp0;
|
|
1048
|
+
break $l$block;
|
|
1049
|
+
}
|
|
1050
|
+
throw new MechanicException('Required ' + getKClass(WaitingActData).o() + ', current act is ' + toString(tmp0));
|
|
1051
|
+
}
|
|
1052
|
+
var waitingActData = tmp$ret$0;
|
|
1053
|
+
var tmp0_elvis_lhs = waitingActData.k8j_1;
|
|
1054
|
+
var tmp;
|
|
1055
|
+
if (tmp0_elvis_lhs == null) {
|
|
1056
|
+
return null;
|
|
1057
|
+
} else {
|
|
1058
|
+
tmp = tmp0_elvis_lhs;
|
|
1059
|
+
}
|
|
1060
|
+
var requestPayload = tmp;
|
|
1061
|
+
var tmp_0;
|
|
1062
|
+
if (requestPayload instanceof CardDeckRequest) {
|
|
1063
|
+
// Inline function 'kotlin.collections.List' call
|
|
1064
|
+
// Inline function 'kotlin.collections.MutableList' call
|
|
1065
|
+
var size = requestPayload.i8j_1;
|
|
1066
|
+
var list = ArrayList_init_$Create$_0(size);
|
|
1067
|
+
// Inline function 'kotlin.repeat' call
|
|
1068
|
+
var inductionVariable = 0;
|
|
1069
|
+
if (inductionVariable < size)
|
|
1070
|
+
do {
|
|
1071
|
+
var index = inductionVariable;
|
|
1072
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
1073
|
+
var tmp$ret$1 = Companion_instance.l94($this.ub6_1.da8());
|
|
1074
|
+
list.e1(tmp$ret$1);
|
|
1075
|
+
}
|
|
1076
|
+
while (inductionVariable < size);
|
|
1077
|
+
var tmp3_tag = $this.vb6_1.fa8(table.sceneInfo.a9e_1, table.gameInfo.round);
|
|
1078
|
+
tmp_0 = new RequestedCardDecksFromClientAction(list, playerId, true, tmp3_tag);
|
|
1079
|
+
} else {
|
|
1080
|
+
noWhenBranchMatchedException();
|
|
1081
|
+
}
|
|
1082
|
+
return tmp_0;
|
|
1083
|
+
}
|
|
1084
|
+
function handleChoosePartner($this, playerId, table) {
|
|
1085
|
+
var tmp0 = table.players;
|
|
1086
|
+
var tmp$ret$1;
|
|
1087
|
+
$l$block: {
|
|
1088
|
+
// Inline function 'kotlin.collections.indexOfFirst' call
|
|
1089
|
+
var index = 0;
|
|
1090
|
+
var _iterator__ex2g4s = tmp0.t();
|
|
1091
|
+
while (_iterator__ex2g4s.u()) {
|
|
1092
|
+
var item = _iterator__ex2g4s.v();
|
|
1093
|
+
if (item.playerId === playerId) {
|
|
1094
|
+
tmp$ret$1 = index;
|
|
1095
|
+
break $l$block;
|
|
1096
|
+
}
|
|
1097
|
+
index = index + 1 | 0;
|
|
1098
|
+
}
|
|
1099
|
+
tmp$ret$1 = -1;
|
|
1100
|
+
}
|
|
1101
|
+
var playerIndex = tmp$ret$1;
|
|
1102
|
+
var partnerIndex = (playerIndex + 2 | 0) % table.players.g1() | 0;
|
|
1103
|
+
var partnerId = table.players.h1(partnerIndex).playerId;
|
|
1104
|
+
var tmp0_tag = $this.vb6_1.ga8(table.gameInfo.round);
|
|
1105
|
+
return new PartnerSelectedFromClientAction(playerId, true, tmp0_tag, partnerId);
|
|
1106
|
+
}
|
|
1107
|
+
function handleCalcPoints($this, playerId, table) {
|
|
1108
|
+
if ($this.wb6_1 === table.gameInfo.gameNumber) {
|
|
1109
|
+
var tmp0 = table.sceneInfo.d9e_1;
|
|
1110
|
+
var tmp$ret$0;
|
|
1111
|
+
$l$block: {
|
|
1112
|
+
// Inline function 'games.jass.logic.data.models.scenes.requireSceneData' call
|
|
1113
|
+
if (tmp0 instanceof CalcPointsSceneData) {
|
|
1114
|
+
tmp$ret$0 = tmp0;
|
|
1115
|
+
break $l$block;
|
|
1116
|
+
}
|
|
1117
|
+
throw new MechanicException('Required ' + getKClass(CalcPointsSceneData).o() + ', current scene is ' + toString(tmp0));
|
|
1118
|
+
}
|
|
1119
|
+
var sceneData = tmp$ret$0;
|
|
1120
|
+
// Inline function 'kotlin.collections.orEmpty' call
|
|
1121
|
+
var tmp0_elvis_lhs = sceneData.f8k_1;
|
|
1122
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1123
|
+
if (!(tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs).r()) {
|
|
1124
|
+
return new ExitFromClientAction(playerId, true);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
return new PlayerReadyFromClientAction(playerId, true, $this.vb6_1.ha8(table.gameInfo.round));
|
|
1128
|
+
}
|
|
1129
|
+
function BotPolicyAnswerProvider(policies, dealerInteractor, tagProvider, exitAfterGameNumber) {
|
|
1130
|
+
exitAfterGameNumber = exitAfterGameNumber === VOID ? null : exitAfterGameNumber;
|
|
1131
|
+
this.tb6_1 = policies;
|
|
1132
|
+
this.ub6_1 = dealerInteractor;
|
|
1133
|
+
this.vb6_1 = tagProvider;
|
|
1134
|
+
this.wb6_1 = exitAfterGameNumber;
|
|
1135
|
+
}
|
|
1136
|
+
protoOf(BotPolicyAnswerProvider).lap = function (playerId, table) {
|
|
1137
|
+
var waitingAction = handleWaitingAct(this, playerId, table);
|
|
1138
|
+
if (!(waitingAction == null))
|
|
1139
|
+
return waitingAction;
|
|
1140
|
+
if (get_isCalcPointScene(table.sceneInfo.a9e_1)) {
|
|
1141
|
+
return handleCalcPoints(this, playerId, table);
|
|
1142
|
+
}
|
|
1143
|
+
if (get_isChoosePartnerScene(table.sceneInfo.a9e_1)) {
|
|
1144
|
+
return handleChoosePartner(this, playerId, table);
|
|
1145
|
+
}
|
|
1146
|
+
var tmp0 = table.players;
|
|
1147
|
+
var tmp$ret$1;
|
|
1148
|
+
$l$block: {
|
|
1149
|
+
// Inline function 'kotlin.collections.indexOfFirst' call
|
|
1150
|
+
var index = 0;
|
|
1151
|
+
var _iterator__ex2g4s = tmp0.t();
|
|
1152
|
+
while (_iterator__ex2g4s.u()) {
|
|
1153
|
+
var item = _iterator__ex2g4s.v();
|
|
1154
|
+
if (item.playerId === playerId) {
|
|
1155
|
+
tmp$ret$1 = index;
|
|
1156
|
+
break $l$block;
|
|
1157
|
+
}
|
|
1158
|
+
index = index + 1 | 0;
|
|
1159
|
+
}
|
|
1160
|
+
tmp$ret$1 = -1;
|
|
1161
|
+
}
|
|
1162
|
+
var seatIndex = tmp$ret$1;
|
|
1163
|
+
var policy = this.tb6_1[seatIndex % this.tb6_1.length | 0];
|
|
1164
|
+
var state = mapToBotState(this, playerId, table);
|
|
1165
|
+
var legalActions = computeLegalActions(this, playerId, table);
|
|
1166
|
+
var chosen = policy.xb6(state, legalActions);
|
|
1167
|
+
return mapToClientAction(this, chosen, playerId, table);
|
|
1168
|
+
};
|
|
1169
|
+
function getOrCreatePolicy($this, playersMode, rulesSetType) {
|
|
1170
|
+
var cacheKey = rulesSetType.value + '_' + playersMode.z_1;
|
|
1171
|
+
// Inline function 'kotlin.collections.getOrPut' call
|
|
1172
|
+
var this_0 = $this.cb7_1;
|
|
1173
|
+
var value = this_0.v2(cacheKey);
|
|
1174
|
+
var tmp;
|
|
1175
|
+
if (value == null) {
|
|
1176
|
+
var tmp$ret$0;
|
|
1177
|
+
$l$block: {
|
|
1178
|
+
var modelBytes = $this.yb6_1.pb6(playersMode, rulesSetType);
|
|
1179
|
+
if (modelBytes == null) {
|
|
1180
|
+
$this.bb7_1.w('PimcBotAnswerProvider', 'No PIMC model for rulesSet=' + rulesSetType.value + ', ' + ('mode=' + playersMode.z_1 + '. Falling back to FirstLegalActionPolicy.'));
|
|
1181
|
+
tmp$ret$0 = new FirstLegalActionPolicy();
|
|
1182
|
+
break $l$block;
|
|
1183
|
+
}
|
|
1184
|
+
$this.bb7_1.d('PimcBotAnswerProvider', 'PIMC model loaded for rulesSet=' + rulesSetType.value + ', mode=' + playersMode.z_1);
|
|
1185
|
+
tmp$ret$0 = createPimcPolicy($this, modelBytes, playersMode);
|
|
1186
|
+
}
|
|
1187
|
+
var answer = tmp$ret$0;
|
|
1188
|
+
this_0.g3(cacheKey, answer);
|
|
1189
|
+
tmp = answer;
|
|
1190
|
+
} else {
|
|
1191
|
+
tmp = value;
|
|
1192
|
+
}
|
|
1193
|
+
return tmp;
|
|
1194
|
+
}
|
|
1195
|
+
function createPimcPolicy($this, modelBytes, playersMode) {
|
|
1196
|
+
var inferenceEngine = new PureKotlinInferenceEngine();
|
|
1197
|
+
var encoder = new BeliefFeatureEncoder(playersMode);
|
|
1198
|
+
var beliefNetwork = new CardBeliefNetwork(inferenceEngine, encoder, playersMode);
|
|
1199
|
+
beliefNetwork.db6(modelBytes);
|
|
1200
|
+
var rolloutPolicy = new RolloutPolicy();
|
|
1201
|
+
var pimcEngine = new PimcEngine(beliefNetwork, rolloutPolicy, new PimcConfig());
|
|
1202
|
+
return PimcBotPolicy_init_$Create$(pimcEngine);
|
|
1203
|
+
}
|
|
1204
|
+
function Companion_0() {
|
|
1205
|
+
this.db7_1 = 'PimcBotAnswerProvider';
|
|
1206
|
+
}
|
|
1207
|
+
var Companion_instance_2;
|
|
1208
|
+
function Companion_getInstance_0() {
|
|
1209
|
+
return Companion_instance_2;
|
|
1210
|
+
}
|
|
1211
|
+
function PimcBotAnswerProvider(registry, dealerInteractor, tagProvider, logger) {
|
|
1212
|
+
this.yb6_1 = registry;
|
|
1213
|
+
this.zb6_1 = dealerInteractor;
|
|
1214
|
+
this.ab7_1 = tagProvider;
|
|
1215
|
+
this.bb7_1 = logger;
|
|
1216
|
+
var tmp = this;
|
|
1217
|
+
// Inline function 'kotlin.collections.mutableMapOf' call
|
|
1218
|
+
tmp.cb7_1 = LinkedHashMap_init_$Create$();
|
|
1219
|
+
}
|
|
1220
|
+
protoOf(PimcBotAnswerProvider).lap = function (playerId, table) {
|
|
1221
|
+
var playersMode = table.config.playersMode;
|
|
1222
|
+
var rulesSetType = table.config.rulesSetType;
|
|
1223
|
+
var policy = getOrCreatePolicy(this, playersMode, rulesSetType);
|
|
1224
|
+
var playerCount = playersMode.count;
|
|
1225
|
+
var tmp = 0;
|
|
1226
|
+
// Inline function 'kotlin.arrayOfNulls' call
|
|
1227
|
+
var tmp_0 = Array(playerCount);
|
|
1228
|
+
while (tmp < playerCount) {
|
|
1229
|
+
tmp_0[tmp] = policy;
|
|
1230
|
+
tmp = tmp + 1 | 0;
|
|
1231
|
+
}
|
|
1232
|
+
var policies = tmp_0;
|
|
1233
|
+
var provider = new BotPolicyAnswerProvider(policies, this.zb6_1, this.ab7_1);
|
|
1234
|
+
return provider.lap(playerId, table);
|
|
1235
|
+
};
|
|
1236
|
+
var Activation_RELU_instance;
|
|
1237
|
+
var Activation_NONE_instance;
|
|
1238
|
+
var Activation_entriesInitialized;
|
|
1239
|
+
function Activation_initEntries() {
|
|
1240
|
+
if (Activation_entriesInitialized)
|
|
1241
|
+
return Unit_instance;
|
|
1242
|
+
Activation_entriesInitialized = true;
|
|
1243
|
+
Activation_RELU_instance = new Activation('RELU', 0);
|
|
1244
|
+
Activation_NONE_instance = new Activation('NONE', 1);
|
|
1245
|
+
}
|
|
1246
|
+
function forward($this, layer, input) {
|
|
1247
|
+
var out = new Float32Array(layer.fb7_1);
|
|
1248
|
+
var inductionVariable = 0;
|
|
1249
|
+
var last = layer.fb7_1;
|
|
1250
|
+
if (inductionVariable < last)
|
|
1251
|
+
do {
|
|
1252
|
+
var j = inductionVariable;
|
|
1253
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
1254
|
+
var sum = layer.hb7_1[j];
|
|
1255
|
+
var inductionVariable_0 = 0;
|
|
1256
|
+
var last_0 = layer.eb7_1;
|
|
1257
|
+
if (inductionVariable_0 < last_0)
|
|
1258
|
+
do {
|
|
1259
|
+
var i = inductionVariable_0;
|
|
1260
|
+
inductionVariable_0 = inductionVariable_0 + 1 | 0;
|
|
1261
|
+
sum = sum + input[i] * layer.gb7_1[imul(i, layer.fb7_1) + j | 0];
|
|
1262
|
+
}
|
|
1263
|
+
while (inductionVariable_0 < last_0);
|
|
1264
|
+
out[j] = sum;
|
|
1265
|
+
}
|
|
1266
|
+
while (inductionVariable < last);
|
|
1267
|
+
var bn = layer.ib7_1;
|
|
1268
|
+
if (!(bn == null)) {
|
|
1269
|
+
var inductionVariable_1 = 0;
|
|
1270
|
+
var last_1 = layer.fb7_1;
|
|
1271
|
+
if (inductionVariable_1 < last_1)
|
|
1272
|
+
do {
|
|
1273
|
+
var j_0 = inductionVariable_1;
|
|
1274
|
+
inductionVariable_1 = inductionVariable_1 + 1 | 0;
|
|
1275
|
+
var normalized = (out[j_0] - bn.mb7_1[j_0]) / sqrt(bn.nb7_1[j_0] + 1.0E-5);
|
|
1276
|
+
out[j_0] = bn.kb7_1[j_0] * normalized + bn.lb7_1[j_0];
|
|
1277
|
+
}
|
|
1278
|
+
while (inductionVariable_1 < last_1);
|
|
1279
|
+
}
|
|
1280
|
+
switch (layer.jb7_1.a1_1) {
|
|
1281
|
+
case 0:
|
|
1282
|
+
var inductionVariable_2 = 0;
|
|
1283
|
+
var last_2 = layer.fb7_1;
|
|
1284
|
+
if (inductionVariable_2 < last_2)
|
|
1285
|
+
do {
|
|
1286
|
+
var j_1 = inductionVariable_2;
|
|
1287
|
+
inductionVariable_2 = inductionVariable_2 + 1 | 0;
|
|
1288
|
+
if (out[j_1] < 0.0) {
|
|
1289
|
+
out[j_1] = 0.0;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
while (inductionVariable_2 < last_2);
|
|
1293
|
+
break;
|
|
1294
|
+
case 1:
|
|
1295
|
+
break;
|
|
1296
|
+
default:
|
|
1297
|
+
noWhenBranchMatchedException();
|
|
1298
|
+
break;
|
|
1299
|
+
}
|
|
1300
|
+
return out;
|
|
1301
|
+
}
|
|
1302
|
+
function Layer(inDim, outDim, weight, bias, batchNorm, activation) {
|
|
1303
|
+
this.eb7_1 = inDim;
|
|
1304
|
+
this.fb7_1 = outDim;
|
|
1305
|
+
this.gb7_1 = weight;
|
|
1306
|
+
this.hb7_1 = bias;
|
|
1307
|
+
this.ib7_1 = batchNorm;
|
|
1308
|
+
this.jb7_1 = activation;
|
|
1309
|
+
}
|
|
1310
|
+
protoOf(Layer).toString = function () {
|
|
1311
|
+
return 'Layer(inDim=' + this.eb7_1 + ', outDim=' + this.fb7_1 + ', weight=' + toString_0(this.gb7_1) + ', bias=' + toString_0(this.hb7_1) + ', batchNorm=' + toString(this.ib7_1) + ', activation=' + this.jb7_1.toString() + ')';
|
|
1312
|
+
};
|
|
1313
|
+
protoOf(Layer).hashCode = function () {
|
|
1314
|
+
var result = this.eb7_1;
|
|
1315
|
+
result = imul(result, 31) + this.fb7_1 | 0;
|
|
1316
|
+
result = imul(result, 31) + hashCode(this.gb7_1) | 0;
|
|
1317
|
+
result = imul(result, 31) + hashCode(this.hb7_1) | 0;
|
|
1318
|
+
result = imul(result, 31) + (this.ib7_1 == null ? 0 : this.ib7_1.hashCode()) | 0;
|
|
1319
|
+
result = imul(result, 31) + this.jb7_1.hashCode() | 0;
|
|
1320
|
+
return result;
|
|
1321
|
+
};
|
|
1322
|
+
protoOf(Layer).equals = function (other) {
|
|
1323
|
+
if (this === other)
|
|
1324
|
+
return true;
|
|
1325
|
+
if (!(other instanceof Layer))
|
|
1326
|
+
return false;
|
|
1327
|
+
if (!(this.eb7_1 === other.eb7_1))
|
|
1328
|
+
return false;
|
|
1329
|
+
if (!(this.fb7_1 === other.fb7_1))
|
|
1330
|
+
return false;
|
|
1331
|
+
if (!equals(this.gb7_1, other.gb7_1))
|
|
1332
|
+
return false;
|
|
1333
|
+
if (!equals(this.hb7_1, other.hb7_1))
|
|
1334
|
+
return false;
|
|
1335
|
+
if (!equals(this.ib7_1, other.ib7_1))
|
|
1336
|
+
return false;
|
|
1337
|
+
if (!this.jb7_1.equals(other.jb7_1))
|
|
1338
|
+
return false;
|
|
1339
|
+
return true;
|
|
1340
|
+
};
|
|
1341
|
+
function BatchNormParams(gamma, beta, runningMean, runningVar) {
|
|
1342
|
+
this.kb7_1 = gamma;
|
|
1343
|
+
this.lb7_1 = beta;
|
|
1344
|
+
this.mb7_1 = runningMean;
|
|
1345
|
+
this.nb7_1 = runningVar;
|
|
1346
|
+
}
|
|
1347
|
+
protoOf(BatchNormParams).toString = function () {
|
|
1348
|
+
return 'BatchNormParams(gamma=' + toString_0(this.kb7_1) + ', beta=' + toString_0(this.lb7_1) + ', runningMean=' + toString_0(this.mb7_1) + ', runningVar=' + toString_0(this.nb7_1) + ')';
|
|
1349
|
+
};
|
|
1350
|
+
protoOf(BatchNormParams).hashCode = function () {
|
|
1351
|
+
var result = hashCode(this.kb7_1);
|
|
1352
|
+
result = imul(result, 31) + hashCode(this.lb7_1) | 0;
|
|
1353
|
+
result = imul(result, 31) + hashCode(this.mb7_1) | 0;
|
|
1354
|
+
result = imul(result, 31) + hashCode(this.nb7_1) | 0;
|
|
1355
|
+
return result;
|
|
1356
|
+
};
|
|
1357
|
+
protoOf(BatchNormParams).equals = function (other) {
|
|
1358
|
+
if (this === other)
|
|
1359
|
+
return true;
|
|
1360
|
+
if (!(other instanceof BatchNormParams))
|
|
1361
|
+
return false;
|
|
1362
|
+
if (!equals(this.kb7_1, other.kb7_1))
|
|
1363
|
+
return false;
|
|
1364
|
+
if (!equals(this.lb7_1, other.lb7_1))
|
|
1365
|
+
return false;
|
|
1366
|
+
if (!equals(this.mb7_1, other.mb7_1))
|
|
1367
|
+
return false;
|
|
1368
|
+
if (!equals(this.nb7_1, other.nb7_1))
|
|
1369
|
+
return false;
|
|
1370
|
+
return true;
|
|
1371
|
+
};
|
|
1372
|
+
function Activation(name, ordinal) {
|
|
1373
|
+
Enum.call(this, name, ordinal);
|
|
1374
|
+
}
|
|
1375
|
+
function Companion_1() {
|
|
1376
|
+
this.gb6_1 = 1.0E-5;
|
|
1377
|
+
}
|
|
1378
|
+
protoOf(Companion_1).hb6 = function (logits) {
|
|
1379
|
+
var max_0 = max(logits);
|
|
1380
|
+
var tmp = 0;
|
|
1381
|
+
var tmp_0 = logits.length;
|
|
1382
|
+
var tmp_1 = new Float32Array(tmp_0);
|
|
1383
|
+
while (tmp < tmp_0) {
|
|
1384
|
+
var tmp_2 = tmp;
|
|
1385
|
+
// Inline function 'kotlin.math.exp' call
|
|
1386
|
+
var x = logits[tmp_2] - max_0;
|
|
1387
|
+
tmp_1[tmp_2] = Math.exp(x);
|
|
1388
|
+
tmp = tmp + 1 | 0;
|
|
1389
|
+
}
|
|
1390
|
+
var exps = tmp_1;
|
|
1391
|
+
var sum_0 = sum(exps);
|
|
1392
|
+
if (sum_0 > 0.0) {
|
|
1393
|
+
var inductionVariable = 0;
|
|
1394
|
+
var last = exps.length - 1 | 0;
|
|
1395
|
+
if (inductionVariable <= last)
|
|
1396
|
+
do {
|
|
1397
|
+
var i = inductionVariable;
|
|
1398
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
1399
|
+
exps[i] = exps[i] / sum_0;
|
|
1400
|
+
}
|
|
1401
|
+
while (inductionVariable <= last);
|
|
1402
|
+
}
|
|
1403
|
+
return exps;
|
|
1404
|
+
};
|
|
1405
|
+
var Companion_instance_3;
|
|
1406
|
+
function Companion_getInstance_1() {
|
|
1407
|
+
return Companion_instance_3;
|
|
1408
|
+
}
|
|
1409
|
+
function Activation_RELU_getInstance() {
|
|
1410
|
+
Activation_initEntries();
|
|
1411
|
+
return Activation_RELU_instance;
|
|
1412
|
+
}
|
|
1413
|
+
function Activation_NONE_getInstance() {
|
|
1414
|
+
Activation_initEntries();
|
|
1415
|
+
return Activation_NONE_instance;
|
|
1416
|
+
}
|
|
1417
|
+
function PureKotlinInferenceEngine() {
|
|
1418
|
+
this.ob7_1 = emptyList();
|
|
1419
|
+
}
|
|
1420
|
+
protoOf(PureKotlinInferenceEngine).db6 = function (modelBytes) {
|
|
1421
|
+
var buf = new ByteArrayReader(modelBytes);
|
|
1422
|
+
var layerCount = buf.rb7();
|
|
1423
|
+
var tmp = 0;
|
|
1424
|
+
var tmp_0 = layerCount + 1 | 0;
|
|
1425
|
+
var tmp_1 = new Int32Array(tmp_0);
|
|
1426
|
+
while (tmp < tmp_0) {
|
|
1427
|
+
tmp_1[tmp] = buf.rb7();
|
|
1428
|
+
tmp = tmp + 1 | 0;
|
|
1429
|
+
}
|
|
1430
|
+
var sizes = tmp_1;
|
|
1431
|
+
// Inline function 'kotlin.collections.mutableListOf' call
|
|
1432
|
+
var parsed = ArrayList_init_$Create$();
|
|
1433
|
+
var inductionVariable = 0;
|
|
1434
|
+
if (inductionVariable < layerCount)
|
|
1435
|
+
do {
|
|
1436
|
+
var i = inductionVariable;
|
|
1437
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
1438
|
+
var inDim = sizes[i];
|
|
1439
|
+
var outDim = sizes[i + 1 | 0];
|
|
1440
|
+
var isHidden = i < (layerCount - 1 | 0);
|
|
1441
|
+
var weight = buf.sb7(imul(inDim, outDim));
|
|
1442
|
+
var bias = buf.sb7(outDim);
|
|
1443
|
+
var tmp_2;
|
|
1444
|
+
if (isHidden) {
|
|
1445
|
+
tmp_2 = new BatchNormParams(buf.sb7(outDim), buf.sb7(outDim), buf.sb7(outDim), buf.sb7(outDim));
|
|
1446
|
+
} else {
|
|
1447
|
+
tmp_2 = null;
|
|
1448
|
+
}
|
|
1449
|
+
var bn = tmp_2;
|
|
1450
|
+
// Inline function 'kotlin.collections.plusAssign' call
|
|
1451
|
+
var element = new Layer(inDim, outDim, weight, bias, bn, isHidden ? Activation_RELU_getInstance() : Activation_NONE_getInstance());
|
|
1452
|
+
parsed.e1(element);
|
|
1453
|
+
}
|
|
1454
|
+
while (inductionVariable < layerCount);
|
|
1455
|
+
this.ob7_1 = parsed;
|
|
1456
|
+
};
|
|
1457
|
+
protoOf(PureKotlinInferenceEngine).fb6 = function (input) {
|
|
1458
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1459
|
+
// Inline function 'kotlin.check' call
|
|
1460
|
+
if (!!this.ob7_1.r()) {
|
|
1461
|
+
var message = 'Model not loaded. Call loadModel() first.';
|
|
1462
|
+
throw IllegalStateException_init_$Create$(toString_0(message));
|
|
1463
|
+
}
|
|
1464
|
+
var x = input;
|
|
1465
|
+
var _iterator__ex2g4s = this.ob7_1.t();
|
|
1466
|
+
while (_iterator__ex2g4s.u()) {
|
|
1467
|
+
var layer = _iterator__ex2g4s.v();
|
|
1468
|
+
x = forward(this, layer, x);
|
|
1469
|
+
}
|
|
1470
|
+
return x;
|
|
1471
|
+
};
|
|
1472
|
+
function ByteArrayReader(data) {
|
|
1473
|
+
this.pb7_1 = data;
|
|
1474
|
+
this.qb7_1 = 0;
|
|
1475
|
+
}
|
|
1476
|
+
protoOf(ByteArrayReader).rb7 = function () {
|
|
1477
|
+
var _unary__edvuaz = this.qb7_1;
|
|
1478
|
+
this.qb7_1 = _unary__edvuaz + 1 | 0;
|
|
1479
|
+
var b0 = this.pb7_1[_unary__edvuaz] & 255;
|
|
1480
|
+
var _unary__edvuaz_0 = this.qb7_1;
|
|
1481
|
+
this.qb7_1 = _unary__edvuaz_0 + 1 | 0;
|
|
1482
|
+
var b1 = this.pb7_1[_unary__edvuaz_0] & 255;
|
|
1483
|
+
var _unary__edvuaz_1 = this.qb7_1;
|
|
1484
|
+
this.qb7_1 = _unary__edvuaz_1 + 1 | 0;
|
|
1485
|
+
var b2 = this.pb7_1[_unary__edvuaz_1] & 255;
|
|
1486
|
+
var _unary__edvuaz_2 = this.qb7_1;
|
|
1487
|
+
this.qb7_1 = _unary__edvuaz_2 + 1 | 0;
|
|
1488
|
+
var b3 = this.pb7_1[_unary__edvuaz_2] & 255;
|
|
1489
|
+
return b0 | b1 << 8 | b2 << 16 | b3 << 24;
|
|
1490
|
+
};
|
|
1491
|
+
protoOf(ByteArrayReader).tb7 = function () {
|
|
1492
|
+
// Inline function 'kotlin.fromBits' call
|
|
1493
|
+
var bits = this.rb7();
|
|
1494
|
+
return floatFromBits(bits);
|
|
1495
|
+
};
|
|
1496
|
+
protoOf(ByteArrayReader).sb7 = function (size) {
|
|
1497
|
+
var tmp = 0;
|
|
1498
|
+
var tmp_0 = new Float32Array(size);
|
|
1499
|
+
while (tmp < size) {
|
|
1500
|
+
tmp_0[tmp] = this.tb7();
|
|
1501
|
+
tmp = tmp + 1 | 0;
|
|
1502
|
+
}
|
|
1503
|
+
return tmp_0;
|
|
1504
|
+
};
|
|
1505
|
+
function sqrt(x) {
|
|
1506
|
+
// Inline function 'kotlin.math.sqrt' call
|
|
1507
|
+
return Math.sqrt(x);
|
|
1508
|
+
}
|
|
1509
|
+
function finishTrick($this, state) {
|
|
1510
|
+
var playersInOrder = Companion_instance_4.fb8(state.ub7_1, state.db8_1);
|
|
1511
|
+
// Inline function 'kotlin.collections.map' call
|
|
1512
|
+
var this_0 = state.xb7_1;
|
|
1513
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1514
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
1515
|
+
var _iterator__ex2g4s = this_0.t();
|
|
1516
|
+
while (_iterator__ex2g4s.u()) {
|
|
1517
|
+
var item = _iterator__ex2g4s.v();
|
|
1518
|
+
var tmp$ret$0 = item.gb8_1;
|
|
1519
|
+
destination.e1(tmp$ret$0);
|
|
1520
|
+
}
|
|
1521
|
+
var alreadyPlayed = toSet(destination);
|
|
1522
|
+
var _iterator__ex2g4s_0 = playersInOrder.t();
|
|
1523
|
+
$l$loop: while (_iterator__ex2g4s_0.u()) {
|
|
1524
|
+
var pid = _iterator__ex2g4s_0.v();
|
|
1525
|
+
if (alreadyPlayed.m2(pid))
|
|
1526
|
+
continue $l$loop;
|
|
1527
|
+
playCard($this, state, pid);
|
|
1528
|
+
}
|
|
1529
|
+
resolveTrickAndAdvance($this, state);
|
|
1530
|
+
}
|
|
1531
|
+
function playFullTrick($this, state) {
|
|
1532
|
+
state.xb7_1.b3();
|
|
1533
|
+
var playersInOrder = Companion_instance_4.fb8(state.ub7_1, state.db8_1);
|
|
1534
|
+
var _iterator__ex2g4s = playersInOrder.t();
|
|
1535
|
+
while (_iterator__ex2g4s.u()) {
|
|
1536
|
+
var pid = _iterator__ex2g4s.v();
|
|
1537
|
+
playCard($this, state, pid);
|
|
1538
|
+
}
|
|
1539
|
+
resolveTrickAndAdvance($this, state);
|
|
1540
|
+
}
|
|
1541
|
+
function playCard($this, state, playerId) {
|
|
1542
|
+
var tmp0_elvis_lhs = state.vb7_1.v2(playerId);
|
|
1543
|
+
var tmp;
|
|
1544
|
+
if (tmp0_elvis_lhs == null) {
|
|
1545
|
+
return Unit_instance;
|
|
1546
|
+
} else {
|
|
1547
|
+
tmp = tmp0_elvis_lhs;
|
|
1548
|
+
}
|
|
1549
|
+
var hand = tmp;
|
|
1550
|
+
if (hand.r())
|
|
1551
|
+
return Unit_instance;
|
|
1552
|
+
var partnerPid = Companion_instance_4.ib8(playerId, state.ub7_1, state.ab8_1);
|
|
1553
|
+
var partnerWinning = isPartnerWinning($this, state, partnerPid);
|
|
1554
|
+
var legalCards = TrickSimulator_instance.jb8(hand, state.xb7_1, state.wb7_1, state.bb8_1, state.ab8_1, playerId, partnerPid);
|
|
1555
|
+
var card = $this.kb8_1.lb8(hand, legalCards, state.xb7_1, state.wb7_1, partnerPid, partnerWinning);
|
|
1556
|
+
hand.y2(card);
|
|
1557
|
+
state.xb7_1.e1(new SimCard(playerId, card));
|
|
1558
|
+
}
|
|
1559
|
+
function resolveTrickAndAdvance($this, state) {
|
|
1560
|
+
var result = TrickSimulator_instance.mb8(state.xb7_1, state.wb7_1);
|
|
1561
|
+
var tmp0 = state.zb7_1;
|
|
1562
|
+
var tmp2 = result.nb8_1;
|
|
1563
|
+
var tmp0_elvis_lhs = state.zb7_1.v2(result.nb8_1);
|
|
1564
|
+
// Inline function 'kotlin.collections.set' call
|
|
1565
|
+
var value = (tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs) + result.ob8_1 | 0;
|
|
1566
|
+
tmp0.g3(tmp2, value);
|
|
1567
|
+
state.db8_1 = result.nb8_1;
|
|
1568
|
+
state.yb7_1 = state.yb7_1 + 1 | 0;
|
|
1569
|
+
state.xb7_1.b3();
|
|
1570
|
+
}
|
|
1571
|
+
function computeResult($this, state) {
|
|
1572
|
+
var focalIndex = state.ub7_1.o2(state.cb8_1);
|
|
1573
|
+
var n = state.ub7_1.g1();
|
|
1574
|
+
var tmp;
|
|
1575
|
+
if (state.ab8_1.isTeamGame && n === 4) {
|
|
1576
|
+
var partnerIndex = (focalIndex + 2 | 0) % n | 0;
|
|
1577
|
+
tmp = setOf_0([state.ub7_1.h1(focalIndex), state.ub7_1.h1(partnerIndex)]);
|
|
1578
|
+
} else {
|
|
1579
|
+
tmp = setOf(state.cb8_1);
|
|
1580
|
+
}
|
|
1581
|
+
var focalTeam = tmp;
|
|
1582
|
+
var focalPts = 0;
|
|
1583
|
+
var oppPts = 0;
|
|
1584
|
+
// Inline function 'kotlin.collections.iterator' call
|
|
1585
|
+
var _iterator__ex2g4s = state.zb7_1.m1().t();
|
|
1586
|
+
while (_iterator__ex2g4s.u()) {
|
|
1587
|
+
var _destruct__k2r9zo = _iterator__ex2g4s.v();
|
|
1588
|
+
// Inline function 'kotlin.collections.component1' call
|
|
1589
|
+
var pid = _destruct__k2r9zo.n1();
|
|
1590
|
+
// Inline function 'kotlin.collections.component2' call
|
|
1591
|
+
var pts = _destruct__k2r9zo.o1();
|
|
1592
|
+
if (focalTeam.m2(pid))
|
|
1593
|
+
focalPts = focalPts + pts | 0;
|
|
1594
|
+
else
|
|
1595
|
+
oppPts = oppPts + pts | 0;
|
|
1596
|
+
}
|
|
1597
|
+
return new RolloutResult(focalPts, oppPts);
|
|
1598
|
+
}
|
|
1599
|
+
function isPartnerWinning($this, state, partnerPid) {
|
|
1600
|
+
if (partnerPid == null || state.xb7_1.r())
|
|
1601
|
+
return false;
|
|
1602
|
+
var firstSuit = first(state.xb7_1).hb8_1.u6k();
|
|
1603
|
+
var tmp0 = state.xb7_1;
|
|
1604
|
+
var tmp$ret$0;
|
|
1605
|
+
$l$block_0: {
|
|
1606
|
+
// Inline function 'kotlin.collections.maxByOrNull' call
|
|
1607
|
+
var iterator = tmp0.t();
|
|
1608
|
+
if (!iterator.u()) {
|
|
1609
|
+
tmp$ret$0 = null;
|
|
1610
|
+
break $l$block_0;
|
|
1611
|
+
}
|
|
1612
|
+
var maxElem = iterator.v();
|
|
1613
|
+
if (!iterator.u()) {
|
|
1614
|
+
tmp$ret$0 = maxElem;
|
|
1615
|
+
break $l$block_0;
|
|
1616
|
+
}
|
|
1617
|
+
var it = maxElem;
|
|
1618
|
+
var maxValue = getGrowth(it.hb8_1, state.wb7_1, firstSuit);
|
|
1619
|
+
do {
|
|
1620
|
+
var e = iterator.v();
|
|
1621
|
+
var v = getGrowth(e.hb8_1, state.wb7_1, firstSuit);
|
|
1622
|
+
if (compareTo(maxValue, v) < 0) {
|
|
1623
|
+
maxElem = e;
|
|
1624
|
+
maxValue = v;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
while (iterator.u());
|
|
1628
|
+
tmp$ret$0 = maxElem;
|
|
1629
|
+
}
|
|
1630
|
+
var winner = tmp$ret$0;
|
|
1631
|
+
return (winner == null ? null : winner.gb8_1) == partnerPid;
|
|
1632
|
+
}
|
|
1633
|
+
function Companion_2() {
|
|
1634
|
+
this.eb8_1 = 10;
|
|
1635
|
+
}
|
|
1636
|
+
protoOf(Companion_2).fb8 = function (playerOrder, leadId) {
|
|
1637
|
+
var startIdx = coerceAtLeast_0(playerOrder.o2(leadId), 0);
|
|
1638
|
+
// Inline function 'kotlin.collections.List' call
|
|
1639
|
+
// Inline function 'kotlin.collections.MutableList' call
|
|
1640
|
+
var size = playerOrder.g1();
|
|
1641
|
+
var list = ArrayList_init_$Create$_0(size);
|
|
1642
|
+
// Inline function 'kotlin.repeat' call
|
|
1643
|
+
var inductionVariable = 0;
|
|
1644
|
+
if (inductionVariable < size)
|
|
1645
|
+
do {
|
|
1646
|
+
var index = inductionVariable;
|
|
1647
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
1648
|
+
var tmp$ret$0 = playerOrder.h1((startIdx + index | 0) % playerOrder.g1() | 0);
|
|
1649
|
+
list.e1(tmp$ret$0);
|
|
1650
|
+
}
|
|
1651
|
+
while (inductionVariable < size);
|
|
1652
|
+
return list;
|
|
1653
|
+
};
|
|
1654
|
+
protoOf(Companion_2).ib8 = function (playerId, playerOrder, playersMode) {
|
|
1655
|
+
if (!playersMode.isTeamGame || !(playerOrder.g1() === 4))
|
|
1656
|
+
return null;
|
|
1657
|
+
var idx = playerOrder.o2(playerId);
|
|
1658
|
+
if (idx < 0)
|
|
1659
|
+
return null;
|
|
1660
|
+
return playerOrder.h1((idx + 2 | 0) % 4 | 0);
|
|
1661
|
+
};
|
|
1662
|
+
var Companion_instance_4;
|
|
1663
|
+
function Companion_getInstance_2() {
|
|
1664
|
+
return Companion_instance_4;
|
|
1665
|
+
}
|
|
1666
|
+
function DeterministicRollout(rolloutPolicy) {
|
|
1667
|
+
this.kb8_1 = rolloutPolicy;
|
|
1668
|
+
}
|
|
1669
|
+
protoOf(DeterministicRollout).pb8 = function (initialState) {
|
|
1670
|
+
var state = initialState;
|
|
1671
|
+
var tmp0 = state.vb7_1.x2();
|
|
1672
|
+
var tmp$ret$0;
|
|
1673
|
+
$l$block: {
|
|
1674
|
+
// Inline function 'kotlin.collections.maxOfOrNull' call
|
|
1675
|
+
var iterator = tmp0.t();
|
|
1676
|
+
if (!iterator.u()) {
|
|
1677
|
+
tmp$ret$0 = null;
|
|
1678
|
+
break $l$block;
|
|
1679
|
+
}
|
|
1680
|
+
var maxValue = iterator.v().g1();
|
|
1681
|
+
while (iterator.u()) {
|
|
1682
|
+
var v = iterator.v().g1();
|
|
1683
|
+
if (compareTo(maxValue, v) < 0) {
|
|
1684
|
+
maxValue = v;
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
tmp$ret$0 = maxValue;
|
|
1688
|
+
}
|
|
1689
|
+
var tmp0_elvis_lhs = tmp$ret$0;
|
|
1690
|
+
var maxTricks = tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs;
|
|
1691
|
+
var tmp = state.yb7_1 + maxTricks | 0;
|
|
1692
|
+
var tmp_0;
|
|
1693
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1694
|
+
if (!state.xb7_1.r()) {
|
|
1695
|
+
tmp_0 = 1;
|
|
1696
|
+
} else {
|
|
1697
|
+
tmp_0 = 0;
|
|
1698
|
+
}
|
|
1699
|
+
var totalTricks = tmp + tmp_0 | 0;
|
|
1700
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1701
|
+
if (!state.xb7_1.r()) {
|
|
1702
|
+
finishTrick(this, state);
|
|
1703
|
+
}
|
|
1704
|
+
$l$loop: while (true) {
|
|
1705
|
+
var tmp0_0 = state.vb7_1.x2();
|
|
1706
|
+
var tmp$ret$5;
|
|
1707
|
+
$l$block_1: {
|
|
1708
|
+
// Inline function 'kotlin.collections.any' call
|
|
1709
|
+
var tmp_1;
|
|
1710
|
+
if (isInterface(tmp0_0, Collection)) {
|
|
1711
|
+
tmp_1 = tmp0_0.r();
|
|
1712
|
+
} else {
|
|
1713
|
+
tmp_1 = false;
|
|
1714
|
+
}
|
|
1715
|
+
if (tmp_1) {
|
|
1716
|
+
tmp$ret$5 = false;
|
|
1717
|
+
break $l$block_1;
|
|
1718
|
+
}
|
|
1719
|
+
var _iterator__ex2g4s = tmp0_0.t();
|
|
1720
|
+
while (_iterator__ex2g4s.u()) {
|
|
1721
|
+
var element = _iterator__ex2g4s.v();
|
|
1722
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1723
|
+
if (!element.r()) {
|
|
1724
|
+
tmp$ret$5 = true;
|
|
1725
|
+
break $l$block_1;
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
tmp$ret$5 = false;
|
|
1729
|
+
}
|
|
1730
|
+
if (!tmp$ret$5) {
|
|
1731
|
+
break $l$loop;
|
|
1732
|
+
}
|
|
1733
|
+
playFullTrick(this, state);
|
|
1734
|
+
}
|
|
1735
|
+
var lastTrickWinner = state.db8_1;
|
|
1736
|
+
var tmp0_1 = state.zb7_1;
|
|
1737
|
+
var tmp1_elvis_lhs = state.zb7_1.v2(lastTrickWinner);
|
|
1738
|
+
// Inline function 'kotlin.collections.set' call
|
|
1739
|
+
var value = (tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs) + 10 | 0;
|
|
1740
|
+
tmp0_1.g3(lastTrickWinner, value);
|
|
1741
|
+
return computeResult(this, state);
|
|
1742
|
+
};
|
|
1743
|
+
function RolloutState(playerOrder, hands, trump, currentTrick, trickNumber, points, playersMode, rules, focalPlayerId, leadPlayerId) {
|
|
1744
|
+
this.ub7_1 = playerOrder;
|
|
1745
|
+
this.vb7_1 = hands;
|
|
1746
|
+
this.wb7_1 = trump;
|
|
1747
|
+
this.xb7_1 = currentTrick;
|
|
1748
|
+
this.yb7_1 = trickNumber;
|
|
1749
|
+
this.zb7_1 = points;
|
|
1750
|
+
this.ab8_1 = playersMode;
|
|
1751
|
+
this.bb8_1 = rules;
|
|
1752
|
+
this.cb8_1 = focalPlayerId;
|
|
1753
|
+
this.db8_1 = leadPlayerId;
|
|
1754
|
+
}
|
|
1755
|
+
protoOf(RolloutState).toString = function () {
|
|
1756
|
+
return 'RolloutState(playerOrder=' + toString_0(this.ub7_1) + ', hands=' + toString_0(this.vb7_1) + ', trump=' + this.wb7_1.toString() + ', currentTrick=' + toString_0(this.xb7_1) + ', trickNumber=' + this.yb7_1 + ', points=' + toString_0(this.zb7_1) + ', playersMode=' + this.ab8_1.toString() + ', rules=' + this.bb8_1.toString() + ', focalPlayerId=' + this.cb8_1 + ', leadPlayerId=' + this.db8_1 + ')';
|
|
1757
|
+
};
|
|
1758
|
+
protoOf(RolloutState).hashCode = function () {
|
|
1759
|
+
var result = hashCode(this.ub7_1);
|
|
1760
|
+
result = imul(result, 31) + hashCode(this.vb7_1) | 0;
|
|
1761
|
+
result = imul(result, 31) + this.wb7_1.hashCode() | 0;
|
|
1762
|
+
result = imul(result, 31) + hashCode(this.xb7_1) | 0;
|
|
1763
|
+
result = imul(result, 31) + this.yb7_1 | 0;
|
|
1764
|
+
result = imul(result, 31) + hashCode(this.zb7_1) | 0;
|
|
1765
|
+
result = imul(result, 31) + this.ab8_1.hashCode() | 0;
|
|
1766
|
+
result = imul(result, 31) + this.bb8_1.hashCode() | 0;
|
|
1767
|
+
result = imul(result, 31) + getStringHashCode(this.cb8_1) | 0;
|
|
1768
|
+
result = imul(result, 31) + getStringHashCode(this.db8_1) | 0;
|
|
1769
|
+
return result;
|
|
1770
|
+
};
|
|
1771
|
+
protoOf(RolloutState).equals = function (other) {
|
|
1772
|
+
if (this === other)
|
|
1773
|
+
return true;
|
|
1774
|
+
if (!(other instanceof RolloutState))
|
|
1775
|
+
return false;
|
|
1776
|
+
if (!equals(this.ub7_1, other.ub7_1))
|
|
1777
|
+
return false;
|
|
1778
|
+
if (!equals(this.vb7_1, other.vb7_1))
|
|
1779
|
+
return false;
|
|
1780
|
+
if (!this.wb7_1.equals(other.wb7_1))
|
|
1781
|
+
return false;
|
|
1782
|
+
if (!equals(this.xb7_1, other.xb7_1))
|
|
1783
|
+
return false;
|
|
1784
|
+
if (!(this.yb7_1 === other.yb7_1))
|
|
1785
|
+
return false;
|
|
1786
|
+
if (!equals(this.zb7_1, other.zb7_1))
|
|
1787
|
+
return false;
|
|
1788
|
+
if (!this.ab8_1.equals(other.ab8_1))
|
|
1789
|
+
return false;
|
|
1790
|
+
if (!this.bb8_1.equals(other.bb8_1))
|
|
1791
|
+
return false;
|
|
1792
|
+
if (!(this.cb8_1 === other.cb8_1))
|
|
1793
|
+
return false;
|
|
1794
|
+
if (!(this.db8_1 === other.db8_1))
|
|
1795
|
+
return false;
|
|
1796
|
+
return true;
|
|
1797
|
+
};
|
|
1798
|
+
function RolloutResult(focalTeamPoints, opponentTeamPoints) {
|
|
1799
|
+
this.qb8_1 = focalTeamPoints;
|
|
1800
|
+
this.rb8_1 = opponentTeamPoints;
|
|
1801
|
+
}
|
|
1802
|
+
protoOf(RolloutResult).toString = function () {
|
|
1803
|
+
return 'RolloutResult(focalTeamPoints=' + this.qb8_1 + ', opponentTeamPoints=' + this.rb8_1 + ')';
|
|
1804
|
+
};
|
|
1805
|
+
protoOf(RolloutResult).hashCode = function () {
|
|
1806
|
+
var result = this.qb8_1;
|
|
1807
|
+
result = imul(result, 31) + this.rb8_1 | 0;
|
|
1808
|
+
return result;
|
|
1809
|
+
};
|
|
1810
|
+
protoOf(RolloutResult).equals = function (other) {
|
|
1811
|
+
if (this === other)
|
|
1812
|
+
return true;
|
|
1813
|
+
if (!(other instanceof RolloutResult))
|
|
1814
|
+
return false;
|
|
1815
|
+
if (!(this.qb8_1 === other.qb8_1))
|
|
1816
|
+
return false;
|
|
1817
|
+
if (!(this.rb8_1 === other.rb8_1))
|
|
1818
|
+
return false;
|
|
1819
|
+
return true;
|
|
1820
|
+
};
|
|
1821
|
+
function WorldMoveScore(action, normalizedScore) {
|
|
1822
|
+
this.sb8_1 = action;
|
|
1823
|
+
this.tb8_1 = normalizedScore;
|
|
1824
|
+
}
|
|
1825
|
+
protoOf(WorldMoveScore).toString = function () {
|
|
1826
|
+
return 'WorldMoveScore(action=' + toString_0(this.sb8_1) + ', normalizedScore=' + this.tb8_1 + ')';
|
|
1827
|
+
};
|
|
1828
|
+
protoOf(WorldMoveScore).hashCode = function () {
|
|
1829
|
+
var result = hashCode(this.sb8_1);
|
|
1830
|
+
result = imul(result, 31) + getNumberHashCode(this.tb8_1) | 0;
|
|
1831
|
+
return result;
|
|
1832
|
+
};
|
|
1833
|
+
protoOf(WorldMoveScore).equals = function (other) {
|
|
1834
|
+
if (this === other)
|
|
1835
|
+
return true;
|
|
1836
|
+
if (!(other instanceof WorldMoveScore))
|
|
1837
|
+
return false;
|
|
1838
|
+
if (!equals(this.sb8_1, other.sb8_1))
|
|
1839
|
+
return false;
|
|
1840
|
+
if (!equals(this.tb8_1, other.tb8_1))
|
|
1841
|
+
return false;
|
|
1842
|
+
return true;
|
|
1843
|
+
};
|
|
1844
|
+
function MoveScoreAggregator() {
|
|
1845
|
+
}
|
|
1846
|
+
protoOf(MoveScoreAggregator).ub8 = function (worldScores, config) {
|
|
1847
|
+
if (worldScores.r())
|
|
1848
|
+
return emptyMap();
|
|
1849
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
1850
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
1851
|
+
var destination = ArrayList_init_$Create$();
|
|
1852
|
+
var _iterator__ex2g4s = worldScores.t();
|
|
1853
|
+
while (_iterator__ex2g4s.u()) {
|
|
1854
|
+
var element = _iterator__ex2g4s.v();
|
|
1855
|
+
// Inline function 'kotlin.collections.map' call
|
|
1856
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1857
|
+
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(element, 10));
|
|
1858
|
+
var _iterator__ex2g4s_0 = element.t();
|
|
1859
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
1860
|
+
var item = _iterator__ex2g4s_0.v();
|
|
1861
|
+
var tmp$ret$0 = item.sb8_1;
|
|
1862
|
+
destination_0.e1(tmp$ret$0);
|
|
1863
|
+
}
|
|
1864
|
+
var list = destination_0;
|
|
1865
|
+
addAll(destination, list);
|
|
1866
|
+
}
|
|
1867
|
+
var actions = distinct(destination);
|
|
1868
|
+
if (actions.r())
|
|
1869
|
+
return emptyMap();
|
|
1870
|
+
// Inline function 'kotlin.collections.associateWith' call
|
|
1871
|
+
var result = LinkedHashMap_init_$Create$_0(coerceAtLeast_0(mapCapacity(collectionSizeOrDefault(actions, 10)), 16));
|
|
1872
|
+
// Inline function 'kotlin.collections.associateWithTo' call
|
|
1873
|
+
var _iterator__ex2g4s_1 = actions.t();
|
|
1874
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
1875
|
+
var element_0 = _iterator__ex2g4s_1.v();
|
|
1876
|
+
// Inline function 'kotlin.collections.map' call
|
|
1877
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1878
|
+
var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(worldScores, 10));
|
|
1879
|
+
var _iterator__ex2g4s_2 = worldScores.t();
|
|
1880
|
+
while (_iterator__ex2g4s_2.u()) {
|
|
1881
|
+
var item_0 = _iterator__ex2g4s_2.v();
|
|
1882
|
+
var tmp$ret$7;
|
|
1883
|
+
$l$block: {
|
|
1884
|
+
// Inline function 'kotlin.collections.firstOrNull' call
|
|
1885
|
+
var _iterator__ex2g4s_3 = item_0.t();
|
|
1886
|
+
while (_iterator__ex2g4s_3.u()) {
|
|
1887
|
+
var element_1 = _iterator__ex2g4s_3.v();
|
|
1888
|
+
if (equals(element_1.sb8_1, element_0)) {
|
|
1889
|
+
tmp$ret$7 = element_1;
|
|
1890
|
+
break $l$block;
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
tmp$ret$7 = null;
|
|
1894
|
+
}
|
|
1895
|
+
var tmp0_safe_receiver = tmp$ret$7;
|
|
1896
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.tb8_1;
|
|
1897
|
+
var tmp$ret$8 = tmp1_elvis_lhs == null ? 0.0 : tmp1_elvis_lhs;
|
|
1898
|
+
destination_1.e1(tmp$ret$8);
|
|
1899
|
+
}
|
|
1900
|
+
result.g3(element_0, destination_1);
|
|
1901
|
+
}
|
|
1902
|
+
var scoresByAction = result;
|
|
1903
|
+
// Inline function 'kotlin.collections.mapValues' call
|
|
1904
|
+
// Inline function 'kotlin.collections.mapValuesTo' call
|
|
1905
|
+
var destination_2 = LinkedHashMap_init_$Create$_0(mapCapacity(scoresByAction.g1()));
|
|
1906
|
+
// Inline function 'kotlin.collections.associateByTo' call
|
|
1907
|
+
var _iterator__ex2g4s_4 = scoresByAction.m1().t();
|
|
1908
|
+
while (_iterator__ex2g4s_4.u()) {
|
|
1909
|
+
var element_2 = _iterator__ex2g4s_4.v();
|
|
1910
|
+
var tmp = element_2.n1();
|
|
1911
|
+
// Inline function 'kotlin.collections.component2' call
|
|
1912
|
+
var scores = element_2.o1();
|
|
1913
|
+
var tmp$ret$16 = sum_0(scores) / scores.g1();
|
|
1914
|
+
destination_2.g3(tmp, tmp$ret$16);
|
|
1915
|
+
}
|
|
1916
|
+
var avgScores = destination_2;
|
|
1917
|
+
if (!config.xb8_1) {
|
|
1918
|
+
return avgScores;
|
|
1919
|
+
}
|
|
1920
|
+
// Inline function 'kotlin.collections.associateWith' call
|
|
1921
|
+
var result_0 = LinkedHashMap_init_$Create$_0(coerceAtLeast_0(mapCapacity(collectionSizeOrDefault(actions, 10)), 16));
|
|
1922
|
+
// Inline function 'kotlin.collections.associateWithTo' call
|
|
1923
|
+
var _iterator__ex2g4s_5 = actions.t();
|
|
1924
|
+
while (_iterator__ex2g4s_5.u()) {
|
|
1925
|
+
var element_3 = _iterator__ex2g4s_5.v();
|
|
1926
|
+
var maxRegret = 0.0;
|
|
1927
|
+
var inductionVariable = 0;
|
|
1928
|
+
var last = worldScores.g1() - 1 | 0;
|
|
1929
|
+
if (inductionVariable <= last)
|
|
1930
|
+
do {
|
|
1931
|
+
var worldIdx = inductionVariable;
|
|
1932
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
1933
|
+
// Inline function 'kotlin.collections.maxOf' call
|
|
1934
|
+
var iterator = actions.t();
|
|
1935
|
+
if (!iterator.u())
|
|
1936
|
+
throw NoSuchElementException_init_$Create$();
|
|
1937
|
+
var a = iterator.v();
|
|
1938
|
+
var tmp0_safe_receiver_0 = scoresByAction.v2(a);
|
|
1939
|
+
var tmp1_elvis_lhs_0 = tmp0_safe_receiver_0 == null ? null : getOrNull(tmp0_safe_receiver_0, worldIdx);
|
|
1940
|
+
var maxValue = tmp1_elvis_lhs_0 == null ? 0.0 : tmp1_elvis_lhs_0;
|
|
1941
|
+
while (iterator.u()) {
|
|
1942
|
+
var a_0 = iterator.v();
|
|
1943
|
+
var tmp0_safe_receiver_1 = scoresByAction.v2(a_0);
|
|
1944
|
+
var tmp1_elvis_lhs_1 = tmp0_safe_receiver_1 == null ? null : getOrNull(tmp0_safe_receiver_1, worldIdx);
|
|
1945
|
+
var v = tmp1_elvis_lhs_1 == null ? 0.0 : tmp1_elvis_lhs_1;
|
|
1946
|
+
// Inline function 'kotlin.comparisons.maxOf' call
|
|
1947
|
+
var a_1 = maxValue;
|
|
1948
|
+
maxValue = Math.max(a_1, v);
|
|
1949
|
+
}
|
|
1950
|
+
var bestInWorld = maxValue;
|
|
1951
|
+
var tmp0_safe_receiver_2 = scoresByAction.v2(element_3);
|
|
1952
|
+
var tmp1_elvis_lhs_2 = tmp0_safe_receiver_2 == null ? null : getOrNull(tmp0_safe_receiver_2, worldIdx);
|
|
1953
|
+
var thisScore = tmp1_elvis_lhs_2 == null ? 0.0 : tmp1_elvis_lhs_2;
|
|
1954
|
+
var regret = bestInWorld - thisScore;
|
|
1955
|
+
if (regret > maxRegret)
|
|
1956
|
+
maxRegret = regret;
|
|
1957
|
+
}
|
|
1958
|
+
while (inductionVariable <= last);
|
|
1959
|
+
var tmp$ret$24 = maxRegret;
|
|
1960
|
+
result_0.g3(element_3, tmp$ret$24);
|
|
1961
|
+
}
|
|
1962
|
+
var maxRegrets = result_0;
|
|
1963
|
+
// Inline function 'kotlin.collections.associateWith' call
|
|
1964
|
+
var result_1 = LinkedHashMap_init_$Create$_0(coerceAtLeast_0(mapCapacity(collectionSizeOrDefault(actions, 10)), 16));
|
|
1965
|
+
// Inline function 'kotlin.collections.associateWithTo' call
|
|
1966
|
+
var _iterator__ex2g4s_6 = actions.t();
|
|
1967
|
+
while (_iterator__ex2g4s_6.u()) {
|
|
1968
|
+
var element_4 = _iterator__ex2g4s_6.v();
|
|
1969
|
+
var tmp0_elvis_lhs = avgScores.v2(element_4);
|
|
1970
|
+
var tmp_0 = tmp0_elvis_lhs == null ? 0.0 : tmp0_elvis_lhs;
|
|
1971
|
+
var tmp1_elvis_lhs_3 = maxRegrets.v2(element_4);
|
|
1972
|
+
var tmp$ret$27 = tmp_0 - config.yb8_1 * (tmp1_elvis_lhs_3 == null ? 0.0 : tmp1_elvis_lhs_3);
|
|
1973
|
+
result_1.g3(element_4, tmp$ret$27);
|
|
1974
|
+
}
|
|
1975
|
+
return result_1;
|
|
1976
|
+
};
|
|
1977
|
+
var MoveScoreAggregator_instance;
|
|
1978
|
+
function MoveScoreAggregator_getInstance() {
|
|
1979
|
+
return MoveScoreAggregator_instance;
|
|
1980
|
+
}
|
|
1981
|
+
function PimcConfig(worldCount, exactSolveThreshold, enableStrategyFusionMitigation, variancePenalty) {
|
|
1982
|
+
worldCount = worldCount === VOID ? 100 : worldCount;
|
|
1983
|
+
exactSolveThreshold = exactSolveThreshold === VOID ? 3 : exactSolveThreshold;
|
|
1984
|
+
enableStrategyFusionMitigation = enableStrategyFusionMitigation === VOID ? true : enableStrategyFusionMitigation;
|
|
1985
|
+
variancePenalty = variancePenalty === VOID ? 0.3 : variancePenalty;
|
|
1986
|
+
this.vb8_1 = worldCount;
|
|
1987
|
+
this.wb8_1 = exactSolveThreshold;
|
|
1988
|
+
this.xb8_1 = enableStrategyFusionMitigation;
|
|
1989
|
+
this.yb8_1 = variancePenalty;
|
|
1990
|
+
}
|
|
1991
|
+
protoOf(PimcConfig).toString = function () {
|
|
1992
|
+
return 'PimcConfig(worldCount=' + this.vb8_1 + ', exactSolveThreshold=' + this.wb8_1 + ', enableStrategyFusionMitigation=' + this.xb8_1 + ', variancePenalty=' + this.yb8_1 + ')';
|
|
1993
|
+
};
|
|
1994
|
+
protoOf(PimcConfig).hashCode = function () {
|
|
1995
|
+
var result = this.vb8_1;
|
|
1996
|
+
result = imul(result, 31) + this.wb8_1 | 0;
|
|
1997
|
+
result = imul(result, 31) + getBooleanHashCode(this.xb8_1) | 0;
|
|
1998
|
+
result = imul(result, 31) + getNumberHashCode(this.yb8_1) | 0;
|
|
1999
|
+
return result;
|
|
2000
|
+
};
|
|
2001
|
+
protoOf(PimcConfig).equals = function (other) {
|
|
2002
|
+
if (this === other)
|
|
2003
|
+
return true;
|
|
2004
|
+
if (!(other instanceof PimcConfig))
|
|
2005
|
+
return false;
|
|
2006
|
+
if (!(this.vb8_1 === other.vb8_1))
|
|
2007
|
+
return false;
|
|
2008
|
+
if (!(this.wb8_1 === other.wb8_1))
|
|
2009
|
+
return false;
|
|
2010
|
+
if (!(this.xb8_1 === other.xb8_1))
|
|
2011
|
+
return false;
|
|
2012
|
+
if (!equals(this.yb8_1, other.yb8_1))
|
|
2013
|
+
return false;
|
|
2014
|
+
return true;
|
|
2015
|
+
};
|
|
2016
|
+
function evaluateAction($this, state, world, action, trump) {
|
|
2017
|
+
// Inline function 'kotlin.collections.mutableMapOf' call
|
|
2018
|
+
var hands = LinkedHashMap_init_$Create$();
|
|
2019
|
+
// Inline function 'kotlin.collections.iterator' call
|
|
2020
|
+
var _iterator__ex2g4s = world.zb8_1.m1().t();
|
|
2021
|
+
while (_iterator__ex2g4s.u()) {
|
|
2022
|
+
var _destruct__k2r9zo = _iterator__ex2g4s.v();
|
|
2023
|
+
// Inline function 'kotlin.collections.component1' call
|
|
2024
|
+
var pid = _destruct__k2r9zo.n1();
|
|
2025
|
+
// Inline function 'kotlin.collections.component2' call
|
|
2026
|
+
var cards = _destruct__k2r9zo.o1();
|
|
2027
|
+
// Inline function 'kotlin.collections.set' call
|
|
2028
|
+
var value = toMutableList(cards);
|
|
2029
|
+
hands.g3(pid, value);
|
|
2030
|
+
}
|
|
2031
|
+
var focalHand = toMutableList(state.qb4_1);
|
|
2032
|
+
focalHand.y2(action.kb4_1);
|
|
2033
|
+
// Inline function 'kotlin.collections.set' call
|
|
2034
|
+
var key = state.ob4_1;
|
|
2035
|
+
hands.g3(key, focalHand);
|
|
2036
|
+
// Inline function 'kotlin.collections.map' call
|
|
2037
|
+
var this_0 = state.sb4_1;
|
|
2038
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2039
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
2040
|
+
var _iterator__ex2g4s_0 = this_0.t();
|
|
2041
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
2042
|
+
var item = _iterator__ex2g4s_0.v();
|
|
2043
|
+
var tmp$ret$6 = new SimCard(item.g8i_1, item.i8i_1);
|
|
2044
|
+
destination.e1(tmp$ret$6);
|
|
2045
|
+
}
|
|
2046
|
+
var currentTrick = toMutableList(destination);
|
|
2047
|
+
currentTrick.e1(new SimCard(state.ob4_1, action.kb4_1));
|
|
2048
|
+
// Inline function 'kotlin.collections.mutableMapOf' call
|
|
2049
|
+
var points = LinkedHashMap_init_$Create$();
|
|
2050
|
+
var tmp2 = state.ob4_1;
|
|
2051
|
+
// Inline function 'kotlin.collections.set' call
|
|
2052
|
+
var value_0 = state.zb4_1;
|
|
2053
|
+
points.g3(tmp2, value_0);
|
|
2054
|
+
var focalIndex = state.pb4_1.o2(state.ob4_1);
|
|
2055
|
+
if (state.pb4_1.g1() > 1) {
|
|
2056
|
+
var oppId = state.pb4_1.h1((focalIndex + 1 | 0) % state.pb4_1.g1() | 0);
|
|
2057
|
+
// Inline function 'kotlin.collections.set' call
|
|
2058
|
+
var value_1 = state.ab5_1;
|
|
2059
|
+
points.g3(oppId, value_1);
|
|
2060
|
+
}
|
|
2061
|
+
var tmp;
|
|
2062
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
2063
|
+
if (!state.sb4_1.r()) {
|
|
2064
|
+
tmp = first(state.sb4_1).g8i_1;
|
|
2065
|
+
} else {
|
|
2066
|
+
tmp = state.ob4_1;
|
|
2067
|
+
}
|
|
2068
|
+
var leadPid = tmp;
|
|
2069
|
+
var rolloutState = new RolloutState(state.pb4_1, hands, trump, currentTrick, state.bb5_1, points, state.gb5_1, state.fb5_1, state.ob4_1, leadPid);
|
|
2070
|
+
var result = $this.fb9_1.pb8(rolloutState);
|
|
2071
|
+
var total = coerceAtLeast(result.qb8_1 + result.rb8_1 | 0, 1.0);
|
|
2072
|
+
return result.qb8_1 / total;
|
|
2073
|
+
}
|
|
2074
|
+
function PimcEngine(beliefNetwork, rolloutPolicy, config, random) {
|
|
2075
|
+
config = config === VOID ? new PimcConfig() : config;
|
|
2076
|
+
random = random === VOID ? Default_getInstance() : random;
|
|
2077
|
+
this.ab9_1 = beliefNetwork;
|
|
2078
|
+
this.bb9_1 = rolloutPolicy;
|
|
2079
|
+
this.cb9_1 = config;
|
|
2080
|
+
this.db9_1 = random;
|
|
2081
|
+
this.eb9_1 = new WorldSampler(this.db9_1);
|
|
2082
|
+
this.fb9_1 = new DeterministicRollout(this.bb9_1);
|
|
2083
|
+
}
|
|
2084
|
+
protoOf(PimcEngine).gb9 = function (state, legalActions) {
|
|
2085
|
+
if (legalActions.g1() <= 1) {
|
|
2086
|
+
// Inline function 'kotlin.collections.associateWith' call
|
|
2087
|
+
var result = LinkedHashMap_init_$Create$_0(coerceAtLeast_0(mapCapacity(collectionSizeOrDefault(legalActions, 10)), 16));
|
|
2088
|
+
// Inline function 'kotlin.collections.associateWithTo' call
|
|
2089
|
+
var _iterator__ex2g4s = legalActions.t();
|
|
2090
|
+
while (_iterator__ex2g4s.u()) {
|
|
2091
|
+
var element = _iterator__ex2g4s.v();
|
|
2092
|
+
result.g3(element, 1.0);
|
|
2093
|
+
}
|
|
2094
|
+
return result;
|
|
2095
|
+
}
|
|
2096
|
+
// Inline function 'kotlin.collections.filterIsInstance' call
|
|
2097
|
+
// Inline function 'kotlin.collections.filterIsInstanceTo' call
|
|
2098
|
+
var destination = ArrayList_init_$Create$();
|
|
2099
|
+
var _iterator__ex2g4s_0 = legalActions.t();
|
|
2100
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
2101
|
+
var element_0 = _iterator__ex2g4s_0.v();
|
|
2102
|
+
if (element_0 instanceof PlayCard) {
|
|
2103
|
+
destination.e1(element_0);
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
var playCardActions = destination;
|
|
2107
|
+
if (playCardActions.r()) {
|
|
2108
|
+
// Inline function 'kotlin.collections.associateWith' call
|
|
2109
|
+
var result_0 = LinkedHashMap_init_$Create$_0(coerceAtLeast_0(mapCapacity(collectionSizeOrDefault(legalActions, 10)), 16));
|
|
2110
|
+
// Inline function 'kotlin.collections.associateWithTo' call
|
|
2111
|
+
var _iterator__ex2g4s_1 = legalActions.t();
|
|
2112
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
2113
|
+
var element_1 = _iterator__ex2g4s_1.v();
|
|
2114
|
+
result_0.g3(element_1, 0.0);
|
|
2115
|
+
}
|
|
2116
|
+
return result_0;
|
|
2117
|
+
}
|
|
2118
|
+
var tmp0_elvis_lhs = state.tb4_1;
|
|
2119
|
+
var tmp;
|
|
2120
|
+
if (tmp0_elvis_lhs == null) {
|
|
2121
|
+
// Inline function 'kotlin.collections.associateWith' call
|
|
2122
|
+
var result_1 = LinkedHashMap_init_$Create$_0(coerceAtLeast_0(mapCapacity(collectionSizeOrDefault(legalActions, 10)), 16));
|
|
2123
|
+
// Inline function 'kotlin.collections.associateWithTo' call
|
|
2124
|
+
var _iterator__ex2g4s_2 = legalActions.t();
|
|
2125
|
+
while (_iterator__ex2g4s_2.u()) {
|
|
2126
|
+
var element_2 = _iterator__ex2g4s_2.v();
|
|
2127
|
+
result_1.g3(element_2, 0.0);
|
|
2128
|
+
}
|
|
2129
|
+
return result_1;
|
|
2130
|
+
} else {
|
|
2131
|
+
tmp = tmp0_elvis_lhs;
|
|
2132
|
+
}
|
|
2133
|
+
var trump = tmp;
|
|
2134
|
+
var belief = this.ab9_1.eb6(state);
|
|
2135
|
+
var worlds = this.eb9_1.ib9(state, belief, this.cb9_1.vb8_1);
|
|
2136
|
+
// Inline function 'kotlin.collections.map' call
|
|
2137
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2138
|
+
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(worlds, 10));
|
|
2139
|
+
var _iterator__ex2g4s_3 = worlds.t();
|
|
2140
|
+
while (_iterator__ex2g4s_3.u()) {
|
|
2141
|
+
var item = _iterator__ex2g4s_3.v();
|
|
2142
|
+
// Inline function 'kotlin.collections.map' call
|
|
2143
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2144
|
+
var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(playCardActions, 10));
|
|
2145
|
+
var _iterator__ex2g4s_4 = playCardActions.t();
|
|
2146
|
+
while (_iterator__ex2g4s_4.u()) {
|
|
2147
|
+
var item_0 = _iterator__ex2g4s_4.v();
|
|
2148
|
+
var score = evaluateAction(this, state, item, item_0, trump);
|
|
2149
|
+
var tmp$ret$11 = new WorldMoveScore(item_0, score);
|
|
2150
|
+
destination_1.e1(tmp$ret$11);
|
|
2151
|
+
}
|
|
2152
|
+
destination_0.e1(destination_1);
|
|
2153
|
+
}
|
|
2154
|
+
var worldScores = destination_0;
|
|
2155
|
+
return MoveScoreAggregator_instance.ub8(worldScores, this.cb9_1);
|
|
2156
|
+
};
|
|
2157
|
+
function SimCard(playerId, card) {
|
|
2158
|
+
this.gb8_1 = playerId;
|
|
2159
|
+
this.hb8_1 = card;
|
|
2160
|
+
}
|
|
2161
|
+
protoOf(SimCard).toString = function () {
|
|
2162
|
+
return 'SimCard(playerId=' + this.gb8_1 + ', card=' + this.hb8_1.toString() + ')';
|
|
2163
|
+
};
|
|
2164
|
+
protoOf(SimCard).hashCode = function () {
|
|
2165
|
+
var result = getStringHashCode(this.gb8_1);
|
|
2166
|
+
result = imul(result, 31) + this.hb8_1.hashCode() | 0;
|
|
2167
|
+
return result;
|
|
2168
|
+
};
|
|
2169
|
+
protoOf(SimCard).equals = function (other) {
|
|
2170
|
+
if (this === other)
|
|
2171
|
+
return true;
|
|
2172
|
+
if (!(other instanceof SimCard))
|
|
2173
|
+
return false;
|
|
2174
|
+
if (!(this.gb8_1 === other.gb8_1))
|
|
2175
|
+
return false;
|
|
2176
|
+
if (!this.hb8_1.equals(other.hb8_1))
|
|
2177
|
+
return false;
|
|
2178
|
+
return true;
|
|
2179
|
+
};
|
|
2180
|
+
function filterHigherTrumpOrAll($this, candidates, winningCard, trump, firstSuit) {
|
|
2181
|
+
var winGrowth = getGrowth(winningCard, trump, firstSuit);
|
|
2182
|
+
// Inline function 'kotlin.collections.filter' call
|
|
2183
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
2184
|
+
var destination = ArrayList_init_$Create$();
|
|
2185
|
+
var _iterator__ex2g4s = candidates.t();
|
|
2186
|
+
while (_iterator__ex2g4s.u()) {
|
|
2187
|
+
var element = _iterator__ex2g4s.v();
|
|
2188
|
+
if (getGrowth(element, trump, firstSuit) > winGrowth) {
|
|
2189
|
+
destination.e1(element);
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
var higher = destination;
|
|
2193
|
+
// Inline function 'kotlin.collections.ifEmpty' call
|
|
2194
|
+
var tmp;
|
|
2195
|
+
if (higher.r()) {
|
|
2196
|
+
tmp = candidates;
|
|
2197
|
+
} else {
|
|
2198
|
+
tmp = higher;
|
|
2199
|
+
}
|
|
2200
|
+
return tmp;
|
|
2201
|
+
}
|
|
2202
|
+
function TrickSimulator() {
|
|
2203
|
+
}
|
|
2204
|
+
protoOf(TrickSimulator).mb8 = function (cards, trump) {
|
|
2205
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
2206
|
+
// Inline function 'kotlin.require' call
|
|
2207
|
+
if (!!cards.r()) {
|
|
2208
|
+
var message = 'Cannot resolve an empty trick';
|
|
2209
|
+
throw IllegalArgumentException_init_$Create$(toString_0(message));
|
|
2210
|
+
}
|
|
2211
|
+
var firstSuit = first(cards).hb8_1.u6k();
|
|
2212
|
+
var tmp$ret$3;
|
|
2213
|
+
$l$block_0: {
|
|
2214
|
+
// Inline function 'kotlin.collections.maxByOrNull' call
|
|
2215
|
+
var iterator = cards.t();
|
|
2216
|
+
if (!iterator.u()) {
|
|
2217
|
+
tmp$ret$3 = null;
|
|
2218
|
+
break $l$block_0;
|
|
2219
|
+
}
|
|
2220
|
+
var maxElem = iterator.v();
|
|
2221
|
+
if (!iterator.u()) {
|
|
2222
|
+
tmp$ret$3 = maxElem;
|
|
2223
|
+
break $l$block_0;
|
|
2224
|
+
}
|
|
2225
|
+
var it = maxElem;
|
|
2226
|
+
var maxValue = getGrowth(it.hb8_1, trump, firstSuit);
|
|
2227
|
+
do {
|
|
2228
|
+
var e = iterator.v();
|
|
2229
|
+
var v = getGrowth(e.hb8_1, trump, firstSuit);
|
|
2230
|
+
if (compareTo(maxValue, v) < 0) {
|
|
2231
|
+
maxElem = e;
|
|
2232
|
+
maxValue = v;
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
while (iterator.u());
|
|
2236
|
+
tmp$ret$3 = maxElem;
|
|
2237
|
+
}
|
|
2238
|
+
var winner = ensureNotNull(tmp$ret$3);
|
|
2239
|
+
// Inline function 'kotlin.collections.sumOf' call
|
|
2240
|
+
var sum = 0;
|
|
2241
|
+
var _iterator__ex2g4s = cards.t();
|
|
2242
|
+
while (_iterator__ex2g4s.u()) {
|
|
2243
|
+
var element = _iterator__ex2g4s.v();
|
|
2244
|
+
var tmp = sum;
|
|
2245
|
+
sum = tmp + getPoint(element.hb8_1, trump) | 0;
|
|
2246
|
+
}
|
|
2247
|
+
var points = sum;
|
|
2248
|
+
return new TrickResult(winner.gb8_1, points);
|
|
2249
|
+
};
|
|
2250
|
+
protoOf(TrickSimulator).jb8 = function (hand, trickCards, trump, rules, playersMode, playerId, partnerPlayerId) {
|
|
2251
|
+
if (hand.r())
|
|
2252
|
+
return emptyList();
|
|
2253
|
+
if (trickCards.r())
|
|
2254
|
+
return hand;
|
|
2255
|
+
var firstSuit = first(trickCards).hb8_1.u6k();
|
|
2256
|
+
var tmp$ret$0;
|
|
2257
|
+
$l$block_0: {
|
|
2258
|
+
// Inline function 'kotlin.collections.any' call
|
|
2259
|
+
var tmp;
|
|
2260
|
+
if (isInterface(hand, Collection)) {
|
|
2261
|
+
tmp = hand.r();
|
|
2262
|
+
} else {
|
|
2263
|
+
tmp = false;
|
|
2264
|
+
}
|
|
2265
|
+
if (tmp) {
|
|
2266
|
+
tmp$ret$0 = false;
|
|
2267
|
+
break $l$block_0;
|
|
2268
|
+
}
|
|
2269
|
+
var _iterator__ex2g4s = hand.t();
|
|
2270
|
+
while (_iterator__ex2g4s.u()) {
|
|
2271
|
+
var element = _iterator__ex2g4s.v();
|
|
2272
|
+
if (element.u6k().equals(firstSuit)) {
|
|
2273
|
+
tmp$ret$0 = true;
|
|
2274
|
+
break $l$block_0;
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
tmp$ret$0 = false;
|
|
2278
|
+
}
|
|
2279
|
+
var hasSuit = tmp$ret$0;
|
|
2280
|
+
var tmp$ret$2;
|
|
2281
|
+
$l$block_2: {
|
|
2282
|
+
// Inline function 'kotlin.collections.any' call
|
|
2283
|
+
var tmp_0;
|
|
2284
|
+
if (isInterface(hand, Collection)) {
|
|
2285
|
+
tmp_0 = hand.r();
|
|
2286
|
+
} else {
|
|
2287
|
+
tmp_0 = false;
|
|
2288
|
+
}
|
|
2289
|
+
if (tmp_0) {
|
|
2290
|
+
tmp$ret$2 = false;
|
|
2291
|
+
break $l$block_2;
|
|
2292
|
+
}
|
|
2293
|
+
var _iterator__ex2g4s_0 = hand.t();
|
|
2294
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
2295
|
+
var element_0 = _iterator__ex2g4s_0.v();
|
|
2296
|
+
if (element_0.u6k().equals(trump)) {
|
|
2297
|
+
tmp$ret$2 = true;
|
|
2298
|
+
break $l$block_2;
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
tmp$ret$2 = false;
|
|
2302
|
+
}
|
|
2303
|
+
var hasTrump = tmp$ret$2;
|
|
2304
|
+
var tmp_1;
|
|
2305
|
+
if (hasSuit) {
|
|
2306
|
+
// Inline function 'kotlin.collections.filter' call
|
|
2307
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
2308
|
+
var destination = ArrayList_init_$Create$();
|
|
2309
|
+
var _iterator__ex2g4s_1 = hand.t();
|
|
2310
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
2311
|
+
var element_1 = _iterator__ex2g4s_1.v();
|
|
2312
|
+
if (element_1.u6k().equals(firstSuit)) {
|
|
2313
|
+
destination.e1(element_1);
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
tmp_1 = destination;
|
|
2317
|
+
} else if (hasTrump) {
|
|
2318
|
+
// Inline function 'kotlin.collections.filter' call
|
|
2319
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
2320
|
+
var destination_0 = ArrayList_init_$Create$();
|
|
2321
|
+
var _iterator__ex2g4s_2 = hand.t();
|
|
2322
|
+
while (_iterator__ex2g4s_2.u()) {
|
|
2323
|
+
var element_2 = _iterator__ex2g4s_2.v();
|
|
2324
|
+
if (element_2.u6k().equals(trump)) {
|
|
2325
|
+
destination_0.e1(element_2);
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
tmp_1 = destination_0;
|
|
2329
|
+
} else {
|
|
2330
|
+
return hand;
|
|
2331
|
+
}
|
|
2332
|
+
var candidates = tmp_1;
|
|
2333
|
+
var higherTrumpMode = rules.trumpCardStepMode;
|
|
2334
|
+
var tmp$ret$10;
|
|
2335
|
+
$l$block_4: {
|
|
2336
|
+
// Inline function 'kotlin.collections.any' call
|
|
2337
|
+
var tmp_2;
|
|
2338
|
+
if (isInterface(trickCards, Collection)) {
|
|
2339
|
+
tmp_2 = trickCards.r();
|
|
2340
|
+
} else {
|
|
2341
|
+
tmp_2 = false;
|
|
2342
|
+
}
|
|
2343
|
+
if (tmp_2) {
|
|
2344
|
+
tmp$ret$10 = false;
|
|
2345
|
+
break $l$block_4;
|
|
2346
|
+
}
|
|
2347
|
+
var _iterator__ex2g4s_3 = trickCards.t();
|
|
2348
|
+
while (_iterator__ex2g4s_3.u()) {
|
|
2349
|
+
var element_3 = _iterator__ex2g4s_3.v();
|
|
2350
|
+
if (element_3.hb8_1.u6k().equals(trump)) {
|
|
2351
|
+
tmp$ret$10 = true;
|
|
2352
|
+
break $l$block_4;
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
tmp$ret$10 = false;
|
|
2356
|
+
}
|
|
2357
|
+
var anyTrumpOnTable = tmp$ret$10;
|
|
2358
|
+
var tmp_3;
|
|
2359
|
+
switch (higherTrumpMode.a1_1) {
|
|
2360
|
+
case 1:
|
|
2361
|
+
tmp_3 = (firstSuit.equals(trump) && hasSuit);
|
|
2362
|
+
break;
|
|
2363
|
+
case 2:
|
|
2364
|
+
tmp_3 = (anyTrumpOnTable && !hasSuit);
|
|
2365
|
+
break;
|
|
2366
|
+
case 0:
|
|
2367
|
+
tmp_3 = false;
|
|
2368
|
+
break;
|
|
2369
|
+
default:
|
|
2370
|
+
noWhenBranchMatchedException();
|
|
2371
|
+
break;
|
|
2372
|
+
}
|
|
2373
|
+
var mustCheckHigherTrump = tmp_3;
|
|
2374
|
+
if (!mustCheckHigherTrump)
|
|
2375
|
+
return candidates;
|
|
2376
|
+
var tmp$ret$12;
|
|
2377
|
+
$l$block_6: {
|
|
2378
|
+
// Inline function 'kotlin.collections.maxByOrNull' call
|
|
2379
|
+
var iterator = trickCards.t();
|
|
2380
|
+
if (!iterator.u()) {
|
|
2381
|
+
tmp$ret$12 = null;
|
|
2382
|
+
break $l$block_6;
|
|
2383
|
+
}
|
|
2384
|
+
var maxElem = iterator.v();
|
|
2385
|
+
if (!iterator.u()) {
|
|
2386
|
+
tmp$ret$12 = maxElem;
|
|
2387
|
+
break $l$block_6;
|
|
2388
|
+
}
|
|
2389
|
+
var it = maxElem;
|
|
2390
|
+
var maxValue = getGrowth(it.hb8_1, trump, firstSuit);
|
|
2391
|
+
do {
|
|
2392
|
+
var e = iterator.v();
|
|
2393
|
+
var v = getGrowth(e.hb8_1, trump, firstSuit);
|
|
2394
|
+
if (compareTo(maxValue, v) < 0) {
|
|
2395
|
+
maxElem = e;
|
|
2396
|
+
maxValue = v;
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
while (iterator.u());
|
|
2400
|
+
tmp$ret$12 = maxElem;
|
|
2401
|
+
}
|
|
2402
|
+
var tmp1_elvis_lhs = tmp$ret$12;
|
|
2403
|
+
var tmp_4;
|
|
2404
|
+
if (tmp1_elvis_lhs == null) {
|
|
2405
|
+
return candidates;
|
|
2406
|
+
} else {
|
|
2407
|
+
tmp_4 = tmp1_elvis_lhs;
|
|
2408
|
+
}
|
|
2409
|
+
var winningCard = tmp_4;
|
|
2410
|
+
var isPartnerWinning = playersMode.isTeamGame && winningCard.gb8_1 === partnerPlayerId;
|
|
2411
|
+
if (isPartnerWinning) {
|
|
2412
|
+
var tmp_5;
|
|
2413
|
+
switch (rules.trumpCardStepPartnerMode.a1_1) {
|
|
2414
|
+
case 0:
|
|
2415
|
+
tmp_5 = candidates;
|
|
2416
|
+
break;
|
|
2417
|
+
case 2:
|
|
2418
|
+
tmp_5 = candidates;
|
|
2419
|
+
break;
|
|
2420
|
+
case 1:
|
|
2421
|
+
tmp_5 = filterHigherTrumpOrAll(this, candidates, winningCard.hb8_1, trump, firstSuit);
|
|
2422
|
+
break;
|
|
2423
|
+
default:
|
|
2424
|
+
noWhenBranchMatchedException();
|
|
2425
|
+
break;
|
|
2426
|
+
}
|
|
2427
|
+
return tmp_5;
|
|
2428
|
+
}
|
|
2429
|
+
return filterHigherTrumpOrAll(this, candidates, winningCard.hb8_1, trump, firstSuit);
|
|
2430
|
+
};
|
|
2431
|
+
var TrickSimulator_instance;
|
|
2432
|
+
function TrickSimulator_getInstance() {
|
|
2433
|
+
return TrickSimulator_instance;
|
|
2434
|
+
}
|
|
2435
|
+
function TrickResult(winnerId, points) {
|
|
2436
|
+
this.nb8_1 = winnerId;
|
|
2437
|
+
this.ob8_1 = points;
|
|
2438
|
+
}
|
|
2439
|
+
protoOf(TrickResult).toString = function () {
|
|
2440
|
+
return 'TrickResult(winnerId=' + this.nb8_1 + ', points=' + this.ob8_1 + ')';
|
|
2441
|
+
};
|
|
2442
|
+
protoOf(TrickResult).hashCode = function () {
|
|
2443
|
+
var result = getStringHashCode(this.nb8_1);
|
|
2444
|
+
result = imul(result, 31) + this.ob8_1 | 0;
|
|
2445
|
+
return result;
|
|
2446
|
+
};
|
|
2447
|
+
protoOf(TrickResult).equals = function (other) {
|
|
2448
|
+
if (this === other)
|
|
2449
|
+
return true;
|
|
2450
|
+
if (!(other instanceof TrickResult))
|
|
2451
|
+
return false;
|
|
2452
|
+
if (!(this.nb8_1 === other.nb8_1))
|
|
2453
|
+
return false;
|
|
2454
|
+
if (!(this.ob8_1 === other.ob8_1))
|
|
2455
|
+
return false;
|
|
2456
|
+
return true;
|
|
2457
|
+
};
|
|
2458
|
+
function buildCardLookup($this) {
|
|
2459
|
+
// Inline function 'kotlin.arrayOfNulls' call
|
|
2460
|
+
var arr = Array(32);
|
|
2461
|
+
var _iterator__ex2g4s = get_entries().t();
|
|
2462
|
+
while (_iterator__ex2g4s.u()) {
|
|
2463
|
+
var suit = _iterator__ex2g4s.v();
|
|
2464
|
+
var _iterator__ex2g4s_0 = $this.kb9_1.t();
|
|
2465
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
2466
|
+
var name = _iterator__ex2g4s_0.v();
|
|
2467
|
+
var idx = imul(suit.a1_1, 8) + name.a1_1 | 0;
|
|
2468
|
+
if (idx < 32) {
|
|
2469
|
+
arr[idx] = Companion_instance_0.x6k(suit, name);
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
return arr;
|
|
2474
|
+
}
|
|
2475
|
+
function sampleOneWorld($this, state, belief, opponents, maxHandSizes, allCards) {
|
|
2476
|
+
// Inline function 'kotlin.collections.associateWith' call
|
|
2477
|
+
var result = LinkedHashMap_init_$Create$_0(coerceAtLeast_0(mapCapacity(collectionSizeOrDefault(opponents, 10)), 16));
|
|
2478
|
+
// Inline function 'kotlin.collections.associateWithTo' call
|
|
2479
|
+
var _iterator__ex2g4s = opponents.t();
|
|
2480
|
+
while (_iterator__ex2g4s.u()) {
|
|
2481
|
+
var element = _iterator__ex2g4s.v();
|
|
2482
|
+
// Inline function 'kotlin.collections.mutableListOf' call
|
|
2483
|
+
var tmp$ret$1 = ArrayList_init_$Create$();
|
|
2484
|
+
result.g3(element, tmp$ret$1);
|
|
2485
|
+
}
|
|
2486
|
+
var hands = result;
|
|
2487
|
+
var currentSizes = new Int32Array(opponents.g1());
|
|
2488
|
+
var assigned = booleanArray(32);
|
|
2489
|
+
// Inline function 'kotlin.collections.sortedBy' call
|
|
2490
|
+
var this_0 = get_indices_0(belief.jb6_1);
|
|
2491
|
+
// Inline function 'kotlin.comparisons.compareBy' call
|
|
2492
|
+
var tmp = WorldSampler$sampleOneWorld$lambda($this, belief);
|
|
2493
|
+
var tmp$ret$4 = new sam$kotlin_Comparator$0_0(tmp);
|
|
2494
|
+
var sortedHiddenIndices = sortedWith(this_0, tmp$ret$4);
|
|
2495
|
+
var _iterator__ex2g4s_0 = sortedHiddenIndices.t();
|
|
2496
|
+
$l$loop_1: while (_iterator__ex2g4s_0.u()) {
|
|
2497
|
+
var rowIdx = _iterator__ex2g4s_0.v();
|
|
2498
|
+
var cardIdx = belief.jb6_1[rowIdx];
|
|
2499
|
+
var probs = belief.ib6_1[rowIdx];
|
|
2500
|
+
var placed = false;
|
|
2501
|
+
var inductionVariable = 0;
|
|
2502
|
+
if (inductionVariable < 100)
|
|
2503
|
+
$l$loop_0: do {
|
|
2504
|
+
var attempt = inductionVariable;
|
|
2505
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
2506
|
+
var locIdx = sampleFromDistribution($this, probs);
|
|
2507
|
+
if (locIdx < opponents.g1() && currentSizes[locIdx] < maxHandSizes.h1(locIdx)) {
|
|
2508
|
+
var tmp0_elvis_lhs = allCards[cardIdx];
|
|
2509
|
+
var tmp_0;
|
|
2510
|
+
if (tmp0_elvis_lhs == null) {
|
|
2511
|
+
continue $l$loop_0;
|
|
2512
|
+
} else {
|
|
2513
|
+
tmp_0 = tmp0_elvis_lhs;
|
|
2514
|
+
}
|
|
2515
|
+
var card = tmp_0;
|
|
2516
|
+
ensureNotNull(hands.v2(opponents.h1(locIdx))).e1(card);
|
|
2517
|
+
currentSizes[locIdx] = currentSizes[locIdx] + 1 | 0;
|
|
2518
|
+
assigned[cardIdx] = true;
|
|
2519
|
+
placed = true;
|
|
2520
|
+
break $l$loop_0;
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
while (inductionVariable < 100);
|
|
2524
|
+
if (!placed) {
|
|
2525
|
+
var tmp1_elvis_lhs = allCards[cardIdx];
|
|
2526
|
+
var tmp_1;
|
|
2527
|
+
if (tmp1_elvis_lhs == null) {
|
|
2528
|
+
continue $l$loop_1;
|
|
2529
|
+
} else {
|
|
2530
|
+
tmp_1 = tmp1_elvis_lhs;
|
|
2531
|
+
}
|
|
2532
|
+
var card_0 = tmp_1;
|
|
2533
|
+
var inductionVariable_0 = 0;
|
|
2534
|
+
var last = opponents.g1() - 1 | 0;
|
|
2535
|
+
if (inductionVariable_0 <= last)
|
|
2536
|
+
$l$loop_2: do {
|
|
2537
|
+
var i = inductionVariable_0;
|
|
2538
|
+
inductionVariable_0 = inductionVariable_0 + 1 | 0;
|
|
2539
|
+
if (currentSizes[i] < maxHandSizes.h1(i)) {
|
|
2540
|
+
ensureNotNull(hands.v2(opponents.h1(i))).e1(card_0);
|
|
2541
|
+
currentSizes[i] = currentSizes[i] + 1 | 0;
|
|
2542
|
+
assigned[cardIdx] = true;
|
|
2543
|
+
break $l$loop_2;
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
while (inductionVariable_0 <= last);
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
// Inline function 'kotlin.collections.mapValues' call
|
|
2550
|
+
// Inline function 'kotlin.collections.mapValuesTo' call
|
|
2551
|
+
var destination = LinkedHashMap_init_$Create$_0(mapCapacity(hands.g1()));
|
|
2552
|
+
// Inline function 'kotlin.collections.associateByTo' call
|
|
2553
|
+
var _iterator__ex2g4s_1 = hands.m1().t();
|
|
2554
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
2555
|
+
var element_0 = _iterator__ex2g4s_1.v();
|
|
2556
|
+
var tmp_2 = element_0.n1();
|
|
2557
|
+
var tmp$ret$7 = toList(element_0.o1());
|
|
2558
|
+
destination.g3(tmp_2, tmp$ret$7);
|
|
2559
|
+
}
|
|
2560
|
+
return new SampledWorld(destination);
|
|
2561
|
+
}
|
|
2562
|
+
function sampleFromDistribution($this, probs) {
|
|
2563
|
+
var r = $this.hb9_1.zh();
|
|
2564
|
+
var cumulative = 0.0;
|
|
2565
|
+
var inductionVariable = 0;
|
|
2566
|
+
var last = probs.length - 1 | 0;
|
|
2567
|
+
if (inductionVariable <= last)
|
|
2568
|
+
do {
|
|
2569
|
+
var i = inductionVariable;
|
|
2570
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
2571
|
+
cumulative = cumulative + probs[i];
|
|
2572
|
+
if (r < cumulative)
|
|
2573
|
+
return i;
|
|
2574
|
+
}
|
|
2575
|
+
while (inductionVariable <= last);
|
|
2576
|
+
return get_lastIndex(probs);
|
|
2577
|
+
}
|
|
2578
|
+
function entropy($this, probs) {
|
|
2579
|
+
var h = 0.0;
|
|
2580
|
+
var inductionVariable = 0;
|
|
2581
|
+
var last = probs.length;
|
|
2582
|
+
while (inductionVariable < last) {
|
|
2583
|
+
var p = probs[inductionVariable];
|
|
2584
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
2585
|
+
if (p > 1.0E-7) {
|
|
2586
|
+
h = h - p * ln(p);
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
return h;
|
|
2590
|
+
}
|
|
2591
|
+
function Companion_3() {
|
|
2592
|
+
Companion_instance_5 = this;
|
|
2593
|
+
this.jb9_1 = 100;
|
|
2594
|
+
this.kb9_1 = listOf([CardName_ACE_getInstance(), CardName_KING_getInstance(), CardName_QUEEN_getInstance(), CardName_JACK_getInstance(), CardName_TEN_getInstance(), CardName_NINE_getInstance(), CardName_EIGHT_getInstance(), CardName_SEVEN_getInstance()]);
|
|
2595
|
+
}
|
|
2596
|
+
var Companion_instance_5;
|
|
2597
|
+
function Companion_getInstance_3() {
|
|
2598
|
+
if (Companion_instance_5 == null)
|
|
2599
|
+
new Companion_3();
|
|
2600
|
+
return Companion_instance_5;
|
|
2601
|
+
}
|
|
2602
|
+
function sam$kotlin_Comparator$0_0(function_0) {
|
|
2603
|
+
this.lb9_1 = function_0;
|
|
2604
|
+
}
|
|
2605
|
+
protoOf(sam$kotlin_Comparator$0_0).hd = function (a, b) {
|
|
2606
|
+
return this.lb9_1(a, b);
|
|
2607
|
+
};
|
|
2608
|
+
protoOf(sam$kotlin_Comparator$0_0).compare = function (a, b) {
|
|
2609
|
+
return this.hd(a, b);
|
|
2610
|
+
};
|
|
2611
|
+
protoOf(sam$kotlin_Comparator$0_0).s3 = function () {
|
|
2612
|
+
return this.lb9_1;
|
|
2613
|
+
};
|
|
2614
|
+
protoOf(sam$kotlin_Comparator$0_0).equals = function (other) {
|
|
2615
|
+
var tmp;
|
|
2616
|
+
if (!(other == null) ? isInterface(other, Comparator) : false) {
|
|
2617
|
+
var tmp_0;
|
|
2618
|
+
if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
|
|
2619
|
+
tmp_0 = equals(this.s3(), other.s3());
|
|
2620
|
+
} else {
|
|
2621
|
+
tmp_0 = false;
|
|
2622
|
+
}
|
|
2623
|
+
tmp = tmp_0;
|
|
2624
|
+
} else {
|
|
2625
|
+
tmp = false;
|
|
2626
|
+
}
|
|
2627
|
+
return tmp;
|
|
2628
|
+
};
|
|
2629
|
+
protoOf(sam$kotlin_Comparator$0_0).hashCode = function () {
|
|
2630
|
+
return hashCode(this.s3());
|
|
2631
|
+
};
|
|
2632
|
+
function WorldSampler$sampleOneWorld$lambda(this$0, $belief) {
|
|
2633
|
+
return function (a, b) {
|
|
2634
|
+
// Inline function 'kotlin.comparisons.compareValuesBy' call
|
|
2635
|
+
var tmp = entropy(this$0, $belief.ib6_1[a]);
|
|
2636
|
+
var tmp$ret$1 = entropy(this$0, $belief.ib6_1[b]);
|
|
2637
|
+
return compareValues(tmp, tmp$ret$1);
|
|
2638
|
+
};
|
|
2639
|
+
}
|
|
2640
|
+
function WorldSampler(random) {
|
|
2641
|
+
Companion_getInstance_3();
|
|
2642
|
+
this.hb9_1 = random;
|
|
2643
|
+
}
|
|
2644
|
+
protoOf(WorldSampler).ib9 = function (state, belief, worldCount) {
|
|
2645
|
+
var focalIndex = state.pb4_1.o2(state.ob4_1);
|
|
2646
|
+
var n = state.pb4_1.g1();
|
|
2647
|
+
// Inline function 'kotlin.collections.map' call
|
|
2648
|
+
var this_0 = until(1, n);
|
|
2649
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2650
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
2651
|
+
var inductionVariable = this_0.r1_1;
|
|
2652
|
+
var last = this_0.s1_1;
|
|
2653
|
+
if (inductionVariable <= last)
|
|
2654
|
+
do {
|
|
2655
|
+
var item = inductionVariable;
|
|
2656
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
2657
|
+
var absIdx = (focalIndex + item | 0) % n | 0;
|
|
2658
|
+
var tmp$ret$0 = state.pb4_1.h1(absIdx);
|
|
2659
|
+
destination.e1(tmp$ret$0);
|
|
2660
|
+
}
|
|
2661
|
+
while (!(item === last));
|
|
2662
|
+
var opponents = destination;
|
|
2663
|
+
// Inline function 'kotlin.collections.map' call
|
|
2664
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2665
|
+
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(opponents, 10));
|
|
2666
|
+
var _iterator__ex2g4s = opponents.t();
|
|
2667
|
+
while (_iterator__ex2g4s.u()) {
|
|
2668
|
+
var item_0 = _iterator__ex2g4s.v();
|
|
2669
|
+
var tmp0_elvis_lhs = state.rb4_1.v2(item_0);
|
|
2670
|
+
var played = (tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs).g1();
|
|
2671
|
+
var tmp0 = state.sb4_1;
|
|
2672
|
+
var tmp$ret$3;
|
|
2673
|
+
$l$block: {
|
|
2674
|
+
// Inline function 'kotlin.collections.count' call
|
|
2675
|
+
var tmp;
|
|
2676
|
+
if (isInterface(tmp0, Collection)) {
|
|
2677
|
+
tmp = tmp0.r();
|
|
2678
|
+
} else {
|
|
2679
|
+
tmp = false;
|
|
2680
|
+
}
|
|
2681
|
+
if (tmp) {
|
|
2682
|
+
tmp$ret$3 = 0;
|
|
2683
|
+
break $l$block;
|
|
2684
|
+
}
|
|
2685
|
+
var count = 0;
|
|
2686
|
+
var _iterator__ex2g4s_0 = tmp0.t();
|
|
2687
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
2688
|
+
var element = _iterator__ex2g4s_0.v();
|
|
2689
|
+
if (element.g8i_1 === item_0) {
|
|
2690
|
+
count = count + 1 | 0;
|
|
2691
|
+
checkCountOverflow(count);
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
tmp$ret$3 = count;
|
|
2695
|
+
}
|
|
2696
|
+
var onTable = tmp$ret$3;
|
|
2697
|
+
var tmp$ret$5 = coerceAtLeast_0((state.hb5_1 - played | 0) - onTable | 0, 0);
|
|
2698
|
+
destination_0.e1(tmp$ret$5);
|
|
2699
|
+
}
|
|
2700
|
+
var handSizes = destination_0;
|
|
2701
|
+
var allCards = buildCardLookup(Companion_getInstance_3());
|
|
2702
|
+
// Inline function 'kotlin.collections.List' call
|
|
2703
|
+
// Inline function 'kotlin.collections.MutableList' call
|
|
2704
|
+
var list = ArrayList_init_$Create$_0(worldCount);
|
|
2705
|
+
// Inline function 'kotlin.repeat' call
|
|
2706
|
+
var inductionVariable_0 = 0;
|
|
2707
|
+
if (inductionVariable_0 < worldCount)
|
|
2708
|
+
do {
|
|
2709
|
+
var index = inductionVariable_0;
|
|
2710
|
+
inductionVariable_0 = inductionVariable_0 + 1 | 0;
|
|
2711
|
+
var tmp$ret$8 = sampleOneWorld(this, state, belief, opponents, handSizes, allCards);
|
|
2712
|
+
list.e1(tmp$ret$8);
|
|
2713
|
+
}
|
|
2714
|
+
while (inductionVariable_0 < worldCount);
|
|
2715
|
+
return list;
|
|
2716
|
+
};
|
|
2717
|
+
function SampledWorld(hands) {
|
|
2718
|
+
this.zb8_1 = hands;
|
|
2719
|
+
}
|
|
2720
|
+
protoOf(SampledWorld).toString = function () {
|
|
2721
|
+
return 'SampledWorld(hands=' + toString_0(this.zb8_1) + ')';
|
|
2722
|
+
};
|
|
2723
|
+
protoOf(SampledWorld).hashCode = function () {
|
|
2724
|
+
return hashCode(this.zb8_1);
|
|
2725
|
+
};
|
|
2726
|
+
protoOf(SampledWorld).equals = function (other) {
|
|
2727
|
+
if (this === other)
|
|
2728
|
+
return true;
|
|
2729
|
+
if (!(other instanceof SampledWorld))
|
|
2730
|
+
return false;
|
|
2731
|
+
if (!equals(this.zb8_1, other.zb8_1))
|
|
2732
|
+
return false;
|
|
2733
|
+
return true;
|
|
2734
|
+
};
|
|
2735
|
+
function ln(x) {
|
|
2736
|
+
// Inline function 'kotlin.math.ln' call
|
|
2737
|
+
return Math.log(x);
|
|
2738
|
+
}
|
|
2739
|
+
function FirstLegalActionPolicy() {
|
|
2740
|
+
}
|
|
2741
|
+
protoOf(FirstLegalActionPolicy).xb6 = function (state, legalActions) {
|
|
2742
|
+
return first(legalActions);
|
|
2743
|
+
};
|
|
2744
|
+
function PimcBotPolicy_init_$Init$(pimcEngine, $this) {
|
|
2745
|
+
PimcBotPolicy.call($this, pimcEngine, new SuitSelectionPolicy());
|
|
2746
|
+
return $this;
|
|
2747
|
+
}
|
|
2748
|
+
function PimcBotPolicy_init_$Create$(pimcEngine) {
|
|
2749
|
+
return PimcBotPolicy_init_$Init$(pimcEngine, objectCreate(protoOf(PimcBotPolicy)));
|
|
2750
|
+
}
|
|
2751
|
+
function PimcBotPolicy(pimcEngine, suitSelectionPolicy) {
|
|
2752
|
+
this.mb9_1 = pimcEngine;
|
|
2753
|
+
this.nb9_1 = suitSelectionPolicy;
|
|
2754
|
+
}
|
|
2755
|
+
protoOf(PimcBotPolicy).xb6 = function (state, legalActions) {
|
|
2756
|
+
if (legalActions.g1() === 1)
|
|
2757
|
+
return first(legalActions);
|
|
2758
|
+
var tmp;
|
|
2759
|
+
var tmp$ret$0;
|
|
2760
|
+
$l$block_0: {
|
|
2761
|
+
// Inline function 'kotlin.collections.any' call
|
|
2762
|
+
var tmp_0;
|
|
2763
|
+
if (isInterface(legalActions, Collection)) {
|
|
2764
|
+
tmp_0 = legalActions.r();
|
|
2765
|
+
} else {
|
|
2766
|
+
tmp_0 = false;
|
|
2767
|
+
}
|
|
2768
|
+
if (tmp_0) {
|
|
2769
|
+
tmp$ret$0 = false;
|
|
2770
|
+
break $l$block_0;
|
|
2771
|
+
}
|
|
2772
|
+
var _iterator__ex2g4s = legalActions.t();
|
|
2773
|
+
while (_iterator__ex2g4s.u()) {
|
|
2774
|
+
var element = _iterator__ex2g4s.v();
|
|
2775
|
+
if (element instanceof PlayCard) {
|
|
2776
|
+
tmp$ret$0 = true;
|
|
2777
|
+
break $l$block_0;
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
tmp$ret$0 = false;
|
|
2781
|
+
}
|
|
2782
|
+
if (tmp$ret$0) {
|
|
2783
|
+
var scores = this.mb9_1.gb9(state, legalActions);
|
|
2784
|
+
// Inline function 'kotlin.collections.maxByOrNull' call
|
|
2785
|
+
var tmp0 = scores.m1();
|
|
2786
|
+
var tmp$ret$2;
|
|
2787
|
+
$l$block_2: {
|
|
2788
|
+
// Inline function 'kotlin.collections.maxByOrNull' call
|
|
2789
|
+
var iterator = tmp0.t();
|
|
2790
|
+
if (!iterator.u()) {
|
|
2791
|
+
tmp$ret$2 = null;
|
|
2792
|
+
break $l$block_2;
|
|
2793
|
+
}
|
|
2794
|
+
var maxElem = iterator.v();
|
|
2795
|
+
if (!iterator.u()) {
|
|
2796
|
+
tmp$ret$2 = maxElem;
|
|
2797
|
+
break $l$block_2;
|
|
2798
|
+
}
|
|
2799
|
+
var maxValue = maxElem.o1();
|
|
2800
|
+
do {
|
|
2801
|
+
var e = iterator.v();
|
|
2802
|
+
var v = e.o1();
|
|
2803
|
+
if (compareTo(maxValue, v) < 0) {
|
|
2804
|
+
maxElem = e;
|
|
2805
|
+
maxValue = v;
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
while (iterator.u());
|
|
2809
|
+
tmp$ret$2 = maxElem;
|
|
2810
|
+
}
|
|
2811
|
+
var tmp0_safe_receiver = tmp$ret$2;
|
|
2812
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.n1();
|
|
2813
|
+
tmp = tmp1_elvis_lhs == null ? first(legalActions) : tmp1_elvis_lhs;
|
|
2814
|
+
} else {
|
|
2815
|
+
var tmp$ret$6;
|
|
2816
|
+
$l$block_4: {
|
|
2817
|
+
// Inline function 'kotlin.collections.any' call
|
|
2818
|
+
var tmp_1;
|
|
2819
|
+
if (isInterface(legalActions, Collection)) {
|
|
2820
|
+
tmp_1 = legalActions.r();
|
|
2821
|
+
} else {
|
|
2822
|
+
tmp_1 = false;
|
|
2823
|
+
}
|
|
2824
|
+
if (tmp_1) {
|
|
2825
|
+
tmp$ret$6 = false;
|
|
2826
|
+
break $l$block_4;
|
|
2827
|
+
}
|
|
2828
|
+
var _iterator__ex2g4s_0 = legalActions.t();
|
|
2829
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
2830
|
+
var element_0 = _iterator__ex2g4s_0.v();
|
|
2831
|
+
if (element_0 instanceof SelectSuit) {
|
|
2832
|
+
tmp$ret$6 = true;
|
|
2833
|
+
break $l$block_4;
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
tmp$ret$6 = false;
|
|
2837
|
+
}
|
|
2838
|
+
if (tmp$ret$6) {
|
|
2839
|
+
tmp = this.nb9_1.ob9(state, legalActions);
|
|
2840
|
+
} else {
|
|
2841
|
+
var tmp$ret$8;
|
|
2842
|
+
$l$block_6: {
|
|
2843
|
+
// Inline function 'kotlin.collections.any' call
|
|
2844
|
+
var tmp_2;
|
|
2845
|
+
if (isInterface(legalActions, Collection)) {
|
|
2846
|
+
tmp_2 = legalActions.r();
|
|
2847
|
+
} else {
|
|
2848
|
+
tmp_2 = false;
|
|
2849
|
+
}
|
|
2850
|
+
if (tmp_2) {
|
|
2851
|
+
tmp$ret$8 = false;
|
|
2852
|
+
break $l$block_6;
|
|
2853
|
+
}
|
|
2854
|
+
var _iterator__ex2g4s_1 = legalActions.t();
|
|
2855
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
2856
|
+
var element_1 = _iterator__ex2g4s_1.v();
|
|
2857
|
+
if (element_1 instanceof AcceptCombinations) {
|
|
2858
|
+
tmp$ret$8 = true;
|
|
2859
|
+
break $l$block_6;
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
tmp$ret$8 = false;
|
|
2863
|
+
}
|
|
2864
|
+
if (tmp$ret$8) {
|
|
2865
|
+
var tmp$ret$11;
|
|
2866
|
+
$l$block_7: {
|
|
2867
|
+
// Inline function 'kotlin.collections.firstOrNull' call
|
|
2868
|
+
var _iterator__ex2g4s_2 = legalActions.t();
|
|
2869
|
+
while (_iterator__ex2g4s_2.u()) {
|
|
2870
|
+
var element_2 = _iterator__ex2g4s_2.v();
|
|
2871
|
+
var tmp_3;
|
|
2872
|
+
if (element_2 instanceof AcceptCombinations) {
|
|
2873
|
+
tmp_3 = element_2.nb4_1;
|
|
2874
|
+
} else {
|
|
2875
|
+
tmp_3 = false;
|
|
2876
|
+
}
|
|
2877
|
+
if (tmp_3) {
|
|
2878
|
+
tmp$ret$11 = element_2;
|
|
2879
|
+
break $l$block_7;
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
tmp$ret$11 = null;
|
|
2883
|
+
}
|
|
2884
|
+
var tmp2_elvis_lhs = tmp$ret$11;
|
|
2885
|
+
tmp = tmp2_elvis_lhs == null ? first(legalActions) : tmp2_elvis_lhs;
|
|
2886
|
+
} else {
|
|
2887
|
+
tmp = first(legalActions);
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
return tmp;
|
|
2892
|
+
};
|
|
2893
|
+
function selectLead($this, legalCards, trump) {
|
|
2894
|
+
// Inline function 'kotlin.collections.filter' call
|
|
2895
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
2896
|
+
var destination = ArrayList_init_$Create$();
|
|
2897
|
+
var _iterator__ex2g4s = legalCards.t();
|
|
2898
|
+
while (_iterator__ex2g4s.u()) {
|
|
2899
|
+
var element = _iterator__ex2g4s.v();
|
|
2900
|
+
if (element.m().equals(CardName_ACE_getInstance()) && !element.u6k().equals(trump)) {
|
|
2901
|
+
destination.e1(element);
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
var nonTrumpAces = destination;
|
|
2905
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
2906
|
+
if (!nonTrumpAces.r())
|
|
2907
|
+
return first(nonTrumpAces);
|
|
2908
|
+
// Inline function 'kotlin.collections.filter' call
|
|
2909
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
2910
|
+
var destination_0 = ArrayList_init_$Create$();
|
|
2911
|
+
var _iterator__ex2g4s_0 = legalCards.t();
|
|
2912
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
2913
|
+
var element_0 = _iterator__ex2g4s_0.v();
|
|
2914
|
+
if (element_0.m().equals(CardName_TEN_getInstance()) && !element_0.u6k().equals(trump)) {
|
|
2915
|
+
destination_0.e1(element_0);
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
var nonTrumpTens = destination_0;
|
|
2919
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
2920
|
+
if (!nonTrumpTens.r())
|
|
2921
|
+
return first(nonTrumpTens);
|
|
2922
|
+
// Inline function 'kotlin.collections.filter' call
|
|
2923
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
2924
|
+
var destination_1 = ArrayList_init_$Create$();
|
|
2925
|
+
var _iterator__ex2g4s_1 = legalCards.t();
|
|
2926
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
2927
|
+
var element_1 = _iterator__ex2g4s_1.v();
|
|
2928
|
+
if (!element_1.u6k().equals(trump)) {
|
|
2929
|
+
destination_1.e1(element_1);
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
var nonTrump = destination_1;
|
|
2933
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
2934
|
+
if (!nonTrump.r()) {
|
|
2935
|
+
var tmp$ret$12;
|
|
2936
|
+
$l$block_0: {
|
|
2937
|
+
// Inline function 'kotlin.collections.maxByOrNull' call
|
|
2938
|
+
var iterator = nonTrump.t();
|
|
2939
|
+
if (!iterator.u()) {
|
|
2940
|
+
tmp$ret$12 = null;
|
|
2941
|
+
break $l$block_0;
|
|
2942
|
+
}
|
|
2943
|
+
var maxElem = iterator.v();
|
|
2944
|
+
if (!iterator.u()) {
|
|
2945
|
+
tmp$ret$12 = maxElem;
|
|
2946
|
+
break $l$block_0;
|
|
2947
|
+
}
|
|
2948
|
+
var it = maxElem;
|
|
2949
|
+
var maxValue = getPoint(it, trump);
|
|
2950
|
+
do {
|
|
2951
|
+
var e = iterator.v();
|
|
2952
|
+
var v = getPoint(e, trump);
|
|
2953
|
+
if (compareTo(maxValue, v) < 0) {
|
|
2954
|
+
maxElem = e;
|
|
2955
|
+
maxValue = v;
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
while (iterator.u());
|
|
2959
|
+
tmp$ret$12 = maxElem;
|
|
2960
|
+
}
|
|
2961
|
+
var tmp0_elvis_lhs = tmp$ret$12;
|
|
2962
|
+
return tmp0_elvis_lhs == null ? first(nonTrump) : tmp0_elvis_lhs;
|
|
2963
|
+
}
|
|
2964
|
+
var tmp$ret$15;
|
|
2965
|
+
$l$block_2: {
|
|
2966
|
+
// Inline function 'kotlin.collections.maxByOrNull' call
|
|
2967
|
+
var iterator_0 = legalCards.t();
|
|
2968
|
+
if (!iterator_0.u()) {
|
|
2969
|
+
tmp$ret$15 = null;
|
|
2970
|
+
break $l$block_2;
|
|
2971
|
+
}
|
|
2972
|
+
var maxElem_0 = iterator_0.v();
|
|
2973
|
+
if (!iterator_0.u()) {
|
|
2974
|
+
tmp$ret$15 = maxElem_0;
|
|
2975
|
+
break $l$block_2;
|
|
2976
|
+
}
|
|
2977
|
+
var it_0 = maxElem_0;
|
|
2978
|
+
var maxValue_0 = getGrowth(it_0, trump, trump);
|
|
2979
|
+
do {
|
|
2980
|
+
var e_0 = iterator_0.v();
|
|
2981
|
+
var v_0 = getGrowth(e_0, trump, trump);
|
|
2982
|
+
if (compareTo(maxValue_0, v_0) < 0) {
|
|
2983
|
+
maxElem_0 = e_0;
|
|
2984
|
+
maxValue_0 = v_0;
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
while (iterator_0.u());
|
|
2988
|
+
tmp$ret$15 = maxElem_0;
|
|
2989
|
+
}
|
|
2990
|
+
var tmp1_elvis_lhs = tmp$ret$15;
|
|
2991
|
+
return tmp1_elvis_lhs == null ? first(legalCards) : tmp1_elvis_lhs;
|
|
2992
|
+
}
|
|
2993
|
+
function selectFollow($this, legalCards, currentTrick, trump, partnerWinning) {
|
|
2994
|
+
var firstSuit = first(currentTrick).hb8_1.u6k();
|
|
2995
|
+
if (partnerWinning) {
|
|
2996
|
+
var tmp$ret$0;
|
|
2997
|
+
$l$block_0: {
|
|
2998
|
+
// Inline function 'kotlin.collections.minByOrNull' call
|
|
2999
|
+
var iterator = legalCards.t();
|
|
3000
|
+
if (!iterator.u()) {
|
|
3001
|
+
tmp$ret$0 = null;
|
|
3002
|
+
break $l$block_0;
|
|
3003
|
+
}
|
|
3004
|
+
var minElem = iterator.v();
|
|
3005
|
+
if (!iterator.u()) {
|
|
3006
|
+
tmp$ret$0 = minElem;
|
|
3007
|
+
break $l$block_0;
|
|
3008
|
+
}
|
|
3009
|
+
var it = minElem;
|
|
3010
|
+
var minValue = getGrowth(it, trump, firstSuit);
|
|
3011
|
+
do {
|
|
3012
|
+
var e = iterator.v();
|
|
3013
|
+
var v = getGrowth(e, trump, firstSuit);
|
|
3014
|
+
if (compareTo(minValue, v) > 0) {
|
|
3015
|
+
minElem = e;
|
|
3016
|
+
minValue = v;
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
while (iterator.u());
|
|
3020
|
+
tmp$ret$0 = minElem;
|
|
3021
|
+
}
|
|
3022
|
+
var tmp0_elvis_lhs = tmp$ret$0;
|
|
3023
|
+
return tmp0_elvis_lhs == null ? first(legalCards) : tmp0_elvis_lhs;
|
|
3024
|
+
}
|
|
3025
|
+
// Inline function 'kotlin.collections.maxOf' call
|
|
3026
|
+
var iterator_0 = currentTrick.t();
|
|
3027
|
+
if (!iterator_0.u())
|
|
3028
|
+
throw NoSuchElementException_init_$Create$();
|
|
3029
|
+
var it_0 = iterator_0.v();
|
|
3030
|
+
var maxValue = getGrowth(it_0.hb8_1, trump, firstSuit);
|
|
3031
|
+
while (iterator_0.u()) {
|
|
3032
|
+
var it_1 = iterator_0.v();
|
|
3033
|
+
var v_0 = getGrowth(it_1.hb8_1, trump, firstSuit);
|
|
3034
|
+
if (compareTo(maxValue, v_0) < 0) {
|
|
3035
|
+
maxValue = v_0;
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
var currentBest = maxValue;
|
|
3039
|
+
// Inline function 'kotlin.collections.filter' call
|
|
3040
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
3041
|
+
var destination = ArrayList_init_$Create$();
|
|
3042
|
+
var _iterator__ex2g4s = legalCards.t();
|
|
3043
|
+
while (_iterator__ex2g4s.u()) {
|
|
3044
|
+
var element = _iterator__ex2g4s.v();
|
|
3045
|
+
if (getGrowth(element, trump, firstSuit) > currentBest) {
|
|
3046
|
+
destination.e1(element);
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
var winners = destination;
|
|
3050
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
3051
|
+
if (!winners.r()) {
|
|
3052
|
+
var tmp$ret$10;
|
|
3053
|
+
$l$block_2: {
|
|
3054
|
+
// Inline function 'kotlin.collections.maxByOrNull' call
|
|
3055
|
+
var iterator_1 = winners.t();
|
|
3056
|
+
if (!iterator_1.u()) {
|
|
3057
|
+
tmp$ret$10 = null;
|
|
3058
|
+
break $l$block_2;
|
|
3059
|
+
}
|
|
3060
|
+
var maxElem = iterator_1.v();
|
|
3061
|
+
if (!iterator_1.u()) {
|
|
3062
|
+
tmp$ret$10 = maxElem;
|
|
3063
|
+
break $l$block_2;
|
|
3064
|
+
}
|
|
3065
|
+
var it_2 = maxElem;
|
|
3066
|
+
var maxValue_0 = getPoint(it_2, trump);
|
|
3067
|
+
do {
|
|
3068
|
+
var e_0 = iterator_1.v();
|
|
3069
|
+
var v_1 = getPoint(e_0, trump);
|
|
3070
|
+
if (compareTo(maxValue_0, v_1) < 0) {
|
|
3071
|
+
maxElem = e_0;
|
|
3072
|
+
maxValue_0 = v_1;
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
while (iterator_1.u());
|
|
3076
|
+
tmp$ret$10 = maxElem;
|
|
3077
|
+
}
|
|
3078
|
+
var tmp1_elvis_lhs = tmp$ret$10;
|
|
3079
|
+
return tmp1_elvis_lhs == null ? first(winners) : tmp1_elvis_lhs;
|
|
3080
|
+
}
|
|
3081
|
+
var tmp$ret$13;
|
|
3082
|
+
$l$block_4: {
|
|
3083
|
+
// Inline function 'kotlin.collections.minByOrNull' call
|
|
3084
|
+
var iterator_2 = legalCards.t();
|
|
3085
|
+
if (!iterator_2.u()) {
|
|
3086
|
+
tmp$ret$13 = null;
|
|
3087
|
+
break $l$block_4;
|
|
3088
|
+
}
|
|
3089
|
+
var minElem_0 = iterator_2.v();
|
|
3090
|
+
if (!iterator_2.u()) {
|
|
3091
|
+
tmp$ret$13 = minElem_0;
|
|
3092
|
+
break $l$block_4;
|
|
3093
|
+
}
|
|
3094
|
+
var it_3 = minElem_0;
|
|
3095
|
+
var minValue_0 = getPoint(it_3, trump);
|
|
3096
|
+
do {
|
|
3097
|
+
var e_1 = iterator_2.v();
|
|
3098
|
+
var v_2 = getPoint(e_1, trump);
|
|
3099
|
+
if (compareTo(minValue_0, v_2) > 0) {
|
|
3100
|
+
minElem_0 = e_1;
|
|
3101
|
+
minValue_0 = v_2;
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
while (iterator_2.u());
|
|
3105
|
+
tmp$ret$13 = minElem_0;
|
|
3106
|
+
}
|
|
3107
|
+
var tmp2_elvis_lhs = tmp$ret$13;
|
|
3108
|
+
return tmp2_elvis_lhs == null ? first(legalCards) : tmp2_elvis_lhs;
|
|
3109
|
+
}
|
|
3110
|
+
function RolloutPolicy() {
|
|
3111
|
+
}
|
|
3112
|
+
protoOf(RolloutPolicy).lb8 = function (hand, legalCards, currentTrick, trump, partnerPlayerId, partnerWinning) {
|
|
3113
|
+
if (legalCards.g1() === 1)
|
|
3114
|
+
return first(legalCards);
|
|
3115
|
+
var tmp;
|
|
3116
|
+
if (currentTrick.r()) {
|
|
3117
|
+
tmp = selectLead(this, legalCards, trump);
|
|
3118
|
+
} else {
|
|
3119
|
+
tmp = selectFollow(this, legalCards, currentTrick, trump, partnerWinning);
|
|
3120
|
+
}
|
|
3121
|
+
return tmp;
|
|
3122
|
+
};
|
|
3123
|
+
function computeEhv($this, cards, trump) {
|
|
3124
|
+
// Inline function 'kotlin.collections.sumOf' call
|
|
3125
|
+
var sum = 0;
|
|
3126
|
+
var _iterator__ex2g4s = cards.t();
|
|
3127
|
+
while (_iterator__ex2g4s.u()) {
|
|
3128
|
+
var element = _iterator__ex2g4s.v();
|
|
3129
|
+
var tmp = sum;
|
|
3130
|
+
sum = tmp + getValueInHand(element, trump, cards) | 0;
|
|
3131
|
+
}
|
|
3132
|
+
return sum;
|
|
3133
|
+
}
|
|
3134
|
+
function getThresholds($this, mode) {
|
|
3135
|
+
switch (mode.a1_1) {
|
|
3136
|
+
case 0:
|
|
3137
|
+
return to(45, 35);
|
|
3138
|
+
case 3:
|
|
3139
|
+
return to(35, 25);
|
|
3140
|
+
default:
|
|
3141
|
+
return to(40, 30);
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
function SuitSelectionPolicy() {
|
|
3145
|
+
}
|
|
3146
|
+
protoOf(SuitSelectionPolicy).ob9 = function (state, legalActions) {
|
|
3147
|
+
// Inline function 'kotlin.collections.filterIsInstance' call
|
|
3148
|
+
// Inline function 'kotlin.collections.filterIsInstanceTo' call
|
|
3149
|
+
var destination = ArrayList_init_$Create$();
|
|
3150
|
+
var _iterator__ex2g4s = legalActions.t();
|
|
3151
|
+
while (_iterator__ex2g4s.u()) {
|
|
3152
|
+
var element = _iterator__ex2g4s.v();
|
|
3153
|
+
if (element instanceof SelectSuit) {
|
|
3154
|
+
destination.e1(element);
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
var suitActions = destination;
|
|
3158
|
+
if (suitActions.g1() <= 1) {
|
|
3159
|
+
var tmp0_elvis_lhs = firstOrNull(suitActions);
|
|
3160
|
+
return tmp0_elvis_lhs == null ? first(legalActions) : tmp0_elvis_lhs;
|
|
3161
|
+
}
|
|
3162
|
+
var tmp$ret$3;
|
|
3163
|
+
$l$block: {
|
|
3164
|
+
// Inline function 'kotlin.collections.firstOrNull' call
|
|
3165
|
+
var _iterator__ex2g4s_0 = suitActions.t();
|
|
3166
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
3167
|
+
var element_0 = _iterator__ex2g4s_0.v();
|
|
3168
|
+
if (element_0.mb4_1 == null) {
|
|
3169
|
+
tmp$ret$3 = element_0;
|
|
3170
|
+
break $l$block;
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
tmp$ret$3 = null;
|
|
3174
|
+
}
|
|
3175
|
+
var passAction = tmp$ret$3;
|
|
3176
|
+
// Inline function 'kotlin.collections.filter' call
|
|
3177
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
3178
|
+
var destination_0 = ArrayList_init_$Create$();
|
|
3179
|
+
var _iterator__ex2g4s_1 = suitActions.t();
|
|
3180
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
3181
|
+
var element_1 = _iterator__ex2g4s_1.v();
|
|
3182
|
+
if (!(element_1.mb4_1 == null)) {
|
|
3183
|
+
destination_0.e1(element_1);
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
var declareActions = destination_0;
|
|
3187
|
+
if (declareActions.r()) {
|
|
3188
|
+
return passAction == null ? first(suitActions) : passAction;
|
|
3189
|
+
}
|
|
3190
|
+
var tmp;
|
|
3191
|
+
if (state.wb4_1.r()) {
|
|
3192
|
+
tmp = 1;
|
|
3193
|
+
} else {
|
|
3194
|
+
var tmp0 = state.wb4_1;
|
|
3195
|
+
var tmp$ret$7;
|
|
3196
|
+
$l$block_0: {
|
|
3197
|
+
// Inline function 'kotlin.collections.maxOfOrNull' call
|
|
3198
|
+
var iterator = tmp0.t();
|
|
3199
|
+
if (!iterator.u()) {
|
|
3200
|
+
tmp$ret$7 = null;
|
|
3201
|
+
break $l$block_0;
|
|
3202
|
+
}
|
|
3203
|
+
var maxValue = iterator.v().wb5_1;
|
|
3204
|
+
while (iterator.u()) {
|
|
3205
|
+
var v = iterator.v().wb5_1;
|
|
3206
|
+
if (compareTo(maxValue, v) < 0) {
|
|
3207
|
+
maxValue = v;
|
|
3208
|
+
}
|
|
3209
|
+
}
|
|
3210
|
+
tmp$ret$7 = maxValue;
|
|
3211
|
+
}
|
|
3212
|
+
var tmp2_elvis_lhs = tmp$ret$7;
|
|
3213
|
+
tmp = tmp2_elvis_lhs == null ? 1 : tmp2_elvis_lhs;
|
|
3214
|
+
}
|
|
3215
|
+
var circle = tmp;
|
|
3216
|
+
var thresholds = getThresholds(this, state.gb5_1);
|
|
3217
|
+
var threshold = circle <= 1 ? thresholds.first : thresholds.second;
|
|
3218
|
+
var bestSuit = null;
|
|
3219
|
+
var bestEhv = 0;
|
|
3220
|
+
var _iterator__ex2g4s_2 = declareActions.t();
|
|
3221
|
+
$l$loop: while (_iterator__ex2g4s_2.u()) {
|
|
3222
|
+
var action = _iterator__ex2g4s_2.v();
|
|
3223
|
+
var tmp3_elvis_lhs = action.mb4_1;
|
|
3224
|
+
var tmp_0;
|
|
3225
|
+
if (tmp3_elvis_lhs == null) {
|
|
3226
|
+
continue $l$loop;
|
|
3227
|
+
} else {
|
|
3228
|
+
tmp_0 = tmp3_elvis_lhs;
|
|
3229
|
+
}
|
|
3230
|
+
var suit = tmp_0;
|
|
3231
|
+
var ehv = computeEhv(this, state.qb4_1, suit);
|
|
3232
|
+
var tmp4_safe_receiver = state.ub4_1;
|
|
3233
|
+
var tmp_1;
|
|
3234
|
+
if (tmp4_safe_receiver == null) {
|
|
3235
|
+
tmp_1 = null;
|
|
3236
|
+
} else {
|
|
3237
|
+
// Inline function 'kotlin.let' call
|
|
3238
|
+
tmp_1 = tmp4_safe_receiver.u6k().equals(suit) ? getPoint(tmp4_safe_receiver, suit) : 0;
|
|
3239
|
+
}
|
|
3240
|
+
var tmp5_elvis_lhs = tmp_1;
|
|
3241
|
+
var trumpBonus = tmp5_elvis_lhs == null ? 0 : tmp5_elvis_lhs;
|
|
3242
|
+
var totalEhv = ehv + trumpBonus | 0;
|
|
3243
|
+
if (totalEhv > bestEhv) {
|
|
3244
|
+
bestEhv = totalEhv;
|
|
3245
|
+
bestSuit = suit;
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
var tmp_2;
|
|
3249
|
+
if (bestEhv >= threshold && !(bestSuit == null)) {
|
|
3250
|
+
tmp_2 = new SelectSuit(bestSuit);
|
|
3251
|
+
} else {
|
|
3252
|
+
tmp_2 = passAction == null ? new SelectSuit(bestSuit) : passAction;
|
|
3253
|
+
}
|
|
3254
|
+
return tmp_2;
|
|
3255
|
+
};
|
|
3256
|
+
//region block: init
|
|
3257
|
+
Companion_instance_1 = new Companion();
|
|
3258
|
+
CardLocationIndex_instance = new CardLocationIndex();
|
|
3259
|
+
Companion_instance_2 = new Companion_0();
|
|
3260
|
+
Companion_instance_3 = new Companion_1();
|
|
3261
|
+
Companion_instance_4 = new Companion_2();
|
|
3262
|
+
MoveScoreAggregator_instance = new MoveScoreAggregator();
|
|
3263
|
+
TrickSimulator_instance = new TrickSimulator();
|
|
3264
|
+
//endregion
|
|
3265
|
+
//region block: exports
|
|
3266
|
+
_.$_$ = _.$_$ || {};
|
|
3267
|
+
_.$_$.a = BotModelConfig;
|
|
3268
|
+
_.$_$.b = BotModelRegistry;
|
|
3269
|
+
_.$_$.c = PimcBotAnswerProvider;
|
|
3270
|
+
//endregion
|
|
3271
|
+
return _;
|
|
3272
|
+
}));
|
|
3273
|
+
|
|
3274
|
+
//# sourceMappingURL=Logic_Debertz-bot_engine.js.map
|