Skip to content

Commit

Permalink
feat: log context every turn
Browse files Browse the repository at this point in the history
  • Loading branch information
NateScarlet committed Aug 21, 2021
1 parent 53d96e4 commit a1f15cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion auto_derby/jobs/nurturing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def _handle_turn(ctx: Context):
ctx.scene = CommandScene()
ctx.scene.recognize(ctx)
ctx.next_turn()
LOGGER.info("update context: %s", ctx)
command_with_scores = sorted(
((i, i.score(ctx)) for i in commands.from_context(ctx)),
key=lambda x: x[1],
Expand Down
4 changes: 4 additions & 0 deletions auto_derby/single_mode/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import functools
import logging
import os
from typing import Callable, List, Set, Text, Tuple, Type

Expand All @@ -14,6 +15,8 @@

from .. import imagetools, mathtools, ocr, scenes, template, templates, texttools

_LOGGER = logging.getLogger(__name__)


class g:
context_class: Type[Context]
Expand Down Expand Up @@ -249,6 +252,7 @@ def next_turn(self) -> None:

while self._next_turn_cb:
self._next_turn_cb.pop()()
_LOGGER.info("next turn: %s", self)

def defer_next_turn(self, cb: Callable[[], None]) -> None:
self._next_turn_cb.append(cb)
Expand Down

0 comments on commit a1f15cf

Please sign in to comment.