Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Chess
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bolla Péter
Chess
Commits
ac7c09d0
Commit
ac7c09d0
authored
1 month ago
by
Bolla Péter
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
6f1271fc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
chess.hpp
+49
-0
49 additions, 0 deletions
chess.hpp
with
49 additions
and
0 deletions
chess.hpp
0 → 100644
+
49
−
0
View file @
ac7c09d0
#ifndef CHESS_HPP
#define CHESS_HPP
#include
<vector>
enum
Type
{
Pawn
,
Rook
,
Knight
,
Bishop
,
King
,
Queen
,
Empty
};
enum
Team
{
Light
,
Dark
,
None
};
struct
Piece
{
Type
type
;
Team
team
;
};
enum
Color
{
White
,
Black
};
struct
Square
{
//the squares of the chess table
Piece
piece
;
//if there's a piece on the square this variable contains the infos, else it's Empty-None
Color
color
;
//the color of the square on the table (I could calculate from the row/column but it's simpler to store it here)
bool
occupied
;
//true if there's a piece on the square, false if not
int
row
,
column
;
//the row and column coordinates
};
class
Chess
{
public:
Chess
(
int
,
int
);
void
Move
(
int
,
int
);
void
Capture
(
int
,
int
);
bool
Occupied
(
int
,
int
);
Piece
GetPiece
(
int
,
int
);
Color
GetColor
(
int
,
int
);
Square
GetSquare
(
int
,
int
);
bool
Opponents
(
int
,
int
);
bool
CanCapture
(
int
,
int
);
~
Chess
();
protected:
std
::
vector
<
Square
>
Table
;
int
WID
,
HEIG
;
};
#endif // CHESS_HPP
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment