Fixed Many Error

fixed many error, some debug functions are there, pieceboard1.cpp is old
version