summaryrefslogtreecommitdiff
path: root/graphs/cpp/hot_potato/player.hh
blob: 04393050189fa29a1e2ec78048c11eafc39fd9c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once
#include <memory>
#include <string>

#include "bomb.hh"

class Player
{
public:
    Player(const std::string& name, size_t nb_presses);
    Player* get_next() const;
    void set_next(std::unique_ptr<Player> next);
    void pass_bomb(Player& receiver);
    void press_bomb();
    void set_bomb(std::unique_ptr<Bomb> bomb);
    const std::string& get_name() const;
    bool has_bomb() const;
    bool is_dead() const;

private:
    std::string name_;
    std::unique_ptr<Bomb> bomb_;
    size_t nb_presses_;
    std::unique_ptr<Player> next_;
};