Skip to content

Commit

Permalink
fix: small error fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Scoppio committed Feb 9, 2025
1 parent 7ba5a3a commit 1d6c24b
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 4 deletions.
2 changes: 1 addition & 1 deletion megamek/src/megamek/ai/dataset/DatasetParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private UnitAction parseActionLine(String actionLine) {
highestEntityId = unitAction.id();
}
return unitAction;
} catch (NumberFormatException e) {
} catch (Exception e) {
throw new RuntimeException("Error parsing action line: " + actionLine, e);
}
}
Expand Down
13 changes: 13 additions & 0 deletions megamek/src/megamek/ai/dataset/TrainingDataset.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/*
* MegaMek - Copyright (C) 2000-2002 Ben Mazur (bmazur@sev.org)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
package megamek.ai.dataset;

import java.util.*;
Expand Down
13 changes: 13 additions & 0 deletions megamek/src/megamek/ai/dataset/TsvSerde.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/*
* MegaMek - Copyright (C) 2000-2002 Ben Mazur (bmazur@sev.org)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
package megamek.ai.dataset;

public abstract class TsvSerde<T> {
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/ai/dataset/UnitActionSerde.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public String toTsv(UnitAction obj) {
return String.join("\t", row);
}

public UnitAction fromTsv(String line, int idOffset) {
public UnitAction fromTsv(String line, int idOffset) throws NumberFormatException {
String[] parts = line.split("\t", -1);
int entityId = Integer.parseInt(parts[UnitActionField.ENTITY_ID.ordinal()]) + idOffset;
int playerId = Integer.parseInt(parts[UnitActionField.PLAYER_ID.ordinal()]);
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/ai/dataset/UnitStateSerde.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public String toTsv(UnitState obj) {
return String.join("\t", row);
}

public UnitState fromTsv(String line, Map<Integer, Entity> entities, int idOffset) {
public UnitState fromTsv(String line, Map<Integer, Entity> entities, int idOffset) throws NumberFormatException {
String[] parts = line.split("\t", -1);

int id = Integer.parseInt(parts[UnitStateField.ENTITY_ID.ordinal()]) + idOffset;
Expand Down
13 changes: 13 additions & 0 deletions megamek/src/megamek/ai/optimizer/CostFunctionChooser.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/*
* MegaMek - Copyright (C) 2000-2002 Ben Mazur (bmazur@sev.org)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
package megamek.ai.optimizer;

import megamek.client.bot.princess.CardinalEdge;
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/GameDatasetLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private void append(Game game, AbstractAttackAction attackAction, boolean withHe
if (attackAction == null) {
return;
}
String currentRound = game.getPhase().name();
String currentRound = game.getCurrentRound() + "";
String entityId = "-1";
String playerId = "-1";
String type;
Expand Down

0 comments on commit 1d6c24b

Please sign in to comment.