2014-12-16 13:12:53 +00:00
|
|
|
#include "board.h"
|
2014-12-16 13:12:51 +00:00
|
|
|
|
2014-12-16 13:12:54 +00:00
|
|
|
#include <iostream> // std::cout
|
|
|
|
|
2014-12-16 13:12:55 +00:00
|
|
|
#include "unitv.h"
|
2014-12-16 13:12:54 +00:00
|
|
|
|
|
|
|
// Namespace for testing functions
|
|
|
|
namespace tests
|
|
|
|
{
|
|
|
|
// print a board
|
|
|
|
void debug_print( CBoard& b )
|
|
|
|
{
|
|
|
|
for ( unsigned int r = 0; r < b.rows; r++ )
|
|
|
|
{
|
|
|
|
for ( unsigned int c = 0; c < b.cols; c++ )
|
|
|
|
{
|
|
|
|
std::cout<<(char)(b.get(c,r));
|
|
|
|
}
|
|
|
|
std::cout<<std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test the board data class
|
|
|
|
void test_CBoard()
|
|
|
|
{
|
|
|
|
CBoard board = CBoard(10,5);
|
|
|
|
|
|
|
|
std::cout<<"Blank board"<<std::endl;
|
|
|
|
board.clear();
|
|
|
|
debug_print(board);
|
|
|
|
|
|
|
|
std::cout<<"Filled board"<<std::endl;
|
|
|
|
board.fill(48);
|
|
|
|
debug_print(board);
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-16 13:12:51 +00:00
|
|
|
// Main program entry point
|
|
|
|
int main()
|
|
|
|
{
|
2014-12-16 13:12:53 +00:00
|
|
|
tests::test_CBoard();
|
2014-12-16 13:12:55 +00:00
|
|
|
|
2014-12-16 13:12:56 +00:00
|
|
|
{
|
|
|
|
CUnitV myV;
|
|
|
|
std::cout<<myV.getVisual()<<std::endl;
|
|
|
|
}
|
2014-12-16 13:12:55 +00:00
|
|
|
|
2014-12-16 13:12:56 +00:00
|
|
|
{
|
|
|
|
std::unique_ptr<CUnit> myV = CUnit::getUnitFromVis('v');
|
|
|
|
std::cout<<myV->getVisual()<<std::endl;
|
|
|
|
}
|
2014-12-16 13:12:51 +00:00
|
|
|
};
|