program now detects clicks on tiles