remove duplicate code for inferring AI name

master
melvin 2013-04-16 10:59:31 +08:00
parent da3ec6b8d3
commit 6b2755bfb9
1 changed files with 7 additions and 19 deletions

View File

@ -2,7 +2,7 @@ BEGIN {
FS = "\t"
}
/index=0/ {
function genName() {
name = "UNKNOWN"
if ($0 ~ /MMAB/) {
name = "MMAB"
@ -19,27 +19,15 @@ BEGIN {
cheat = "H"
}
ai1 = name "-" cheat
return name "-" cheat
}
/index=0/ {
ai1 = genName()
}
/index=1/ {
name = "UNKNOWN"
if ($0 ~ /MMAB/) {
name = "MMAB"
} else if ($0 ~ /VEGAS/) {
name = "VEGAS"
} else if ($0 ~ /MCTS/) {
name = "MCTS"
}
cheat = "?"
if ($0 ~ /cheat=true/) {
cheat = "C"
} else if ($0 ~ /cheat=false/) {
cheat = "H"
}
ai2 = name "-" cheat
ai2 = genName()
}
/Saved Player/ {