title: Problem moving snake in a snake game using Turtle
body: <p>I'm trying to create an easier version of the snake game. Everything in the code looks ok for me but I can't make snake move as I want to. Can you help me why my code doesn't work? I don't understand why my code is not okay.</p>
  <p>I searched for some similar games codes, but they all used <code>time</code>. and I couldn't understand the need for that.</p>
  <p>Here is the code:</p>
  <pre class="lang-py prettyprint-override"><code>import turtle
  import random
  
  
  window = turtle.Screen()
  window.screensize(600, 600)
  window.title(&quot;Snake Eats Tomato Game&quot;)
  window.bgcolor(&quot;skyblue&quot;)
  window.tracer(0)
  
  
  snake = turtle.Turtle()
  snake.color(&quot;dark blue&quot;)
  snake.shape(&quot;square&quot;)
  snake.shapesize(1)
  snake.speed(1)
  snake.penup()
  snake.goto(0, 100)
  snake.direction = &quot;stop&quot;
  
  
  def move():
      if snake.direction == &quot;up&quot;:
          y = snake.ycor()
          snake.sety(y + 20)
  
      if snake.direction == &quot;down&quot;:
          y = snake.ycor()
          snake.sety(y - 20)
  
      if snake.direction == &quot;left&quot;:
          x = snake.xcor()
          snake.setx(x + 20)
  
      if snake.direction == &quot;right&quot;:
          x = snake.xcor()
          snake.setx(x - 20)
  
  
  point = 0
  
  point_table = turtle.Turtle()
  point_table.speed(0)
  point_table.shape(&quot;square&quot;)
  point_table.color(&quot;green&quot;)
  point_table.penup()
  point_table.hideturtle()
  point_table.goto(-200, 200)
  point_table.write(
      &quot;POİNT: {}&quot;.format(point), align=&quot;center&quot;, font=(&quot;Courier&quot;, 25, &quot;normal&quot;)
  )
  
  
  def go_left():
      if snake.direction != &quot;right&quot;:
          snake.direction = &quot;left&quot;
  
  
  def go_right():
      if snake.direction != &quot;left&quot;:
          snake.direction = &quot;right&quot;
  
  
  def go_up():
      if snake.direction != &quot;down&quot;:
          snake.direction = &quot;up&quot;
  
  
  def go_down():
      if snake.direction != &quot;up&quot;:
          snake.direction = &quot;down&quot;
  
  
  window.listen()
  window.onkey(go_left, &quot;Left&quot;)
  window.onkey(go_right, &quot;Right&quot;)
  window.onkey(go_up, &quot;Up&quot;)
  window.onkey(go_down, &quot;Down&quot;)
  
  
  tomato = turtle.Turtle()
  tomato.penup()
  tomato.color(&quot;tomato&quot;)
  tomato.shape(&quot;circle&quot;)
  tomato.speed(0)
  tomato.setposition(random.randint(-300, 300), random.randint(-300, 300))
  
  
  while True:
      window.update()
      snake.forward(3)
      move()
  
      if snake.xcor() &lt; -330 or snake.xcor() &gt; 330:
          snake.right(90)
      if snake.ycor() &lt; -330 or snake.ycor() &gt; 330:
          snake.right(90)
  
      if snake.distance(tomato) &lt; 20:
          point += 1
          point_table.clear()
          point_table.write(
              &quot;PUAN: {}&quot;.format(point), align=&quot;center&quot;, font=(&quot;Courier&quot;, 25, &quot;normal&quot;)
          )
          tomato.setposition(random.randint(-300, 300), random.randint(-300, 300))
  </code></pre>