implement winner logic