change from C to C++ for class support
implemented some of piece.cpp, fixed compile errors in piece code.