socha#

Subpackages#

Submodules#

Package Contents#

Classes#

class socha.PluginConstants#
ROUND_LIMIT: int#
START_COAL: int#
MIN_SPEED: int#
MAX_SPEED: int#
FREE_ACC: int#
FREE_TURNS: int#
FINISH_POINTS: int#
POINTS_PER_PASSENGER: int#
POINTS_PER_SEGMENT: int#
NUMBER_OF_PASSENGERS: int#
SEGMENT_FIELDS_WIDTH: int#
SEGMENT_FIELDS_HEIGHT: int#
NUMBER_OF_SEGMENTS: int#
MAX_SPECIAL: int#
MIN_SPECIAL: int#
MAX_ISLANDS: int#
MIN_ISLANDS: int#
class socha.CartesianCoordinate(x: int, y: int)#

Bases: object

x: int#
y: int#
to_cube() CubeCoordinates#
to_index() int | None#
from_index() CartesianCoordinate#
class socha.CubeCoordinates(q: int, r: int)#

Bases: object

q: int#
r: int#
s: int#
coordinates() List[int]#
x() int#
y() int#
to_cartesian() CartesianCoordinate#
times(count: int) CubeCoordinates#
plus(other: CubeCoordinates) CubeCoordinates#
minus(other: CubeCoordinates) CubeCoordinates#
unary_minus() CubeCoordinates#
rotated_by(turns: int) CubeCoordinates#
distance_to(other: CubeCoordinates) int#
turn_count_to(target: CubeDirection) int#
class socha.CubeDirection#
Right: int#
DownRight: int#
DownLeft: int#
Left: int#
UpLeft: int#
UpRight: int#
vector() CubeCoordinates#
angle() int#
with_neighbors() List[CubeDirection]#
opposite() CubeDirection#
turn_count_to(target: CubeDirection) int#
rotated_by(turns: int) CubeDirection#
ordinal() int#
class socha.Move(actions: List[Accelerate | Advance | Push | Turn])#
actions: List[Accelerate | Advance | Push | Turn]#
class socha.TeamEnum#
One: int#
Two: int#
class socha.Ship(position: CubeCoordinates, team: TeamEnum, direction: CubeDirection | None = None, speed: int | None = None, coal: int | None = None, passengers: int | None = None, free_turns: int | None = None, points: int | None = None)#
team: TeamEnum#
position: CubeCoordinates#
direction: CubeDirection#
speed: int#
coal: int#
passengers: int#
free_turns: int#
points: int#
free_acc: int#
movement: int#
can_turn() bool#
max_acc() int#
accelerate_by(diff: int) None#
read_resolve() None#
__str__() str#

Return str(self).

class socha.AccelerationProblem#
ZeroAcc: Any#
AboveMaxSpeed: Any#
BelowMinSpeed: Any#
InsufficientCoal: Any#
OnSandbank: Any#
message() str#
class socha.Accelerate(acc: int)#
acc: int#
perform(state: Any)#
accelerate(ship: Any) Ship#
__str__() str#

Return str(self).

