-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDummyPlayers.h
54 lines (45 loc) · 1.3 KB
/
DummyPlayers.h
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
*header file of classes XYPlayer,YXPlayer,IllegalPlayer and ExceptionPlayer
*Author Erel Segal-Halevi
*From https://github.com/erelsgl/ariel-cpp-5778/tree/master/week06-inheritance/homework
*Version 1.0
**/
#pragma once
#include "Player.h"
/*
This player scans the board looping on x then on y,
and plays on the first empty cell.
*/
class XYPlayer: public Player {
public:
const string name() const override { return "XYPlayer"; }
const Coordinate play(const Board& board) override;
};
/*
This player scans the board looping on y then on x,
and plays on the first empty cell.
*/
class YXPlayer: public Player {
public:
const string name() const override { return "YXPlayer"; }
const Coordinate play(const Board& board) override;
};
/*
This player makes illegal moves -
it tries to override cells of the other player.
It should always lose.
*/
class IllegalPlayer: public Player {
public:
const string name() const override { return "YXPlayer"; }
const Coordinate play(const Board& board) override;
};
/*
This player always throws an exception.
It should always lose.
*/
class ExceptionPlayer: public Player {
public:
const string name() const override { return "YXPlayer"; }
const Coordinate play(const Board& board) override;
};