2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2007 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.
11 #ifndef HLVARIANT__CRAZYHOUSE__SERIALIZER_H
12 #define HLVARIANT__CRAZYHOUSE__SERIALIZER_H
14 #include "../chess/serializer.h"
17 namespace Crazyhouse
{
19 template <typename MoveGenerator
>
20 class Serializer
: public Chess::Serializer
<MoveGenerator
> {
21 typedef Chess::Serializer
<MoveGenerator
> Base
;
22 typedef typename
Base::GameState GameState
;
23 typedef typename
Base::Piece Piece
;
24 typedef typename
Base::Move Move
;
29 virtual QString
serialize(const Move
& move
, const GameState
& ref
);
34 template <typename MoveGenerator
>
35 Serializer
<MoveGenerator
>::Serializer(int rep
)
38 template <typename MoveGenerator
>
39 QString Serializer
<MoveGenerator
>::serialize(const Move
& move
, const GameState
& ref
) {
40 if (move
.drop() == Piece()) {
41 return Base::serialize(move
, ref
);
48 res
= symbol(move
.drop().type()).toUpper();
50 res
= "{" + move
.drop().typeName() + '}';
53 return res
+ '@' + move
.to().toString(ref
.board().size().y
) + suffix(move
, ref
);
57 } // namespace Crazyhouse
58 } // namespace HLVariant
60 #endif // HLVARIANT__CRAZYHOUSE__SERIALIZER_H