Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "chessBoard.h"
- #define WAR
- int main( int argc, char* argv[] )
- {
- if( argc != 3 )
- {
- printf( " Za malo argumentow \n\n" );
- return -1;
- }
- //szachownica (wsp)
- // y0
- // 5
- // 4
- // 3
- // 2
- // 1
- // 1 2 3 4 5 x0
- #ifndef WAR
- int x0 = atoi( argv[ 1 ] );//1
- int y0 = atoi( argv[ 2 ] );//5
- #else
- int x0 = 1;
- int y0 = 8;
- #endif
- if( x0 > CHESSBOARD_SIZE || x0 < 1 || y0 > CHESSBOARD_SIZE || y0 < 1 )
- {
- printf( " Zle parametry \n\n" );
- return 0;
- }
- int** chess_board = createChessBoard( CHESSBOARD_SIZE );
- point offset[ HORSE_MOVES ] = { {2,1}, {1,2}, {-1,2}, {-2,1}, {-2,-1}, {-1,-2}, {1,-2}, {2,-1} };
- // 0 1 2 3 4 5 6 7
- if( root( chess_board, CHESSBOARD_SIZE, 1, x0-1, y0-1, offset ) )
- printChessBoard( chess_board, CHESSBOARD_SIZE );
- else
- printf( " BLAD : nie udalo sie znalezc drogi skoczka z zadanej pozycji\n\n" );
- freeChessBoard( &chess_board );
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement