Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
Pengfei Chen committed Oct 2, 2023
1 parent 5298a11 commit 6c50418
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
27 changes: 14 additions & 13 deletions unitary/examples/quantum_chinese_chess/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,21 @@ class Color(enum.Enum):


class Type(enum.Enum):
""" The four values are symbols corresponding to
English red
English black
Chinese red
Chinese black
"""
EMPTY = [".", ".", ".", "."]
SOLDIER = ["s", "S", "兵", "卒"]
CANNON = ["c", "C", "炮", "砲"]
ROOK = ["r", "R", "车", "車"]
HORSE = ["h", "H", "马", "馬"]
"""The four values are symbols corresponding to
English red
English black
Chinese red
Chinese black
"""

EMPTY = [".", ".", ".", "."]
SOLDIER = ["s", "S", "兵", "卒"]
CANNON = ["c", "C", "炮", "砲"]
ROOK = ["r", "R", "车", "車"]
HORSE = ["h", "H", "马", "馬"]
ELEPHANT = ["e", "E", "象", "相"]
ADVISOR = ["a", "A", "士", "仕"]
GENERAL = ["g", "G", "将", "帥"]
ADVISOR = ["a", "A", "士", "仕"]
GENERAL = ["g", "G", "将", "帥"]

@staticmethod
def type_of(c: str) -> Optional["Type"]:
Expand Down
6 changes: 2 additions & 4 deletions unitary/examples/quantum_chinese_chess/piece.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from unitary.alpha import (
QuantumObject
)
from unitary.alpha import QuantumObject
from unitary.examples.quantum_chinese_chess.enums import (
SquareState,
Language,
Color,
Type
Type,
)


Expand Down
6 changes: 4 additions & 2 deletions unitary/examples/quantum_chinese_chess/piece_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
SquareState,
Language,
Color,
Type
Type,
)
from unitary.examples.quantum_chinese_chess.piece import Piece
from unitary.alpha import QuantumWorld
Expand Down Expand Up @@ -44,4 +44,6 @@ def test_enum():
p1 = Piece("b1", SquareState.OCCUPIED, Type.HORSE, Color.BLACK)
p2 = Piece("c2", SquareState.EMPTY, Type.EMPTY, Color.NA)
board = QuantumWorld([p0, p1, p2])
assert board.peek() == [[SquareState.OCCUPIED,SquareState.OCCUPIED,SquareState.EMPTY]]
assert board.peek() == [
[SquareState.OCCUPIED, SquareState.OCCUPIED, SquareState.EMPTY]
]

0 comments on commit 6c50418

Please sign in to comment.