강적제압
2026년 6월 4일 09:30분
신명기 3장에서 이스라엘은 시혼과 옥이라는 두 강적 왕을 차례로 제압합니다. 전력 비교 후 약점을 찾아 공략합니다. 나는 전투력을 비교하고 전략적 우위를 판단하는 전투 평가기를 만들었습니다.
package com.jesusbornd.deuteronomy;
public class Deuteronomy_03_Chapter_Lv1 {
record Army(String name, int size, int fortresses, boolean hasGiants) {}
static void battle(Army attacker, Army defender) {
int score = Integer.compare(attacker.size(), defender.size())
+ Integer.compare(0, defender.fortresses())
+ (defender.hasGiants() ? -1 : 1);
String result = score >= 0 ? "✅ " + attacker.name() + " 승리"
: "❌ " + attacker.name() + " 패배";
System.out.printf("vs %s → %s%n", defender.name(), result);
}
public static void main(String[] args) {
var israel = new Army("이스라엘", 600_000, 0, false);
battle(israel, new Army("시혼", 200_000, 60, false));
battle(israel, new Army("옥", 300_000, 60, true));
}
}
def battle(att_name, att_size, def_name, def_size, def_forts, def_giants):
score = (att_size > def_size) - (att_size < def_size) - (1 if def_giants else 0)
result = f"✅ {att_name} 승리" if score >= 0 else f"❌ {att_name} 패배"
print(f"vs {def_name} → {result}")
if __name__ == "__main__":
battle("이스라엘", 600_000, "시혼", 200_000, 60, False)
battle("이스라엘", 600_000, "옥", 300_000, 60, True)
Search
Categories
← 목록으로
Comments
수치로 비교했을 때 승패가 먼저 보이는군요.