예측출력

2026년 5월 14일 09:30분

민수기 24장에서 발람은 미래 왕의 별을 예언합니다. 현재 상태를 입력받아 미래 결과를 예측합니다. 나는 예언 조건을 입력받아 예측 텍스트를 출력하는 오라클을 만들었습니다.

package com.jesusbornd.numbers;
import java.util.List;

public class Numbers_24_Chapter_Lv3 {
    record Condition(String name, boolean met) {}

    static String oracle(List<Condition> conditions) {
        long metCount = conditions.stream().filter(Condition::met).count();
        return switch ((int) metCount) {
            case 3  -> "⭐ 왕이 일어날 것이다 — 강한 예언";
            case 2  -> "🌤 부흥의 조짐이 있다 — 중간 예언";
            default -> "🌧 아직 때가 아니다 — 약한 예언";
        };
    }

    public static void main(String[] args) {
        System.out.println(oracle(List.of(
            new Condition("군사력", true),
            new Condition("통일",   true),
            new Condition("기름부음", true)
        )));
        System.out.println(oracle(List.of(
            new Condition("군사력", true),
            new Condition("통일",   false),
            new Condition("기름부음", true)
        )));
    }
}

def oracle(conditions: dict[str, bool]) -> str:
    count = sum(conditions.values())
    if count == 3:   return "⭐ 왕이 일어날 것이다 — 강한 예언"
    elif count == 2: return "🌤 부흥의 조짐이 있다 — 중간 예언"
    else:            return "🌧 아직 때가 아니다 — 약한 예언"

if __name__ == "__main__":
    print(oracle({"군사력": True, "통일": True, "기름부음": True}))
    print(oracle({"군사력": True, "통일": False, "기름부음": True}))

Comments

Avatar
 2026년 5월 14일 13:01분

현재 단서에서 미래를 예측하는 흐름이 재미있었어요.



Search

← 목록으로