MCPcopy Create free account
hub / github.com/geekcomputers/Python / __init__

Method __init__

8_puzzle.py:8–18  ·  view source on GitHub ↗
(
        self,
        board: List[List[int]],
        goal: List[List[int]],
        moves: int = 0,
        previous: Optional["PuzzleState"] = None,
    )

Source from the content-addressed store, hash-verified

6 """Represents a state in 8-puzzle solving with A* algorithm."""
7
8 def __init__(
9 self,
10 board: List[List[int]],
11 goal: List[List[int]],
12 moves: int = 0,
13 previous: Optional["PuzzleState"] = None,
14 ) -> None:
15 self.board = board # Current 3x3 board configuration
16 self.goal = goal # Target 3x3 configuration
17 self.moves = moves # Number of moves taken to reach here
18 self.previous = previous # Previous state in solution path
19
20 def __lt__(self, other: "PuzzleState") -> bool:
21 """For PriorityQueue ordering: compare priorities."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected