Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.5
rev: v0.16.0
hooks:
- id: ruff # Run the linter.
args: [ --fix ]
Expand Down
3 changes: 2 additions & 1 deletion src/main/python/mastermind/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
import time

from jpype.types import JInt
from mastermind.jvm import ConvertCode, ExpectedSize, Feedback, MastermindSession
from rich.console import Console
from rich.live import Live
from rich.table import Table

from mastermind.jvm import ConvertCode, ExpectedSize, Feedback, MastermindSession

console = Console()

# ── Adjust these settings as needed ──────────────────────────────────────
Expand Down
5 changes: 3 additions & 2 deletions src/main/python/mastermind/gamemode/assisted.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import re

import jpype
from rich.prompt import IntPrompt, Prompt
from rich.rule import Rule

from mastermind.jvm import MastermindSession
from mastermind.ui import console, pause
from mastermind.ui.convert_code import display, parse_code
from mastermind.ui.prompts import ask_game_settings
from rich.prompt import IntPrompt, Prompt
from rich.rule import Rule


def _parse_feedback(raw: str, d: int) -> int | None:
Expand Down
3 changes: 2 additions & 1 deletion src/main/python/mastermind/gamemode/computer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from jpype.types import JInt
from rich.rule import Rule

from mastermind.jvm import Feedback, MastermindSession
from mastermind.ui import console, pause
from mastermind.ui.convert_code import display
from mastermind.ui.prompts import ask_game_settings, ask_secret
from rich.rule import Rule


def play():
Expand Down
5 changes: 3 additions & 2 deletions src/main/python/mastermind/gamemode/human.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from jpype.types import JInt
from rich.prompt import Prompt
from rich.rule import Rule

from mastermind.jvm import Feedback
from mastermind.ui import console, pause
from mastermind.ui.convert_code import display, parse_code
from mastermind.ui.prompts import ask_game_settings, ask_secret
from rich.prompt import Prompt
from rich.rule import Rule


def play():
Expand Down
1 change: 1 addition & 0 deletions src/main/python/mastermind/jvm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import jpype

from mastermind.java_setup import ensure_ready

jre, jar = ensure_ready()
Expand Down
3 changes: 2 additions & 1 deletion src/main/python/mastermind/ui/prompts.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import random

from rich.prompt import IntPrompt, Prompt

from mastermind.ui.console import console
from mastermind.ui.convert_code import parse_code
from rich.prompt import IntPrompt, Prompt


def ask_game_settings() -> tuple[int, int, int]:
Expand Down
3 changes: 2 additions & 1 deletion src/main/python/mastermind/ui/rules.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from mastermind.ui.console import console, pause
from rich.console import Group
from rich.panel import Panel
from rich.rule import Rule

from mastermind.ui.console import console, pause


def show_rules():
console.print()
Expand Down
5 changes: 3 additions & 2 deletions src/main/python/mastermind/welcome.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from rich.prompt import Prompt
from rich.rule import Rule

from mastermind.gamemode import assisted, computer, human
from mastermind.ui import console
from mastermind.ui.rules import show_rules
from rich.prompt import Prompt
from rich.rule import Rule

_BANNER_WIDE = """\
╔════════════════════════════════════════════════════════════════════════════════════════╗
Expand Down