Support import Dalmax Men's Morris move list

This commit is contained in:
Calcitem 2021-07-22 01:21:49 +08:00
parent cacbe6198b
commit b20b21793e
No known key found for this signature in database
GPG Key ID: F2F7C29E054CFB80
1 changed files with 16 additions and 0 deletions

View File

@ -126,6 +126,14 @@ class GameRecorder {
return "";
}
bool isDalmaxMoveList(String text) {
if (text.length >= 15 && text.substring(0, 14) == "[Event \"Dalmax") {
return true;
}
return false;
}
bool isPlayOkMoveList(String text) {
if (text.length >= 4 &&
text.substring(0, 3) == "1. " &&
@ -153,6 +161,10 @@ class GameRecorder {
}
String import(String moveList) {
if (isDalmaxMoveList(moveList)) {
return importDalmax(moveList);
}
if (isPlayOkMoveList(moveList)) {
return importPlayOk(moveList);
}
@ -244,6 +256,10 @@ class GameRecorder {
return "";
}
String importDalmax(String moveList) {
return import(moveList.substring(moveList.indexOf("1. ")));
}
String importPlayOk(String moveList) {
List<Move> newHistory = [];