post
poster: psYchotic
description: Knight's tour solver: main
language: C++
[download]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <sstream>
#include "ktourboard.h"
#include "pos.h"

using namespace std;

int main(int argc, char **argv) {
    int width, height, x, y;
    stringstream(argv[1]) >> width;
    stringstream(argv[2]) >> height;
    stringstream(argv[3]) >> x;
    stringstream(argv[4]) >> y;
    
    KTourBoard board(width, height);
    board.setPos(Pos(x, y));
    board.solve();

    cout << board;

    return 0;
}