<commit_before>require 'json'
require 'set'

require_relative './card_store'

module Hearthstone
  module Models
    # represent an object in game
    class Entity
      attr_accessor :id, :card, :zone
      def initialize(id: id, card: card, zone: zone=nil)
        @id = id
        @card = card
        @zone = zone
      end

      def eql?(other)
        other.equal?(id) || id == other.id
      end

      def hash
        id.hash
      end
    end

    class Player
      attr_reader :id, :name, :first_player
      attr_accessor :hero, :hero_power
      attr_reader :deck, :hand, :play, :graveyard, :setaside

      def initialize(id: id, name: name, first_player: first_player, hero: hero, hero_power: hero_power)
        @id = id
        @name = name
        @first_player = first_player
        @hero = hero
        @hero_power = hero_power

        @deck = Set.new
        @hand = Set.new
        @play = Set.new
        @graveyard = Set.new
        @setaside = Set.new
      end

      def move_card(card, to_zone)
        [:deck, :hand, :play, :graveyard, :setaside].each do |zone|
          if to_zone != zone
            self.send(zone).delete(card)
          else
            self.send(to_zone) << card
          end
        end
      end
    end

    class Game
      attr_reader :store, :entities, :players

      def initialize(store=CardStore.new)
        @store = store
        @entities = {}
        @players = []<commit_msg>add to_s<commit_after>require 'json'
require 'set'

require_relative './card_store'

module Hearthstone
  module Models
    # represent an object in game
    class Entity
      attr_accessor :id, :card
      def initialize(id: id, card: card)
        @id = id
        @card = card
      end

      def eql?(other)
        other.equal?(id) || id == other.id
      end

      def hash
        id.hash
      end

      def to_s
        "<Entity ##{id} \"#{card.name}\">"
      end
    end

    class Player
      attr_reader :id, :name, :first_player
      attr_accessor :hero, :hero_power
      attr_reader :deck, :hand, :play, :graveyard, :setaside

      def initialize(id: id, name: name, first_player: first_player, hero: hero, hero_power: hero_power)
        @id = id
        @name = name
        @first_player = first_player
        @hero = hero
        @hero_power = hero_power

        @deck = Set.new
        @hand = Set.new
        @play = Set.new
        @graveyard = Set.new
        @setaside = Set.new
      end

      def move_card(card, to_zone)
        [:deck, :hand, :play, :graveyard, :setaside].each do |zone|
          if to_zone != zone
            self.send(zone).delete(card)
          else
            self.send(to_zone) << card
          end
        end
      end

      def to_s
        "<Player ##{id} \"#{name}\">"
      end
    end

    class Game
      attr_reader :store, :entities, :players

      def initialize(store=CardStore.new)
        @store = store
        @entities = {}
        @players = []
{'fraction_non_alphanumeric': 0.1061114842175957, 'fraction_numerical': 0.0, 'mean_word_length': 1.7971830985915493, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6790452', 'n_tokens_mistral': 963, 'n_tokens_neox': 942, 'n_words': 260}