Mark
/
celeste-ai
Archived
1
0
Fork 0

Added fruit status

master
Mark 2023-02-24 22:17:45 -08:00
parent dc8f0ace68
commit f40b58508e
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
2 changed files with 18 additions and 0 deletions

View File

@ -28,6 +28,9 @@ class CelesteState(NamedTuple):
# Number of deaths since game start
deaths: int
# If an index is true, we got a strawberry on that stage.
berries: list[bool]
# Distance to next point
dist: float
@ -223,6 +226,7 @@ class Celeste:
xvel = float(self._internal_state["vx"]),
yvel = float(self._internal_state["vy"]),
deaths = int(self._internal_state["dc"]),
berries = [x == "t" for x in self._internal_state["fr"][1:]],
dist = self._dist,
next_point = self._next_checkpoint_idx,

View File

@ -1275,11 +1275,25 @@ function _update()
hack_has_sent_first_message = true
out_string = "dc:" .. tostr(deaths) .. ";"
-- Dash status
if hack_can_dash then
out_string = out_string .. "ds:t;"
else
out_string = out_string .. "ds:f;"
end
-- Fruit status
out_string = out_string .. "fr:"
for i = 0,29 do
if got_fruit[i] then
out_string = out_string .. "t"
else
out_string = out_string .. "f"
end
end
out_string = out_string .. ";"
for k, v in pairs(hack_player_state) do
out_string = out_string .. k ..":" .. v .. ";"