updated trick.cpp