Spy strategy (max liberties rule), code refactoring