Games, codes and logic