"""A base agent to write custom scripted agents."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from pysc2.lib import actions


class BaseAgent(object):
  """A base agent to write custom scripted agents."""

  def setup(self, obs_spec, action_spec):
    self.reward = 0
    self.episodes = 0
    self.steps = 0
    self.obs_spec = obs_spec
    self.action_spec = action_spec

  def reset(self):
    self.episodes += 1

  def step(self, obs):
    self.steps += 1
    self.reward += obs.reward
    return actions.FunctionCall(0, [])

"""A base agent to write custom scripted agents."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from pysc2.lib import actions


class BaseAgent(object):
  """A base agent to write custom scripted agents."""

  def __init__(self):
    self.reward = 0
    self.episodes = 0
    self.steps = 0
    self.obs_spec = None
    self.action_spec = None

  def setup(self, obs_spec, action_spec):
    self.obs_spec = obs_spec
    self.action_spec = action_spec

  def reset(self):
    self.episodes += 1

  def step(self, obs):
    self.steps += 1
    self.reward += obs.reward
    return actions.FunctionCall(0, [])

Define instance attributes on __init__.
Define instance attributes on __init__.

PySC2: Import of refs/pull/48/head
PiperOrigin-RevId: 166837442

  """A base agent to write custom scripted agents."""
  
  from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  
  from pysc2.lib import actions
  
  
  class BaseAgent(object):
    """A base agent to write custom scripted agents."""
  
-   def setup(self, obs_spec, action_spec):
+   def __init__(self):
      self.reward = 0
      self.episodes = 0
      self.steps = 0
+     self.obs_spec = None
+     self.action_spec = None
+ 
+   def setup(self, obs_spec, action_spec):
      self.obs_spec = obs_spec
      self.action_spec = action_spec
  
    def reset(self):
      self.episodes += 1
  
    def step(self, obs):
      self.steps += 1
      self.reward += obs.reward
      return actions.FunctionCall(0, [])
  
Define instance attributes on __init__.
## Code Before:
"""A base agent to write custom scripted agents."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from pysc2.lib import actions


class BaseAgent(object):
  """A base agent to write custom scripted agents."""

  def setup(self, obs_spec, action_spec):
    self.reward = 0
    self.episodes = 0
    self.steps = 0
    self.obs_spec = obs_spec
    self.action_spec = action_spec

  def reset(self):
    self.episodes += 1

  def step(self, obs):
    self.steps += 1
    self.reward += obs.reward
    return actions.FunctionCall(0, [])

## Instruction:
Define instance attributes on __init__.
## Code After:
"""A base agent to write custom scripted agents."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from pysc2.lib import actions


class BaseAgent(object):
  """A base agent to write custom scripted agents."""

  def __init__(self):
    self.reward = 0
    self.episodes = 0
    self.steps = 0
    self.obs_spec = None
    self.action_spec = None

  def setup(self, obs_spec, action_spec):
    self.obs_spec = obs_spec
    self.action_spec = action_spec

  def reset(self):
    self.episodes += 1

  def step(self, obs):
    self.steps += 1
    self.reward += obs.reward
    return actions.FunctionCall(0, [])
