<commit_before>// This code is based on Sabberstone project.
// Copyright (c) 2017-2019 SabberStone Team, darkfriend77 & rnilva
// RosettaStone is hearthstone simulator using C++ with reinforcement learning.
// Copyright (c) 2019 <NAME>, <NAME>, <NAME>

#include <Rosetta/Games/Game.hpp>
#include <Rosetta/Tasks/SimpleTasks/CountTask.hpp>
#include <Rosetta/Tasks/SimpleTasks/IncludeTask.hpp>

namespace RosettaStone::SimpleTasks
{
CountTask::CountTask(EntityType entityType, int numIndex)
    : ITask(entityType), m_numIndex(numIndex)
{
    // Do nothing
}

TaskID CountTask::GetTaskID() const
{
    return TaskID::COUNT;
}

TaskStatus CountTask::Impl(Player& player)
{
    const auto entities =
        IncludeTask::GetEntities(m_entityType, player, m_source, m_target);
    const int count = static_cast<int>(entities.size());

    switch (m_numIndex)
    {
        case 0:
            player.GetGame()->taskStack.num = count;
            break;
        case 1:
            player.GetGame()->taskStack.num1 = count;
            break;
        case 2:
            player.GetGame()->taskStack.num2 = count;
            break;
        case 3:
            player.GetGame()->taskStack.num3 = count;
            break;
        case 4:
            player.GetGame()->taskStack.num4 = count;
            break;
        default:
            throw std::invalid_argument(
                "CountTask::Impl() - Invalid number index");
    }
    return TaskStatus::COMPLETE;
}
}  // namespace RosettaStone::SimpleTasks<commit_msg>fix: Correct compile error (remove num2/num3/num4)<commit_after>// This code is based on Sabberstone project.
// Copyright (c) 2017-2019 SabberStone Team, darkfriend77 & rnilva
// RosettaStone is hearthstone simulator using C++ with reinforcement learning.
// Copyright (c) 2019 <NAME>, <NAME>, <NAME>

#include <Rosetta/Games/Game.hpp>
#include <Rosetta/Tasks/SimpleTasks/CountTask.hpp>
#include <Rosetta/Tasks/SimpleTasks/IncludeTask.hpp>

namespace RosettaStone::SimpleTasks
{
CountTask::CountTask(EntityType entityType, int numIndex)
    : ITask(entityType), m_numIndex(numIndex)
{
    // Do nothing
}

TaskID CountTask::GetTaskID() const
{
    return TaskID::COUNT;
}

TaskStatus CountTask::Impl(Player& player)
{
    const auto entities =
        IncludeTask::GetEntities(m_entityType, player, m_source, m_target);
    const int count = static_cast<int>(entities.size());

    switch (m_numIndex)
    {
        case 0:
            player.GetGame()->taskStack.num = count;
            break;
        case 1:
            player.GetGame()->taskStack.num1 = count;
            break;
        default:
            throw std::invalid_argument(
                "CountTask::Impl() - Invalid number index");
    }
    return TaskStatus::COMPLETE;
}
}  // namespace RosettaStone::SimpleTasks
{'fraction_non_alphanumeric': 0.1173323823109843, 'fraction_numerical': 0.015335235378031383, 'mean_word_length': 2.912133891213389, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 24, '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': '6337399', 'n_tokens_mistral': 882, 'n_tokens_neox': 830, 'n_words': 195}