-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from KaVoshnik/class_id
Class
- Loading branch information
Showing
6 changed files
with
211 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "linux-gcc-x64", | ||
"includePath": [ | ||
"${workspaceFolder}/**" | ||
], | ||
"compilerPath": "/usr/bin/gcc", | ||
"cStandard": "${default}", | ||
"cppStandard": "${default}", | ||
"intelliSenseMode": "linux-gcc-x64", | ||
"compilerArgs": [ | ||
"" | ||
] | ||
} | ||
], | ||
"version": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "C/C++ Runner: Debug Session", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"externalConsole": false, | ||
"cwd": "/home/user/Chess_2", | ||
"program": "/home/user/Chess_2/build/Debug/outDebug", | ||
"MIMode": "gdb", | ||
"miDebuggerPath": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"C_Cpp_Runner.cCompilerPath": "gcc", | ||
"C_Cpp_Runner.cppCompilerPath": "g++", | ||
"C_Cpp_Runner.debuggerPath": "gdb", | ||
"C_Cpp_Runner.cStandard": "", | ||
"C_Cpp_Runner.cppStandard": "", | ||
"C_Cpp_Runner.msvcBatchPath": "", | ||
"C_Cpp_Runner.useMsvc": false, | ||
"C_Cpp_Runner.warnings": [ | ||
"-Wall", | ||
"-Wextra", | ||
"-Wpedantic", | ||
"-Wshadow", | ||
"-Wformat=2", | ||
"-Wcast-align", | ||
"-Wconversion", | ||
"-Wsign-conversion", | ||
"-Wnull-dereference" | ||
], | ||
"C_Cpp_Runner.msvcWarnings": [ | ||
"/W4", | ||
"/permissive-", | ||
"/w14242", | ||
"/w14287", | ||
"/w14296", | ||
"/w14311", | ||
"/w14826", | ||
"/w44062", | ||
"/w44242", | ||
"/w14905", | ||
"/w14906", | ||
"/w14263", | ||
"/w44265", | ||
"/w14928" | ||
], | ||
"C_Cpp_Runner.enableWarnings": true, | ||
"C_Cpp_Runner.warningsAsError": false, | ||
"C_Cpp_Runner.compilerArgs": [], | ||
"C_Cpp_Runner.linkerArgs": [], | ||
"C_Cpp_Runner.includePaths": [], | ||
"C_Cpp_Runner.includeSearch": [ | ||
"*", | ||
"**/*" | ||
], | ||
"C_Cpp_Runner.excludeSearch": [ | ||
"**/build", | ||
"**/build/**", | ||
"**/.*", | ||
"**/.*/**", | ||
"**/.vscode", | ||
"**/.vscode/**" | ||
], | ||
"C_Cpp_Runner.useAddressSanitizer": false, | ||
"C_Cpp_Runner.useUndefinedSanitizer": false, | ||
"C_Cpp_Runner.useLeakSanitizer": false, | ||
"C_Cpp_Runner.showCompilationTime": false, | ||
"C_Cpp_Runner.useLinkTimeOptimization": false, | ||
"C_Cpp_Runner.msvcSecureNoWarnings": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//#include <iostream> | ||
#include "chess_object.h" | ||
|
||
//using std::cout; | ||
|
||
// белые 1 - пешка 2 - ферзь 3 - конь 4 - слон 5 - королева 6 - король 123456 | ||
// негры p - пешка f - ферзь k - конь s = слон q - королева k - король pfksqk | ||
|
||
void start_8_8(char ret[8][8]){ | ||
|
||
for(int a = 0; a < 8; a++){ | ||
for(int b = 0; b < 8; b++){ | ||
ret[a][b] = '0'; | ||
} | ||
} | ||
// фигуры вверх | ||
ret[0][0] = 's'; | ||
ret[0][1] = 'k'; | ||
ret[0][2] = 'f'; | ||
ret[0][3] = 'q'; | ||
ret[0][4] = 'k'; | ||
ret[0][5] = 'f'; | ||
ret[0][6] = 'k'; | ||
ret[0][7] = 's'; | ||
// фигуры низ | ||
ret[7][0] = '4'; | ||
ret[7][1] = '3'; | ||
ret[7][2] = '2'; | ||
ret[7][3] = '5'; | ||
ret[7][4] = '6'; | ||
ret[7][5] = '2'; | ||
ret[7][6] = '3'; | ||
ret[7][7] = '4'; | ||
// пешки низ | ||
ret[6][0] = '1'; | ||
ret[6][1] = '1'; | ||
ret[6][2] = '1'; | ||
ret[6][3] = '1'; | ||
ret[6][4] = '1'; | ||
ret[6][5] = '1'; | ||
ret[6][6] = '1'; | ||
ret[6][7] = '1'; | ||
|
||
// пешки вверх | ||
ret[1][0] = 'p'; | ||
ret[1][1] = 'p'; | ||
ret[1][2] = 'p'; | ||
ret[1][3] = 'p'; | ||
ret[1][4] = 'p'; | ||
ret[1][5] = 'p'; | ||
ret[1][6] = 'p'; | ||
ret[1][7] = 'p'; | ||
} | ||
|
||
|
||
int main(){ | ||
|
||
char board[8][8]; | ||
|
||
|
||
start_8_8(board); | ||
|
||
for(int a = 0; a < 8; a++){ | ||
for(int b = 0; b < 8; b++){ | ||
cout << board[a][b] << " "; | ||
} | ||
cout << '\n'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef chess_object_h | ||
#define chess_object_h | ||
#include <iostream> | ||
#include <string> | ||
|
||
using std::cout; | ||
|
||
class Piece { | ||
|
||
public: | ||
Piece(Color color, PieceType type, int row, int col): //Конструктор | ||
color(color), type(type), row(row), col(col) {} | ||
|
||
getColor() const { | ||
return color; | ||
} //Цвет фигуры | ||
getType() const { | ||
return type; | ||
} //Тип фигуры | ||
|
||
int getRow() const { | ||
return row; | ||
} | ||
int getCol() const { | ||
return col; | ||
} | ||
void setRow(int newRow)const { | ||
row = newRow; | ||
} | ||
void setCol(int newCol) const { | ||
col = newCol; | ||
} | ||
|
||
private: | ||
Color color; | ||
PieceType type; | ||
int row; | ||
int col; | ||
} | ||
|
||
#endif |
Binary file not shown.