game converted to object oriented js