DigitalCurling3  1.0.0
A curling simulation system for curling AIs
player_normal_dist_factory.hpp
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2022 UEC Takeshi Ito Laboratory
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in all
13 // copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 // SOFTWARE.
22 
25 
26 #ifndef DIGITALCURLING3_PLAYERS_PLAYER_NORMAL_DIST_FACTORY_HPP
27 #define DIGITALCURLING3_PLAYERS_PLAYER_NORMAL_DIST_FACTORY_HPP
28 
29 #include <random>
30 #include <memory>
31 #include <optional>
32 #include "../json/common.hpp"
33 #include "../i_player_factory.hpp"
34 
35 namespace digitalcurling3::players {
36 
38 constexpr std::string_view kPlayerNormalDistId = "normal_dist";
39 
40 
43 public:
45  float max_speed = 4.f;
46 
48  float stddev_speed = 0.0076f;
49 
51  float stddev_angle = 0.0018f;
52 
56  std::optional<std::random_device::result_type> seed = std::nullopt;
57 
58  PlayerNormalDistFactory() = default;
59  virtual ~PlayerNormalDistFactory() = default;
62 
63  virtual std::unique_ptr<IPlayer> CreatePlayer() const override;
64  virtual std::unique_ptr<IPlayerFactory> Clone() const override;
65  virtual std::string GetPlayerId() const override
66  {
67  return std::string(kPlayerNormalDistId);
68  }
69 };
70 
71 
73 // json
74 void to_json(nlohmann::json &, PlayerNormalDistFactory const&);
75 void from_json(nlohmann::json const&, PlayerNormalDistFactory &);
77 
78 } // namespace digitalcurling3::players
79 
80 #endif // DIGITALCURLING3_PLAYERS_PLAYER_NORMAL_DIST_FACTORY_HPP
digitalcurling3::players::PlayerNormalDistFactory::CreatePlayer
virtual std::unique_ptr< IPlayer > CreatePlayer() const override
プレイヤーを生成する
digitalcurling3::players::PlayerNormalDistFactory::seed
std::optional< std::random_device::result_type > seed
乱数のシード値.
Definition: player_normal_dist_factory.hpp:56
digitalcurling3::players::PlayerNormalDistFactory::operator=
PlayerNormalDistFactory & operator=(PlayerNormalDistFactory const &)=default
コピー代入演算子
digitalcurling3::players::PlayerNormalDistFactory::stddev_angle
float stddev_angle
ショットの初期角度に加わる正規分布乱数の標準偏差.
Definition: player_normal_dist_factory.hpp:51
digitalcurling3::players::PlayerNormalDistFactory::PlayerNormalDistFactory
PlayerNormalDistFactory()=default
デフォルトコンストラクタ
digitalcurling3::players::PlayerNormalDistFactory::Clone
virtual std::unique_ptr< IPlayerFactory > Clone() const override
このインスタンスを複製する
digitalcurling3::IPlayerFactory
IPlayer を構築するためのクラスです
Definition: i_player_factory.hpp:42
digitalcurling3::players::PlayerNormalDistFactory
ショットの初速に速度上限を適用したのち,初速と角度に正規分布の乱数を加えるプレイヤー
Definition: player_normal_dist_factory.hpp:42
digitalcurling3::players::PlayerNormalDistFactory::GetPlayerId
virtual std::string GetPlayerId() const override
対応するプレイヤーのプレイヤーIDを得る.
Definition: player_normal_dist_factory.hpp:65
digitalcurling3::players::PlayerNormalDistFactory::max_speed
float max_speed
ショットの最大速度
Definition: player_normal_dist_factory.hpp:45
digitalcurling3::players
IPlayerFactory を継承したクラスを定義する名前空間
Definition: player_identical_factory.hpp:33
digitalcurling3::players::kPlayerNormalDistId
constexpr std::string_view kPlayerNormalDistId
プレイヤーNormal DistのID
Definition: player_normal_dist_factory.hpp:38
digitalcurling3::players::PlayerNormalDistFactory::stddev_speed
float stddev_speed
ショットの初速に加わる正規分布乱数の標準偏差.
Definition: player_normal_dist_factory.hpp:48