Convert piece.cpp to C++