Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Einige Verbesserungsvorschlaege umgesetzt
  • Loading branch information
thomasspaeth committed Jun 20, 2012
commit 3d6e8c8ec510556788bb760ea09661fe2593dfca
108 changes: 0 additions & 108 deletions Chess/.cproject

This file was deleted.

71 changes: 0 additions & 71 deletions Chess/.project

This file was deleted.

25 changes: 15 additions & 10 deletions Chess/Interface/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,26 @@
#include "../game/brett.h"
#include <iostream>
#include <string>
#include <limits>

void Interface::einlesen(int p)
{
std::cout << "Spieler " << p << ": Bitte Zug eingeben: ";

std::cin >> p1a >> p1b >> p2a >> p2b;
do
{
std::cout << "Spieler " << p << ": Bitte Zug eingeben: ";
std::cin >> p1a >> p1b >> p2a >> p2b;

while(std::cin.bad() || std::cin.fail())
{
std::cin.clear();
std::cin.ignore(100, '\n');
std::cout << "Spieler " << p << ": Bitte Zug eingeben: ";
std::cin >> p1a >> p1b >> p2a >> p2b;
if (std::cin.fail()==false)
{
break;
}

else
{
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
}
while (true);

}

Expand Down
25 changes: 14 additions & 11 deletions Chess/Piece/bauer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <iostream>
#include <cmath>
#include <cstdlib>
#include "bauer.h"


Expand All @@ -19,18 +19,21 @@ bool Bauer::bewegungmoeglich(int a,int b,brett* brett)
{
int deltay=std::abs(b-y);
int deltax=std::abs(a-x);
int yZugrichtung = (besitzer == 1) ? (-1) : (1);
int anderer = (besitzer ==1) ? (2) : (1);

if (besitzer==1)
if ((b-y)*yZugrichtung>0)
{
if ((b<y) && (deltax==0) && (deltay==1) && (brett->besitzer(a,b)==0)) { return true;}
if ((y==6) && (deltax==0) && (deltay==2) && (brett->besitzer(a,b-1)==0) && (brett->besitzer(a,b)==0)) { return true; }
if ((b<y) && (deltax==1) && (deltay==1) && (brett->besitzer(a,b)==2)) { return true; }
}
else
{
if ((b>y) && (deltax==0) && (deltay==1) && (brett->besitzer(a,b)==0)) { return true; }
if ((y==1) && (deltax==0) && (deltay==2) && (brett->besitzer(a,b-1)==0) && (brett->besitzer(a,b)==0)) { return true; }
if ((b>y) && (deltax==1) && (deltay==1) && (brett->besitzer(a,b)==1)) { return true; }
if (deltax==0)
{
if ((deltay==1) && (brett->besitzer(a,b)==0)) { return true;}
if ((deltay==2) && ((y==6) || (y==1)) && (brett->besitzer(a,b-1)==0) && (brett->besitzer(a,b)==0)) { return true; }
}

if ((deltax==1) && (deltay==1) && (brett->besitzer(a,b)==2))
{
return true;
}
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion Chess/Piece/dame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <iostream>
#include <cmath>
#include <cstdlib>

#include "dame.h"

Expand Down
2 changes: 1 addition & 1 deletion Chess/Piece/koenig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <iostream>
#include <cmath>
#include <cstdlib>


#include "koenig.h"
Expand Down
2 changes: 1 addition & 1 deletion Chess/Piece/lauefer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <iostream>
#include <cmath>
#include <cstdlib>


#include "lauefer.h"
Expand Down
2 changes: 1 addition & 1 deletion Chess/Piece/springer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <iostream>
#include <cmath>
#include <cstdlib>

#include "springer.h"

Expand Down
2 changes: 1 addition & 1 deletion Chess/Piece/turm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <iostream>
#include <cmath>
#include <cstdlib>

#include "turm.h"

Expand Down
1 change: 1 addition & 0 deletions Chess/chess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <string>

#include "Interface/interface.h"
#include "Interface/interfaceb.h"
#include "Game/game.h"

int main()
Expand Down
1 change: 1 addition & 0 deletions Chess/game/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define GAME_H_

#include "../Interface/interface.h"
#include "../Interface/interfaceb.h"
#include "../Piece/piece.h"
#include "brett.h"

Expand Down