Modified dominos.cpp