title: How do i make colour detection in turtle
body: <p>I have a python turtle program which is displayed below.</p>
  
  <p>i want to be able to stop game when turtle touches black or touches line but i cant find any help online!!!</p>
  
  <pre><code>import logging
  from datetime import datetime
  import time
  from turtle import *
  import winsound
  #while True:
  #    player1 = input("enter player1 name\n")
  #    break
  #while True:
  #    player2 = input("enter player2 name\n")
  #    print("Please click on window titled pacman")
  #    break
  
  
  setup(600, 600)
  Screen()
  title("Rendering")
  horse2 = Turtle()
  horse2.shape("triangle")
  horse2.color("blue")
  #making the map
  
  map1 = Turtle()
  map1.color("black")
  map1.shape("square")
  map1.forward(100)
  map1.left(90)
  map1.forward(50)
  map1.left(180)
  map1.forward(50)
  map1.right(90)
  map1.forward(100)
  map1.right(90)
  map1.forward(50)
  map1.penup()
  map1.left(90)
  map1.forward(50)
  map1.pendown()
  map1.forward(50)
  map1.right(90)
  map1.forward(50)
  map1.left(90)
  map1.forward(50)
  map1.penup()
  map1.forward(50)
  map1.left(90)
  map1.pendown()
  map1.forward(50)
  map1.forward(50)
  map1.left(90)
  map1.forward(50)
  map1.right(90)
  map1.forward(50)
  map1.left(90)
  map1.forward(50)
  map1.penup()
  map1.forward(50)
  map1.pendown()
  map1.right(90)
  map1.forward(50)
  map1.forward(50)
  map1.right(90)
  map1.forward(200)
  map1.forward(40)
  map1.right(90)
  map1.forward(400)
  map1.right(90)
  map1.forward(500)
  map1.right(90)
  map1.forward(450)
  map1.penup()
  map1.forward(50)
  map1.pendown()
  map1.right(90)
  map1.forward(500)
  map1.right(90)
  map1.forward(100)
  map1.right(90)
  map1.forward(100)
  map1.right(90)
  map1.forward(50)
  map1.left(180)
  map1.forward(50)
  map1.penup()
  map1.forward(50)
  map1.forward(50)
  map1.pendown()
  map1.left(90)
  map1.forward(50)
  map1.left(180)
  map1.forward(100)
  map1.left(180)
  map1.forward(150)
  map1.right(180)
  map1.forward(150)
  map1.penup()
  map1.forward(50)
  map1.forward(100)
  map1.right(90)
  map1.pendown()
  map1.forward(150)
  map1.right(90)
  map1.forward(100)
  map1.forward(50)
  map1.left(90)
  map1.forward(50)
  map1.right(180)
  map1.penup()
  map1.forward(100)
  map1.penup()
  map1.forward(200)
  map1.forward(50)
  map1.left(90)
  map1.forward(10)
  map1.right(90)
  map1.pendown()
  map1.forward(50)
  map1.right(90)
  map1.forward(50)
  map1.left(90)
  map1.forward(50)
  map1.right(90)
  map1.forward(50)
  map1.left(90)
  map1.penup()
  map1.forward(50)
  #making the map
  showturtle()
  hideturtle()
  horse2.penup()
  horse2.goto(-250, -100)
  title("Pacman")
  
  def k3():
      horse2.right(90)
  
  def k2():
      horse2.left(90)
      if horse2.xcor() &gt; 250:
          print(player2+" wins")
          logging.basicConfig(filename=("bobobwinner.log"), filemode='w', format='%(name)s - %(message)s')
          logging.warning(player2+' won')
  
  def k1():
      horse2.forward(20)
  
  onkey(k1, "w")
  onkey(k2, "a")
  onkey(k3, "d")
  #onkey(k4, "Left")
  #onkey(k5, "Down")
  
  listen()
  mainloop()
  </code></pre>
  
  <p>i have no error message however i have failed time after time to succeed. Please can someone help. I am well aware that turtle is a very limited game engine so if this is not possible is anybody aware how i could code my own module to supplement for colour detection in turtle.</p>