Commit 0b74239a authored by jabapo's avatar jabapo
Browse files

knight works

parent dd5b387e
......@@ -194,7 +194,7 @@ class Game{
}
}
else if(p.t == Type::Knight){
return ((abs(startr - endr) == 1 && abs(startc - endc) == 3) || (abs(startr - endr) == 3 && abs(startc - endc) == 1));
return ((abs(startr - endr) == 1 && abs(startc - endc) == 2) || (abs(startr - endr) == 2 && abs(startc - endc) == 1));
}
else if(p.t == Type::Queen){
//should be easier, just add checks from rook and bishop into one
......@@ -410,7 +410,6 @@ class Game{
}
void DisplayChecks(){
char l = 'a';
for(int i = 8; i > 0;i--){
for(int j = 0; j < 8;j++){
std::cout << kingchecks[j][i-1].first;
......@@ -437,7 +436,7 @@ class Game{
int whitemoves = 0;
std::vector<std::pair<std::string,std::string>> movelist;
std::pair<Whitecheck,Blackcheck> kingchecks[8][8];
std::pair<int,int> knighttrasnformations[8] = {{3,1},{3,-1},{1,3},{1,-3},{-3,1},{-3,-1},{-1,-3},{-1,3}};
std::pair<int,int> knighttrasnformations[8] = {{2,1},{2,-1},{1,2},{1,-2},{-2,1},{-2,-1},{-1,-2},{-1,2}};
std::pair<int,int> bishoptransformations[4] = {{7,7},{7,-7},{-7,7},{-7,-7}};
std::pair<int,int> rooktransformations[4] = {{7,0},{0,-7},{-7,0},{0,7}};
//R: If last three moves are replicates, game ends in a draw
......
#include <string>
#include <cassert>
#include <vector>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <deque>
#include <sstream>
#include "board.cpp"
void BishopEmptyTest(){
tiles[0][0].occupied = true;
tiles[0][0].p.c = Color::White;
tiles[0][0].p.t = Type::Bishop;
tiles[0][0].p.row = 0;
tiles[0][0].p.col = 0;
tiles[0][1].occupied = true;
tiles[0][1].p.c = Color::White;
tiles[0][1].p.t = Type::Bishop;
tiles[0][1].p.row = 1;
tiles[0][1].p.col = 1;
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment