Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x-----o
- -------
- -------
- -------
- -------
- -------
- o-----x
- Turn: Black
- f1 f2 g2 a6 b6 b7 g1e1 g1e2 g1e3 g1f3 g1g3 a7a5 a7b5 a7c5 a7c6 a7c7
- Move: f1f2
- x-----o
- -------
- -------
- -------
- -------
- -----x-
- o-----x
- Turn: White
- b1 a2 b2 f6 g6 f7 a1c1 a1c2 a1a3 a1b3 a1c3 g7e5 g7f5 g7g5 g7e6 g7e7
- DOES NOT MAKE SENSE
- code:
- #include <iostream>
- #include "libataxx/libataxx.hpp"
- #include <string>
- int main(int argc, char **argv) {
- auto pos = libataxx::Position("startpos");
- while (!pos.gameover()) {
- // Print board
- std::cout << pos << std::endl;
- libataxx::Move moves[libataxx::max_moves];
- const int num_moves = pos.legal_moves(moves);
- for (int i = 0; i < num_moves; ++i)
- std::cout << moves[i] << " ";
- std::cout << std::endl;
- // Get move
- std::cout << "Move: ";
- std::string movestr;
- std::cin >> movestr;
- std::cout << std::endl;
- libataxx::Move new_move = libataxx::Move::from_uai(movestr);
- // Find & make move
- for (int i = 0; i < num_moves; ++i) {
- if (moves[i] == new_move) {
- pos.makemove(new_move);
- break;
- }
- }
- }
- // Print board
- std::cout << pos << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment