Skip to content

Commit 8b654a7

Browse files
committed
chore: Update calculate_move method to select a random move from possible moves
1 parent e49b3d4 commit 8b654a7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

logic.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# not all imports are currently used, but they might be in the future and it shows all available functionalities
22
import logging
3+
import random
4+
from typing import List
35
from socha import (
46
GameState,
5-
Move,
6-
Advance
7+
Move
78
)
89
from socha.api.networking.game_client import IClientHandler
910
from socha.starter import Starter
@@ -15,7 +16,9 @@ class Logic(IClientHandler):
1516
# this method is called every time the server is requesting a new move
1617
# this method should always be implemented otherwise the client will be disqualified
1718
def calculate_move(self) -> Move:
18-
return Move(action=Advance(distance=1, cards=[]))
19+
moves: List[Move] = self.game_state.possible_moves()
20+
move: Move = random.choice(moves)
21+
return move
1922

2023
# this method is called every time the server has sent a new game state update
2124
# this method should be implemented to keep the game state up to date

0 commit comments

Comments
 (0)