class socha.AdvanceProblem#
MovementPointsMissing: Any#
InsufficientPush: Any#
InvalidDistance: Any#
ShipAlreadyInTarget: Any#
FieldIsBlocked: Any#
MoveEndOnSandbank: Any#
message() str#
class socha.Advance(distance: int)#
distance: int#
perform(state: GameState)#
class socha.PushProblem#
MovementPointsMissing: Any#
SameFieldPush: Any#
InvalidFieldPush: Any#
BlockedFieldPush: Any#
SandbankPush: Any#
BackwardPushingRestricted: Any#
message() str#
class socha.Push(direction: CubeDirection)#
direction: CubeDirection#
perform(state: GameState)#
class socha.TurnProblem#
RotationOnSandbankNotAllowed: Any#
NotEnoughCoalForRotation: Any#
RotationOnNonExistingField: Any#
message() str#
class socha.Turn(direction: CubeDirection)#
direction: CubeDirection#
perform(state: GameState)#
coal_cost(ship: Ship) int#
class socha.Passenger#
direction: CubeDirection#
passenger: int#
class socha.FieldType#
Water: 0#
Island: 1#
Passenger: 2#
Goal: 3#
Sandbank: 4#
class socha.Field(passenger: Passenger | None)#
field_type: FieldType#
passenger: Passenger | None#
is_empty() bool#
is_field_type(field_type: FieldType) bool#
class socha.Segment(direction: CubeDirection, center: CubeCoordinates, fields: List[List[Field]])#
direction: CubeDirection#
center: CubeCoordinates#
fields: List[List[Field]]#
tip() CubeCoordinates#
get(coordinates: CubeCoordinates) Field | None#
local_to_global(coordinates: CubeCoordinates) CubeCoordinates#
global_to_local(coordinates: CubeCoordinates) CubeCoordinates#
contains(coordinates: CubeCoordinates) bool#
array_coords(coords: CubeCoordinates) CartesianCoordinate#
cube_coords(coords: CartesianCoordinate) CubeCoordinates#
class socha.Board(segments: List[Segment], next_direction: CubeDirection)#
segments: List[Segment]#
next_direction: CubeDirection#
get_segment(index: int) Segment | None#
segment_with_index_at(coords: CubeCoordinates) tuple[int, Segment] | None#
get(coords: CubeCoordinates) Field | None#
does_field_have_current(coords: CubeCoordinates) bool#
does_field_have_stream(coords: CubeCoordinates) bool#
get_field_in_direction(direction: CubeDirection, coords: CubeCoordinates) Field | None#
get_coordinate_by_index(segment_index: int, x_index: int, y_index: int) CubeCoordinates#
segment_distance(coordinate1: CubeCoordinates, coordinate2: CubeCoordinates) int#
segment_index(coordinate: CubeCoordinates) int | None#
find_segment(coordinate: CubeCoordinates) Segment | None#
neighboring_fields(coords: CubeCoordinates) List[Field | None]#
effective_speed(ship: Ship) int#
is_sandbank(coords: CubeCoordinates) bool#
pickup_passenger(state: GameState) GameState#
pickup_passenger_at_position(pos: CubeCoordinates) Field | None#
find_nearest_field_types(start_coordinates: CubeCoordinates, field_type: FieldType) Set[CubeCoordinates]#
class socha.TeamPoints#
ship_points: int#
coal_points: int#
finish_points: int#
class socha.AdvanceInfo#
costs: int#
problem: AdvanceProblem#
cost_until(distance: int) int#
advances(distance: int | None) List[Advance]#
distance() int#
class socha.GameState(board: Board, turn: int, current_ship: Ship, other_ship: Ship, last_move: Move | None)#
board: Board#
turn: int#
current_ship: Ship#
other_ship: Ship#
last_move: Move | None#
determine_ahead_team() Ship#
ship_advance_points(ship: Ship) int#
calculate_points(ship: Ship) int#
is_current_ship_on_current() bool#
perform_move(move: Move) GameState#
advance_turn() GameState#
effective_speed(ship: Ship) int#
remove_passenger_at(coords: CubeCoordinates) bool#
pick_up_passenger_current_ship() None#
pick_up_passenger_other_ship() None#
ship_advance_points(ship: Ship) int#
ship_points(ship: Ship) int#
must_push() bool#
check_ship_advance_limit(ship: Ship) AdvanceInfo#
calculate_advance_info(start: CubeCoordinates, direction: CubeDirection, max_movement_points: int) AdvanceInfo#
possible_accelerations() List[Accelerate]#
possible_pushes() List[Push]#
possible_turns() List[Turn]#
possible_advances() List[Advance]#
sandbank_advances_for(ship: Ship) List[Advance] | None#
possible_actions(rank: int) List[Accelerate | Advance | Push | Turn]#
can_move() bool#
is_over() bool#
is_winner(ship: Ship) bool#
get_points_for_team(ship: Ship) TeamPoints#