Kangaroo Environment
- class jaxatari.games.jax_kangaroo.Entity(x, y, w, h)[source]
Bases:
NamedTuple- h: Array | ndarray | bool_ | number
Alias for field number 3
- w: Array | ndarray | bool_ | number
Alias for field number 2
- x: Array | ndarray | bool_ | number
Alias for field number 0
- y: Array | ndarray | bool_ | number
Alias for field number 1
- class jaxatari.games.jax_kangaroo.JaxKangaroo(consts: KangarooConstants | None = None)[source]
Bases:
JaxEnvironment[KangarooState,KangarooObservation,KangarooInfo,KangarooConstants]- ACTION_SET: Array = Array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], dtype=int32)
- action_space() Discrete[source]
Returns the action space of the environment as an array containing the actions that can be taken. Returns: The action space of the environment as an array.
- image_space() Box[source]
Returns the image space of the environment. Returns: The image space of the environment.
- obs_to_flat_array(obs: KangarooObservation) Array | ndarray | bool_ | number[source]
Converts the observation to a flat array.
- observation_space() Dict[source]
Returns the observation space for Kangaroo. The observation contains: - player_x: int (0-160) - player_y: int (0-210) - player_o: int (-1 or 1 for orientation) - platform_positions: array of shape (20, 2) with x,y coordinates (0-160, 0-210) - ladder_positions: array of shape (20, 2) with x,y coordinates (0-160, 0-210) - fruit_positions: array of shape (3, 2) with x,y coordinates (0-160, 0-210) - bell_position: array of shape (2,) with x,y coordinates (0-160, 0-210) - child_position: array of shape (2,) with x,y coordinates (0-160, 0-210) - falling_coco_position: array of shape (2,) with x,y coordinates (0-160, 0-210) - monkey_positions: array of shape (4, 2) with x,y coordinates (0-160, 0-210) - coco_positions: array of shape (4, 2) with x,y coordinates (0-160, 0-210)
- render(state: KangarooState) Array[source]
Renders the environment state to a single image. :param state: The environment state.
Returns: A single image of the environment state.
- reset(key=None) Tuple[KangarooObservation, KangarooState][source]
- reset_level(next_level=1) KangarooState[source]
- step(state: KangarooState, action: Array | ndarray | bool_ | number) Tuple[KangarooObservation, KangarooState, float, bool, KangarooInfo][source]
- class jaxatari.games.jax_kangaroo.KangarooConstants(RESET, RENDER_SCALE_FACTOR, SCREEN_WIDTH, SCREEN_HEIGHT, PLAYER_WIDTH, PLAYER_HEIGHT, ENEMY_WIDTH, ENEMY_HEIGHT, FRUIT_WIDTH, FRUIT_HEIGHT, MAX_PLATFORMS, BELL_WIDTH, BELL_HEIGHT, CHILD_WIDTH, CHILD_HEIGHT, MONKEY_WIDTH, MONKEY_HEIGHT, MONKEY_COLOR, PLAYER_COLOR, ENEMY_COLOR, FRUIT_COLOR_STATE_1, FRUIT_COLOR_STATE_2, FRUIT_COLOR_STATE_3, FRUIT_COLOR_STATE_4, FRUIT_COLOR, COCONUT_COLOR, PLATFORM_COLOR, LADDER_COLOR, BELL_COLOR, PLAYER_START_X, PLAYER_START_Y, MOVEMENT_SPEED, LEFT_CLIP, RIGHT_CLIP, FALLING_COCONUT_WIDTH, FALLING_COCONUT_HEIGHT, THROWN_COCONUT_WIDTH, THROWN_COCONUT_HEIGHT, LADDER_HEIGHT, LADDER_WIDTH, P_HEIGHT, LEVEL_1, LEVEL_2, LEVEL_3, ASSET_CONFIG)[source]
Bases:
NamedTuple- ASSET_CONFIG: tuple
Alias for field number 44
- BELL_COLOR: Tuple[int, int, int]
Alias for field number 28
- BELL_HEIGHT: int
Alias for field number 12
- BELL_WIDTH: int
Alias for field number 11
- CHILD_HEIGHT: int
Alias for field number 14
- CHILD_WIDTH: int
Alias for field number 13
- COCONUT_COLOR: Tuple[int, int, int]
Alias for field number 25
- ENEMY_COLOR: Tuple[int, int, int]
Alias for field number 19
- ENEMY_HEIGHT: int
Alias for field number 7
- ENEMY_WIDTH: int
Alias for field number 6
- FALLING_COCONUT_HEIGHT: int
Alias for field number 35
- FALLING_COCONUT_WIDTH: int
Alias for field number 34
- FRUIT_COLOR: list
Alias for field number 24
- FRUIT_COLOR_STATE_1: Tuple[int, int, int]
Alias for field number 20
- FRUIT_COLOR_STATE_2: Tuple[int, int, int]
Alias for field number 21
- FRUIT_COLOR_STATE_3: Tuple[int, int, int]
Alias for field number 22
- FRUIT_COLOR_STATE_4: Tuple[int, int, int]
Alias for field number 23
- FRUIT_HEIGHT: int
Alias for field number 9
- FRUIT_WIDTH: int
Alias for field number 8
- LADDER_COLOR: Tuple[int, int, int]
Alias for field number 27
- LADDER_HEIGHT: Array | ndarray | bool_ | number
Alias for field number 38
- LADDER_WIDTH: Array | ndarray | bool_ | number
Alias for field number 39
- LEFT_CLIP: int
Alias for field number 32
- LEVEL_1: LevelConstants
Alias for field number 41
- LEVEL_2: LevelConstants
Alias for field number 42
- LEVEL_3: LevelConstants
Alias for field number 43
- MAX_PLATFORMS: int
Alias for field number 10
- MONKEY_COLOR: Tuple[int, int, int]
Alias for field number 17
- MONKEY_HEIGHT: int
Alias for field number 16
- MONKEY_WIDTH: int
Alias for field number 15
- MOVEMENT_SPEED: int
Alias for field number 31
- PLATFORM_COLOR: Tuple[int, int, int]
Alias for field number 26
- PLAYER_COLOR: Tuple[int, int, int]
Alias for field number 18
- PLAYER_HEIGHT: int
Alias for field number 5
- PLAYER_START_X: int
Alias for field number 29
- PLAYER_START_Y: int
Alias for field number 30
- PLAYER_WIDTH: int
Alias for field number 4
- P_HEIGHT: Array | ndarray | bool_ | number
Alias for field number 40
- RENDER_SCALE_FACTOR: int
Alias for field number 1
- RESET: int
Alias for field number 0
- RIGHT_CLIP: int
Alias for field number 33
- SCREEN_HEIGHT: int
Alias for field number 3
- SCREEN_WIDTH: int
Alias for field number 2
- THROWN_COCONUT_HEIGHT: int
Alias for field number 37
- THROWN_COCONUT_WIDTH: int
Alias for field number 36
- class jaxatari.games.jax_kangaroo.KangarooInfo(score, level)[source]
Bases:
NamedTuple- level: Array | ndarray | bool_ | number
Alias for field number 1
- score: Array | ndarray | bool_ | number
Alias for field number 0
- class jaxatari.games.jax_kangaroo.KangarooObservation(player_x, player_y, player_o, platform_positions, ladder_positions, fruit_positions, bell_position, child_position, falling_coco_position, monkey_positions, coco_positions)[source]
Bases:
NamedTuple- bell_position: Array | ndarray | bool_ | number
Alias for field number 6
- child_position: Array | ndarray | bool_ | number
Alias for field number 7
- coco_positions: Array | ndarray | bool_ | number
Alias for field number 10
- falling_coco_position: Array | ndarray | bool_ | number
Alias for field number 8
- fruit_positions: Array | ndarray | bool_ | number
Alias for field number 5
- ladder_positions: Array | ndarray | bool_ | number
Alias for field number 4
- monkey_positions: Array | ndarray | bool_ | number
Alias for field number 9
- platform_positions: Array | ndarray | bool_ | number
Alias for field number 3
- player_o: Array | ndarray | bool_ | number
Alias for field number 2
- player_x: Array | ndarray | bool_ | number
Alias for field number 0
- player_y: Array | ndarray | bool_ | number
Alias for field number 1
- class jaxatari.games.jax_kangaroo.KangarooRenderer(consts: KangarooConstants | None = None)[source]
Bases:
JAXGameRenderer- render(state: KangarooState) Array | ndarray | bool_ | number[source]
- class jaxatari.games.jax_kangaroo.KangarooState(player, level, score, current_level, level_finished, levelup_timer, reset_coords, levelup, lives)[source]
Bases:
NamedTuple- current_level: Array | ndarray | bool_ | number
Alias for field number 3
- level: LevelState
Alias for field number 1
- level_finished: Array | ndarray | bool_ | number
Alias for field number 4
- levelup: Array | ndarray | bool_ | number
Alias for field number 7
- levelup_timer: Array | ndarray | bool_ | number
Alias for field number 5
- lives: Array | ndarray | bool_ | number
Alias for field number 8
- player: PlayerState
Alias for field number 0
- reset_coords: Array | ndarray | bool_ | number
Alias for field number 6
- score: Array | ndarray | bool_ | number
Alias for field number 2
- class jaxatari.games.jax_kangaroo.LevelState(timer: Array | ndarray | bool_ | number, platform_positions: Array | ndarray | bool_ | number, platform_sizes: Array | ndarray | bool_ | number, ladder_positions: Array | ndarray | bool_ | number, ladder_sizes: Array | ndarray | bool_ | number, fruit_positions: Array | ndarray | bool_ | number, fruit_actives: Array | ndarray | bool_ | number, fruit_stages: Array | ndarray | bool_ | number, bell_position: Array | ndarray | bool_ | number, bell_timer: Array | ndarray | bool_ | number, child_position: Array | ndarray | bool_ | number, child_velocity: Array | ndarray | bool_ | number, child_timer: Array | ndarray | bool_ | number, falling_coco_position: Array | ndarray | bool_ | number, falling_coco_dropping: Array | ndarray | bool_ | number, falling_coco_counter: Array | ndarray | bool_ | number, falling_coco_skip_update: Array | ndarray | bool_ | number, step_counter: Array | ndarray | bool_ | number, monkey_states: Array | ndarray | bool_ | number, monkey_positions: Array | ndarray | bool_ | number, monkey_throw_timers: Array | ndarray | bool_ | number, spawn_protection: Array | ndarray | bool_ | number, coco_positions: Array | ndarray | bool_ | number, coco_states: Array | ndarray | bool_ | number, spawn_position: Array | ndarray | bool_ | number, bell_animation: Array | ndarray | bool_ | number)[source]
Bases:
NamedTupleAll level related state variables.
- bell_animation: Array | ndarray | bool_ | number
Alias for field number 25
- bell_position: Array | ndarray | bool_ | number
Alias for field number 8
- bell_timer: Array | ndarray | bool_ | number
Alias for field number 9
- child_position: Array | ndarray | bool_ | number
Alias for field number 10
- child_timer: Array | ndarray | bool_ | number
Alias for field number 12
- child_velocity: Array | ndarray | bool_ | number
Alias for field number 11
- coco_positions: Array | ndarray | bool_ | number
Alias for field number 22
- coco_states: Array | ndarray | bool_ | number
non existent - 1: charging - 2: throwing
- Type:
0
- falling_coco_counter: Array | ndarray | bool_ | number
Alias for field number 15
- falling_coco_dropping: Array | ndarray | bool_ | number
Alias for field number 14
- falling_coco_position: Array | ndarray | bool_ | number
Alias for field number 13
- falling_coco_skip_update: Array | ndarray | bool_ | number
Alias for field number 16
- fruit_actives: Array | ndarray | bool_ | number
Alias for field number 6
- fruit_positions: Array | ndarray | bool_ | number
Alias for field number 5
- fruit_stages: Array | ndarray | bool_ | number
Alias for field number 7
- ladder_positions: Array | ndarray | bool_ | number
Alias for field number 3
- ladder_sizes: Array | ndarray | bool_ | number
Alias for field number 4
- monkey_positions: Array | ndarray | bool_ | number
[monkey_index, [x, y]]
- Type:
2D array
- monkey_states: Array | ndarray | bool_ | number
non-existent - 1: moving down - 2: moving left - 3: throwing - 4: moving right - 5: moving up
- Type:
0
- monkey_throw_timers: Array | ndarray | bool_ | number
Alias for field number 20
- platform_positions: Array | ndarray | bool_ | number
Alias for field number 1
- platform_sizes: Array | ndarray | bool_ | number
Alias for field number 2
- spawn_position: Array | ndarray | bool_ | number
foot - 1: head
- Type:
0
- spawn_protection: Array | ndarray | bool_ | number
Alias for field number 21
- step_counter: Array | ndarray | bool_ | number
Alias for field number 17
- timer: Array | ndarray | bool_ | number
Alias for field number 0
- class jaxatari.games.jax_kangaroo.PlayerState(x, y, vel_x, orientation, height, is_crouching, is_jumping, jump_base_y, jump_counter, jump_orientation, landing_base_y, is_climbing, climb_base_y, climb_counter, cooldown_counter, is_crashing, chrash_timer, punch_left, punch_right, last_stood_on_platform_y, walk_animation, punch_counter, needs_release)[source]
Bases:
NamedTuple- chrash_timer: Array | ndarray | bool_ | number
Alias for field number 16
- climb_base_y: Array | ndarray | bool_ | number
Alias for field number 12
- climb_counter: Array | ndarray | bool_ | number
Alias for field number 13
- cooldown_counter: Array | ndarray | bool_ | number
Alias for field number 14
- height: Array | ndarray | bool_ | number
Alias for field number 4
- is_climbing: Array | ndarray | bool_ | number
Alias for field number 11
- is_crashing: Array | ndarray | bool_ | number
Alias for field number 15
- is_crouching: Array | ndarray | bool_ | number
Alias for field number 5
- is_jumping: Array | ndarray | bool_ | number
Alias for field number 6
- jump_base_y: Array | ndarray | bool_ | number
Alias for field number 7
- jump_counter: Array | ndarray | bool_ | number
Alias for field number 8
- jump_orientation: Array | ndarray | bool_ | number
Alias for field number 9
- landing_base_y: Array | ndarray | bool_ | number
Alias for field number 10
- last_stood_on_platform_y: Array | ndarray | bool_ | number
Alias for field number 19
- needs_release: Array | ndarray | bool_ | number
Alias for field number 22
- orientation: Array | ndarray | bool_ | number
Alias for field number 3
- punch_counter: Array | ndarray | bool_ | number
Alias for field number 21
- punch_left: Array | ndarray | bool_ | number
Alias for field number 17
- punch_right: Array | ndarray | bool_ | number
Alias for field number 18
- vel_x: Array | ndarray | bool_ | number
Alias for field number 2
- walk_animation: Array | ndarray | bool_ | number
Alias for field number 20
- x: Array | ndarray | bool_ | number
Alias for field number 0
- y: Array | ndarray | bool_ | number
Alias for field number 1