I am attempting to write a checkers program for a class project. My current problem is passing the coordinates of the pieces from one function to the next. I have 4 files RuleBase, CaseBase, Checkers, Gameloop. The rule base .h an .cpp files haven't been written yet. But the Casebase has been started along with the checkers and gameloop.
GameLoop.cpp
#include <iostream>
#include "string.h"
#include "GameLoop.h"
#include "Board.h"
using namespace std;
using std::string;
using std::cout;
using std::cin;
using std::endl;
int control = 0;
char PlayermoveX=0; //The player input for their move x coordinate
int PlayermoveY=0; // The Player input for there move y coordinate
int SandHPieces = 12; //Remaining player pieces
int NandUPieces =12; //Remaining computer pieces
CheckerBoard checkerboard;
void PlayerTurn ()
{
cout<<"Please enter your move"<<endl;
cin>> PlayermoveX;
cin>>PlayermoveY;
checkmove(PlayermoveX, PlayermoveY);
}
void ComputerTurn()
{
calls to casebase reasoning and rulebased calculates jumps and moves
}
int checkmove(int X,int Y)
{
if (((checkerboard[X+1],[Y+1]) == "S"||"N"||"X"||" ") && (checkerboard[X+1], [Y+1] == "S" ||"N"||"X"||" "))
{
cout<<"There is no valid move for this piece. Please try again"<<endl;
PlayerTurn();
};
else
cout<<" ";
}
GameLoop.h
#pragma once
#include <iostream>
//#include <string.h>
//#include <string>//
//#include "GameLoop.h"
void PlayerTurn();
void ComputerTurn();
int checkmove(int, int);