예제 #1
0
int main()
{
	std::vector<std::string> s;
	s.push_back("....o.");
	s.push_back("...o..");
	s.push_back("..o...");
	s.push_back(".o....");
	s.push_back("o.....");
	s.push_back("......");

	FoxAndGomoku g;
	std::string num = g.win(s);
	std::cout << num << "\n";
}
예제 #2
0
// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
bool KawigiEdit_RunTest(int testNum, vector <string> p0, bool hasAnswer, string p1) {
	cout << "Test " << testNum << ": [" << "{";
	for (int i = 0; int(p0.size()) > i; ++i) {
		if (i > 0) {
			cout << ",";
		}
		cout << "\"" << p0[i] << "\"";
	}
	cout << "}";
	cout << "]" << endl;
	FoxAndGomoku *obj;
	string answer;
	obj = new FoxAndGomoku();
	clock_t startTime = clock();
	answer = obj->win(p0);
	clock_t endTime = clock();
	delete obj;
	bool res;
	res = true;
	cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl;
	if (hasAnswer) {
		cout << "Desired answer:" << endl;
		cout << "\t" << "\"" << p1 << "\"" << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << "\"" << answer << "\"" << endl;
	if (hasAnswer) {
		res = answer == p1;
	}
	if (!res) {
		cout << "DOESN'T MATCH!!!!" << endl;
	} else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) {
		cout << "FAIL the timeout" << endl;
		res = false;
	} else if (hasAnswer) {
		cout << "Match :-)" << endl;
	} else {
		cout << "OK, but is it right?" << endl;
	}
	cout << "" << endl;
	return res;
}
예제 #3
0
int main(){

	FoxAndGomoku f;
	std::vector<string> v;
	v.push_back("..o.oo");
	v.push_back(".o.ooo");
	v.push_back(".oo..o");
	v.push_back("o..ooo");
	v.push_back("o..o.o");
	v.push_back("oo...o");
	cout<<f.win(v)<<endl;
	v.clear();
	// {"....o", "...o.", "..o..", ".o...", "o...."}
	v.push_back("....o");
	v.push_back("...o.");
	v.push_back("..o..");
	v.push_back(".o...");
	v.push_back("o....");
	cout<<f.win(v)<<endl;
	return 0;
}
예제 #4
0
// BEGIN CUT HERE
void main( int argc, char* argv[] ) {
    {
        string boardARRAY[] = {"....o.",
            "...o..",
            "..o...",
            ".o....",
            "o.....",
            "......"};
        vector <string> board( boardARRAY, boardARRAY+ARRSIZE(boardARRAY) );
        FoxAndGomoku theObject;
        eq(0, theObject.win(board),"found");
    }
    {
        string boardARRAY[] = {"oooo.",
            ".oooo",
            "oooo.",
            ".oooo",
            "....."}
            ;
        vector <string> board( boardARRAY, boardARRAY+ARRSIZE(boardARRAY) );
        FoxAndGomoku theObject;
        eq(1, theObject.win(board),"not found");
    }
    {
        string boardARRAY[] = {"oooo.",
            ".oooo",
            "oooo.",
            ".oooo",
            "....o"}
            ;
        vector <string> board( boardARRAY, boardARRAY+ARRSIZE(boardARRAY) );
        FoxAndGomoku theObject;
        eq(2, theObject.win(board),"found");
    }
    {
        string boardARRAY[] = {"o.....",
            ".o....",
            "..o...",
            "...o..",
            "....o.",
            "......"};
        vector <string> board( boardARRAY, boardARRAY+ARRSIZE(boardARRAY) );
        FoxAndGomoku theObject;
        eq(3, theObject.win(board),"found");
    }
    {
        string boardARRAY[] = {"o....",
            "o.o..",
            "o.o.o",
            "o.o..",
            "o...."};
        vector <string> board( boardARRAY, boardARRAY+ARRSIZE(boardARRAY) );
        FoxAndGomoku theObject;
        eq(4, theObject.win(board),"found");
    }
    {
        string boardARRAY[] = {"..........",
            "..........",
            "..oooooo..",
            "..o.......",
            "..o.......",
            "..oooooo..",
            ".......o..",
            ".......o..",
            "..oooooo..",
            ".........."}
            
           ;
        vector <string> board( boardARRAY, boardARRAY+ARRSIZE(boardARRAY) );
        FoxAndGomoku theObject;
        eq(5, theObject.win(board),"found");
    }
    {
        string boardARRAY[] = {"..........",
            "..........",
            "..oooo.o..",
            "..o.......",
            "..o.......",
            "..o.oooo..",
            ".......o..",
            ".......o..",
            "..oooo.o..",
            ".........."}
           ;
        vector <string> board( boardARRAY, boardARRAY+ARRSIZE(boardARRAY) );
        FoxAndGomoku theObject;
        eq(6, theObject.win(board),"not found");
    }
    {
        string boardARRAY[] = {"ooooo",
            "ooooo",
            "ooooo",
            "ooooo",
            "ooooo"};
        vector <string> board( boardARRAY, boardARRAY+ARRSIZE(boardARRAY) );
        FoxAndGomoku theObject;
        eq(7, theObject.win(board),"found");
    }
    {
        string boardARRAY[] = {".....",
            ".....",
            ".....",
            ".....",
            "....."};
        vector <string> board( boardARRAY, boardARRAY+ARRSIZE(boardARRAY) );
        FoxAndGomoku theObject;
        eq(8, theObject.win(board),"not found");
    }
}