Ported crazyhouse MoveFactory and LegalityChecker.
[tagua/yd.git] / src / hlvariant / movefactory.h
blob70eec014059caf59555405e9d88dab2fa73a4e02
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #ifndef HLVARIANT__MOVEFACTORY_H
12 #define HLVARIANT__MOVEFACTORY_H
14 #include "tagua.h"
15 #include "usermove.h"
16 #include "variantdata.h"
18 namespace HLVariant {
20 template <typename GameState>
21 class MoveFactory {
22 public:
23 typedef typename GameState::Move Move;
24 typedef typename GameState::Board::Piece Piece;
26 virtual ~MoveFactory() { }
28 virtual Move createNormalMove(const NormalUserMove& move) {
29 return Move(move.from, move.to, static_cast<typename Piece::Type>(move.promotionType));
32 virtual Move createDropMove(const DropUserMove&) {
33 return Move();
36 virtual NormalUserMove toNormal(const Move& move) {
37 return NormalUserMove(move.from(), move.to());
43 #endif // HLVARIANT__MOVEFACTORY_H