Example #1
0
Inputs Game::make_inputs(const vector<vector<Action>>& paths) {
    REQUIRE(paths.size() == PLAYER_COUNT);

    Inputs inputs;
    for (unsigned int player_index = 0u; player_index < PLAYER_COUNT; ++player_index) {
        const auto& path = paths.at(player_index);
        if (!path.empty()) {
            inputs.push_back(shared_ptr<Input>(new PlaybackInput(path)));
        }
        else {
            inputs.push_back(shared_ptr<Input>(new ZeroInput));
        }
    }
    
    return inputs;
}
Example #2
0
RiscOperators::Cursor::Inputs
RiscOperators::Cursor::inputs(const BaseSemantics::SValuePtr &arg1, const BaseSemantics::SValuePtr &arg2,
                              const BaseSemantics::SValuePtr &arg3)
{
    ASSERT_require((arg1==NULL && arg2==NULL && arg3==NULL) ||
                   (arg1!=NULL && arg2==NULL && arg3==NULL) ||
                   (arg1!=NULL && arg2!=NULL && arg3==NULL) ||
                   (arg1!=NULL && arg2!=NULL && arg3!=NULL));
    Inputs inputs;
    if (arg1!=NULL)
        inputs.push_back(SValue::promote(arg1));
    if (arg2!=NULL)
        inputs.push_back(SValue::promote(arg2));
    if (arg3!=NULL)
        inputs.push_back(SValue::promote(arg3));
    return inputs;
}