Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Introduction | Building a Classic Snake Game
Building a Classic Snake Game
course content

Зміст курсу

Building a Classic Snake Game

bookIntroduction

Hey there! Welcome to our project! We're working on this cool AI that controls a snake in a game. The only hitch is, we haven't quite figured out how to create a snake yet. That's where you come in! We need your help to make the snake smart and slithery. Let's dive in and tackle this part together! Here is the list of what we have to implement:

Feature
Description
Food ItemsFood items appear randomly on the screen. When the snake consumes a food item, it grows longer, increasing the challenge.
Snake MovementThe snake moves continuously in the game area. Players control its direction using arrow keys or designated controls. The snake cannot stop or reverse its direction.
Growing LengthAs the snake consumes food, its length increases, making navigation more difficult. The game typically speeds up as the snake grows longer, intensifying the challenge for players.
Collision DetectionThe game ends if the snake collides with itself or the boundaries of the game area.
Завдання
test

Swipe to show code editor

Let's start by importing necessary modules we will use for our snake game.

  • Import random module to the project
  • Run the test cell below to see if you did everything right.

Mark tasks as Completed
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Hey there! Welcome to our project! We're working on this cool AI that controls a snake in a game. The only hitch is, we haven't quite figured out how to create a snake yet. That's where you come in! We need your help to make the snake smart and slithery. Let's dive in and tackle this part together! Here is the list of what we have to implement:

Feature
Description
Food ItemsFood items appear randomly on the screen. When the snake consumes a food item, it grows longer, increasing the challenge.
Snake MovementThe snake moves continuously in the game area. Players control its direction using arrow keys or designated controls. The snake cannot stop or reverse its direction.
Growing LengthAs the snake consumes food, its length increases, making navigation more difficult. The game typically speeds up as the snake grows longer, intensifying the challenge for players.
Collision DetectionThe game ends if the snake collides with itself or the boundaries of the game area.
Завдання
test

Swipe to show code editor

Let's start by importing necessary modules we will use for our snake game.

  • Import random module to the project
  • Run the test cell below to see if you did everything right.

Mark tasks as Completed
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 1
AVAILABLE TO ULTIMATE ONLY
We're sorry to hear that something went wrong. What happened?
some-alt