This commit is contained in:
sirjonasxx 2020-11-09 02:22:26 +01:00
parent eb079b92e3
commit d5a3783a1d

View File

@ -46,17 +46,11 @@ public class StructurePredictor {
for (TypeChecker typeChecker : typeCheckers) {
if (!typeChecker.canRead(index)) continue;
double score = typeChecker.score(index);
double newScore = currentLogScore + Math.log(score);
double newScore = currentLogScore + Math.log(typeChecker.score(index));
int nextIndex = typeChecker.nextIndex(index) - 6;
if (dynamic[nextIndex] == null || newScore > dynamic[nextIndex].logScore) {
dynamic[nextIndex] = new SubStructure(
index - 6,
typeChecker.getStructCode(),
newScore
);
dynamic[nextIndex] = new SubStructure(index - 6, typeChecker.getStructCode(), newScore);
}
}
index++;
}
@ -81,39 +75,4 @@ public class StructurePredictor {
public String getStructure() {
return structure;
}
public static void main(String[] args) {
HPacket[] packets = new HPacket[] {
new HPacket("{l}{u:500}{i:20}"),
new HPacket(4002, "test"),
new HPacket(4002, "test", 0, true),
new HPacket(4002, "test", "testtsd", 54452, true, false),
new HPacket(4002, "test", 46564554, "testtsd", 54452, true, false),
new HPacket(4002, "test", 0, 46564554, "testtsd", 54452, true, false),
new HPacket(4002, -1, "test", 0, 46564554, "testtsd", -1, 54452, true, false),
new HPacket(4002, -1, "test", 0, 46564554, "testtsd", -1, 54452, false, true, ""),
new HPacket(4002, -1, "test", 0, 46564554, "testtsd", -1, 54452, false, true, ""),
new HPacket(4002, -1, "test", 0, 46564554, "testtsd", -1, 54452, false, true, 0),
new HPacket(4002, -1, (byte) 5, "test", 0, 46564554, "testtsd", -1, 54452, false, true, 0),
new HPacket(4002, "", 20, 0),
new HPacket(4002, 1),
new HPacket(4002, 0, 0),
new HPacket(4002, 0, 0, 42, false),
new HPacket(4002, 0, ""),
new HPacket("[0][0][0]F[0] [0][0][0] [0][0][0][5][0]\u0013ACH_FriendListSize5[0][0][0]U[0][0][0] [0][0][0][0][0][0][0][0][0][0][0]Z[0][0][6]social[0][0][0][0][0][13][0][0][0][2]"),
new HPacket("[0][0][0]?[0] [0][0][0][4][0][0][0][4][0][10]ACH_Login4[0][0][0]\u000F[0][0][0]\u001C[0][0][0][0][0][0][0][0][0][0][0][2][0][0][8]identity[0][0][0][0][0]\u0014[0][0][0][0]"),
new HPacket("[0][0][0][6]\u000Ew[0][0][0][0]"),
new HPacket("[0][0][0]'[3] [0][5]Login[0][6]socket[0]\u000Eclient.auth_ok[0][0][0][0][0][0]"),
new HPacket(4002, false, ""),
new HPacket("{l}{u:145}[0][0][0]ÿÿÿÿ[0]"),
// new HPacket("[0][0][1]p[13]1[0][0][0][12][0][10]MOUSE_ZOOM[0][0][1][0]\u0015HABBO_CLUB_OFFER_BETA[0][0][1][0]\u000EUSE_GUIDE_TOOL[0]&requirement.unfulfilled.helper_level_4[0][0]\u000FBUILDER_AT_WORK[0](requirement.unfulfilled.group_membership[0][0]\u000FCALL_ON_HELPERS[0][0][1][0]\u001FNAVIGATOR_ROOM_THUMBNAIL_CAMERA[0][0][1][0][7]CITIZEN[0][0][1][0]\u0012JUDGE_CHAT_REVIEWS[0]&requirement.unfulfilled.helper_level_6[0][0][5]TRADE[0][0][1][0][6]CAMERA[0][0][1][0]\u0014VOTE_IN_COMPETITIONS[0][0][1][0]\u0018NAVIGATOR_PHASE_TWO_2014[0][0][1]")
};
for (HPacket packet : packets) {
StructurePredictor structurePredictor = new StructurePredictor(packet);
System.out.println(structurePredictor.getStructure());
System.out.println(structurePredictor.getExpression());
}
}
}