123456789101112131415161718192021222324252627282930313233 |
- #include "Position.h"
- #include <stdexcept>
- #include <iostream>
- Position::Position()
- {
- posSym = '0';
- posNum = '0';
- }
- Position::Position(char posS, char posN)
- {
- if (posS > 'H' or posN > '8' or posS < 'A' or posN < '1')
- throw std::invalid_argument("Impossible move");
- posSym = posS;
- posNum = posN;
- }
- Position::Position(char posS, int posN)
- {
- posN += '0';
- std::cout << posS << ' ' << posN << std::endl;
- if (posS > 'H' or posN > '8' or posS < 'A' or posN < '1')
- throw std::invalid_argument("Impossible move");
- posNum = posN;
- posSym = posS;
- }
- std::ostream& operator <<(std::ostream& out, Position& p)
- {
- out << p.posSym << p.posNum;
- return out;
- }
|