-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreatePiece.cpp
34 lines (33 loc) · 913 Bytes
/
CreatePiece.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/////////////////////////////////
// DO NOT MODIFY THIS FILE!!!! //
/////////////////////////////////
#include <cstddef>
#include "CreatePiece.h"
#include "Pawn.h"
#include "Mystery.h"
#include "Rook.h"
#include "Knight.h"
#include "Bishop.h"
#include "Queen.h"
#include "King.h"
Piece* create_piece( char piece_designator )
{
switch( piece_designator )
{
case 'K': return new King( true );
case 'k': return new King( false );
case 'Q': return new Queen( true );
case 'q': return new Queen( false );
case 'B': return new Bishop( true );
case 'b': return new Bishop( false );
case 'N': return new Knight( true );
case 'n': return new Knight( false );
case 'R': return new Rook( true );
case 'r': return new Rook( false );
case 'P': return new Pawn( true );
case 'p': return new Pawn( false );
case 'M': return new Mystery( true );
case 'm': return new Mystery( false );
default: return NULL;
}
}