# ─────────────────────────────────────────────────────────────────────────────
# Magic 8 Ball Demo — Python 3
# Cross Training: Conditional Logic (if/else)
# Based on chooseMessageType() from Magic8Ball2026-07-05-Stg6
# ─────────────────────────────────────────────────────────────────────────────

import random  # random must be imported — it is a module, not a built-in

# Probability weights — must sum to 1.0
PROB_POSITIVE = 0.35   # 35%
PROB_NEGATIVE = 0.35   # 35%
PROB_VAGUE    = 0.20   # 20%
# snarky = remaining 10%


def choose_message_type(roll):
    cutoff1 = PROB_POSITIVE                      # 0.35
    cutoff2 = PROB_POSITIVE + PROB_NEGATIVE      # 0.70
    cutoff3 = cutoff2 + PROB_VAGUE               # 0.90

    if roll <= cutoff1:
        return "positive"
    elif roll <= cutoff2:      # Python: elif, not else if
        return "negative"
    elif roll <= cutoff3:
        return "vague"
    else:
        return "snarky"        # remaining 10%
# end choose_message_type


def main():
    roll = random.random()     # 0.0 (inclusive) to 1.0 (exclusive)
    msg_type = choose_message_type(roll)
    print(f"Roll: {roll:.3f} => {msg_type}")
# end main


if __name__ == "__main__":
    main()
