DigitalCurling3  1.0.0
A curling simulation system for curling AIs
i_player.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_I_PLAYER_HPP
27 #define DIGITALCURLING3_I_PLAYER_HPP
28 
29 #include <string>
30 #include <memory>
31 #include "vector2.hpp"
32 #include "moves/shot.hpp"
33 
34 namespace digitalcurling3 {
35 
36 class IPlayerFactory;
37 class IPlayerStorage;
38 
39 
45 class IPlayer {
46 protected:
47  IPlayer() = default;
48  IPlayer(IPlayer const&) = default;
49  IPlayer & operator = (IPlayer const&) = default;
50 
51 public:
52  virtual ~IPlayer() = default;
53 
58  virtual moves::Shot Play(moves::Shot const& shot) = 0;
59 
65  virtual std::string GetPlayerId() const = 0;
66 
75  virtual IPlayerFactory const& GetFactory() const = 0;
76 
80  virtual std::unique_ptr<IPlayerStorage> CreateStorage() const = 0;
81 
85  virtual void Save(IPlayerStorage & storage) const = 0;
86 
90  virtual void Load(IPlayerStorage const& storage) = 0;
91 };
92 
93 
94 
95 } // namespace digitalcurling3
96 
97 #endif // DIGITALCURLING3_I_PLAYER_HPP
digitalcurling3::moves::Shot
行動:ショット
Definition: shot.hpp:40
digitalcurling3::IPlayer::Play
virtual moves::Shot Play(moves::Shot const &shot)=0
ショットを行う.
digitalcurling3::IPlayer::GetPlayerId
virtual std::string GetPlayerId() const =0
プレイヤーIDを得る.
digitalcurling3::IPlayer
理想的なショットを与えられた際に,乱数を加えたりしてプレイヤーによるブレを付与する
Definition: i_player.hpp:45
digitalcurling3::IPlayer::Load
virtual void Load(IPlayerStorage const &storage)=0
ストレージから状態を復元する
digitalcurling3::IPlayerFactory
IPlayer を構築するためのクラスです
Definition: i_player_factory.hpp:42
shot.hpp
Shot を定義します
digitalcurling3
Digital Curling ライブラリはこの名前空間の中に定義されます
Definition: polymorphic_json.hpp:37
vector2.hpp
Vector2 を定義します
digitalcurling3::IPlayer::CreateStorage
virtual std::unique_ptr< IPlayerStorage > CreateStorage() const =0
ストレージを生成する
digitalcurling3::IPlayer::GetFactory
virtual IPlayerFactory const & GetFactory() const =0
ファクトリーを得る
digitalcurling3::IPlayerStorage
IPlayer の状態を保存するストレージ
Definition: i_player_storage.hpp:46
digitalcurling3::IPlayer::operator=
IPlayer & operator=(IPlayer const &)=default
コピー代入演算子.何もコピーしません.サブクラスでのdefault実装をサポートするためのものです.
digitalcurling3::IPlayer::Save
virtual void Save(IPlayerStorage &storage) const =0
ストレージに状態を保存する