-
Notifications
You must be signed in to change notification settings - Fork 0
/
MovesList.h
108 lines (101 loc) · 3.13 KB
/
MovesList.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//moveslist.h
#pragma once
#include "stdafx.h"
#define SQUARE_SIZE 40
#define BOARD_SIZE 8
#define WALL_SIZE 2
#define RED 1
#define BLUE -1
#define KING 2
#define MAX_CHECKERS 12
#define WALL -9
#define GAMEBOARD_SIZE (BOARD_SIZE + WALL_SIZE * 2)
#define PLUS_INFINITY 100000
#define MINUS_INFINITY -100000
#define NONE -1
#define INIT_GRADE -999
#define MAX_MOVES 4
enum MoveType { NOMOVE,MOVE,JUMP,MULTIJUMP };
enum CHECKERS {BLUEKING = -2,BLUECHECKER,EMPTY,REDCHECKER,REDKING};
enum GameStatus { GAMEOVER = -1, NOGAME, SINGLE, MULTIPLAYER };
//-----------------------------------------------------------------------
// CMovesList
// ==========
//
// General : This class represents the list which contains nodes
// for storing multiple jumps and possibilites
//
// Methods : GetHead - returns the pointer on the head of the list
// GetLast - returns the pointer on the tail of the list
// AddNode - adds recieved node to the list
// DeleteList - deletes the list and all the nodes in it
//
//-----------------------------------------------------------------------
// Programmer : Sergey Borovik
// Email : sbsergey@hotmail.com
// Date : 27/04/04
//-----------------------------------------------------------------------
class CMovesNode;
class CMovesList
{
CMovesNode *head;
CMovesNode *last;
public:
int count;
CMovesList(void);
~CMovesList(void);
CMovesNode* GetHead();
CMovesNode* GetLast();
void AddNode(CMovesNode*);
void DeleteList();
};
//-----------------------------------------------------------------------
// CMovesNode
// ==========
//
// General : This class represents the Node from which list is made
// It contains the pointer to the next Node, and to the
// next list
//
// Methods : GetNext - returns the next node
// GetNextList - returns the next list
// GetGrade - returns the grade
// GetCoordinats - returns all the coordinats info
//
// SetNext - sets new next node
// SetNextList - sets new next list
// SetGrade - sets new grade
// SetDestCoordinats - sets new destination coordinats
// SetCoordinats - sets new coordinats info
//
// IsFree - returns if the node has info or not
// CopyData - copies data from one node to another
//
//-----------------------------------------------------------------------
// Programmer : Sergey Borovik
// Email : sbsergey@hotmail.com
// Date : 27/04/04
//-----------------------------------------------------------------------
class CMovesNode
{
int pointX,pointY;
int destX,destY;
CMovesNode *next;
CMovesList *nextList;
float grade;
public:
CMovesNode(int,int,POINT);
CMovesNode();
~CMovesNode(void);
CMovesList** GetNextList();
CMovesNode* GetNext();
bool IsFree();
void SetNext(CMovesNode*);
void GetCoordinats(int&,int&,int&, int&);
void SetCoordinats(int,int,POINT);
void SetNextList(CMovesList*);
float GetGrade();
void SetGrade(float);
void SetDestCoordinats(POINT);
void CopyData(CMovesNode*);
};