build: created separate bin folder for each target.
Changed build process to use an individual bin/<subfolder> for each target. This way each target has its own data folder and its own set of dlls.
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
#ifndef _PLAYER_
|
||||
#define _PLAYER_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "field.h"
|
||||
|
||||
class Player {
|
||||
public:
|
||||
Player( Field::Token token, const std::string& name )
|
||||
: token_( token )
|
||||
, name_( name ) {
|
||||
}
|
||||
|
||||
virtual Field::Move Turn( const Field& field ) const = 0;
|
||||
|
||||
const Field::Token token_;
|
||||
const std::string name_;
|
||||
};
|
||||
|
||||
#endif // _PLAYER_
|
||||
@@ -1,33 +0,0 @@
|
||||
class Player {
|
||||
public:
|
||||
void Do() {}
|
||||
};
|
||||
|
||||
class Base {};
|
||||
|
||||
class Game : public Base {
|
||||
public:
|
||||
Game() {
|
||||
Init();
|
||||
}
|
||||
|
||||
void Init() {}
|
||||
|
||||
void Run() {
|
||||
player.Do();
|
||||
}
|
||||
|
||||
private:
|
||||
Player player;
|
||||
};
|
||||
|
||||
Game* game;
|
||||
|
||||
int main() {
|
||||
game = new Game();
|
||||
|
||||
game->Run();
|
||||
|
||||
delete game;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include "tictactoe.h"
|
||||
|
||||
int main() {
|
||||
TicTacToe tictactoe;
|
||||
|
||||
while ( tictactoe.Start() ) {
|
||||
tictactoe.Run();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
#ifndef _TIC_TAC_TOE_
|
||||
#define _TIC_TAC_TOE_
|
||||
|
||||
#include "computer.h"
|
||||
#include "field.h"
|
||||
#include "human.h"
|
||||
#include "input.h"
|
||||
#include "player.h"
|
||||
|
||||
class TicTacToe {
|
||||
public:
|
||||
TicTacToe() {
|
||||
players_[0] = NULL;
|
||||
players_[1] = NULL;
|
||||
}
|
||||
|
||||
~TicTacToe() {
|
||||
Reset();
|
||||
}
|
||||
|
||||
bool Start() {
|
||||
Reset();
|
||||
std::cout << "Tic Tac Toe\n\n[1] Human\n[2] Computer\n[3] Quit\n\n";
|
||||
|
||||
players_[0] = SelectPlayer( Field::PlayerA, "PlayerA" );
|
||||
if ( !players_[0] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
players_[1] = SelectPlayer( Field::PlayerB, "PlayerB" );
|
||||
if ( !players_[1] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::cout << '\n';
|
||||
return true;
|
||||
}
|
||||
|
||||
void Run() {
|
||||
field_.Show();
|
||||
|
||||
int playerIndex = 0;
|
||||
|
||||
for ( int i = 0; i < 9; i++ ) {
|
||||
Player& player = *players_[playerIndex];
|
||||
|
||||
field_.MakeMove( player.Turn( field_ ), player.token_ );
|
||||
field_.Show();
|
||||
|
||||
if ( field_.SameInRow( player.token_, 3 ) ) {
|
||||
std::cout << player.name_ << " won!\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
playerIndex = ( playerIndex + 1 ) % 2;
|
||||
}
|
||||
|
||||
std::cout << "Game ends in draw!\n\n";
|
||||
}
|
||||
|
||||
private:
|
||||
void Reset() {
|
||||
field_.Clear();
|
||||
|
||||
for ( int i = 0; i < 2; i++ ) {
|
||||
if ( players_[i] ) {
|
||||
delete players_[i];
|
||||
players_[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Player* SelectPlayer( Field::Token token, const std::string& name ) const {
|
||||
int selection;
|
||||
|
||||
while ( true ) {
|
||||
std::cout << "Choose " << name << ": ";
|
||||
input::number( &selection );
|
||||
|
||||
switch ( selection ) {
|
||||
case 1 : return new HumanPlayer( token, name );
|
||||
case 2 : return new ArtificialPlayer( token, name );
|
||||
case 3 : return NULL;
|
||||
default : std::cout << "Wrong input!\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Player* players_[2];
|
||||
Field field_;
|
||||
};
|
||||
|
||||
#endif // _TIC_TAC_TOE_
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<SourcePath>data</SourcePath>
|
||||
</config>
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
#include "test_header.h"
|
||||
|
||||
char* name;
|
||||
H g;
|
||||
|
||||
int ceil(float a)
|
||||
{
|
||||
return static_cast<int>(a) + 1;
|
||||
}
|
||||
|
||||
namespace X
|
||||
{
|
||||
struct A;
|
||||
|
||||
enum E
|
||||
{
|
||||
P,
|
||||
Q
|
||||
};
|
||||
}
|
||||
|
||||
class B
|
||||
{
|
||||
public:
|
||||
class C
|
||||
{
|
||||
static const int amount;
|
||||
};
|
||||
|
||||
B();
|
||||
|
||||
virtual ~B()
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void process() = 0;
|
||||
|
||||
private:
|
||||
int getCount() const
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
const int count;
|
||||
H h;
|
||||
};
|
||||
|
||||
B::B()
|
||||
: count(0)
|
||||
{
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
int sum(int a, int b)
|
||||
{
|
||||
int c = a + b;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
typedef unsigned int uint;
|
||||
|
||||
class H
|
||||
{
|
||||
private:
|
||||
int width;
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
"If you're a researcher on this book thing and you were on Earth, you must have been gathering material on it."
|
||||
"Well, I was able to extend the original entry a bit, yes."
|
||||
"Let me see what it says in this edition, then. I've got to see it."
|
||||
... "What? Harmless! Is that all it's got to say? Harmless! One word! ... Well, for God's sake I hope you managed to recitify that a bit."
|
||||
"Oh yes, well I managed to transmit a new entry off to the editor. He had to trim it a bit, but it's still an improvement."
|
||||
"And what does it say now?" asked Arthur.
|
||||
"Mostly harmless," admitted Ford with a slightly embarrassed cough.
|
||||
Reference in New Issue
Block a user