class_docstr: Candy cane contest Kaggle competition.
  
  Parameters
  ----------
  n_machines
      Number of vending machines.
  reward_decay
      The multiplicate rate at which the expected reward of each vending machine decays.
  
  Examples
  --------
  
  >>> import gym
  >>> from river import stats
  
  >>> env = gym.make('river_bandits/CandyCaneContest-v0')
  >>> _ = env.reset(seed=42)
  >>> _ = env.action_space.seed(123)
  
  >>> metric = stats.Sum()
  >>> while True:
  ...     arm = env.action_space.sample()
  ...     observation, reward, terminated, truncated, info = env.step(arm)
  ...     metric.update(reward)
  ...     if terminated or truncated:
  ...         break
  
  >>> metric
  Sum: 734.
  
  References
  ----------
  [^1]: [Santa 2020 - The Candy Cane Contest](https://www.kaggle.com/c/santa-2020)
class_docstr_tok: ["Candy","cane","contest","Kaggle","competition",".","Parameters","--","--","--","--","--","n_machines","Number","of","vending","machines",".","reward_decay","The","multiplicate","rate","at","which","the","expected","reward","of","each","vending","machine","decays",".","Examples","--","--","--","--",">",">",">","import","gym",">",">",">","from","river","import","stats",">",">",">","env","=","gym.make","(","'river_bandits\/CandyCaneContest-v0","'",")",">",">",">","_","=","env.reset","(","seed=42",")",">",">",">","_","=","env.action_space.seed","(","123",")",">",">",">","metric","=","stats.Sum","(",")",">",">",">","while","True",":","...","arm","=","env.action_space.sample","(",")","...","observation",",","reward",",","terminated",",","truncated",",","info","=","env.step","(","arm",")","...","metric.update","(","reward",")","...","if","terminated","or","truncated",":","...","break",">",">",">","metric","Sum",":","734",".","References","--","--","--","--","--","[","^1","]",":","[","Santa","2020","-","The","Candy","Cane","Contest","]","(","https",":","\/\/www.kaggle.com\/c\/santa-2020",")"]
code: def step(self, machine_index):
      machine = self._machines[machine_index]
      reward = float(self.np_random.uniform() < machine.threshold)
      machine.threshold *= 1 - self.reward_decay
  
      observation = self._get_observation()
      info = self._get_info()
      terminated = False
      truncated = False
      return observation, reward, terminated, truncated, info
  
file_path: river/river/bandit/envs/candy_cane.py
imports: from __future__ import annotations
  import dataclasses
  import gym
label_desc: Use image node_id 5 for calling the CandyCaneContest obj's underlying member method code with example usage: obj.step(machine_index) and returns: observation,  reward,  terminated,  truncated,  info