도시방어
2026년 9월 28일 09:30분
사무엘상 23장에서 다윗은 그일라 사람들을 블레셋으로부터 구출합니다. 방어 로직은 위협 수준에 따라 자원을 배분합니다. 나는 위협 기반 방어 자원 배분 함수를 구현했습니다.
package com.jesusbornd.samuel1;
import java.util.List;
public class Samuel1_23_Chapter_Lv3 {
record Threat(String city, int level) {}
static void defend(List<Threat> threats) {
threats.stream()
.filter(t -> t.level() >= 7)
.forEach(t -> System.out.printf(
"🛡️ %s 방어 출동 (위협 수준: %d)%n", t.city(), t.level()));
}
public static void main(String[] args) {
defend(List.of(new Threat("그일라", 9), new Threat("스일", 4)));
}
}
threats = [("그일라", 9), ("스일", 4)]
for city, level in threats:
if level >= 7:
print(f"🛡️ {city} 방어 출동 (위협 수준: {level})")
Search
Categories
← 목록으로
Comments
도시를 구한 자가 도시에게 배신당할 수도 있습니다.