December 16, 2024
Your Ultimate Guide to Epic Online Adventures
game snake game
LIVE FEATURED

game snake game

4.4 (1010 reviews)
5★
70%
4★
20%
3★
7%
2★
2%
1★
1%
Fantasy MMORPG PvE Raids Guilds

Snake Game Here's a simple implementation of the classic Snake game in Python using Pygame: python import pygame import random import time # Initialize pygame pygame.init() # Colors WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) # Screen dimensions WIDTH, HEIGHT = 600, 400 GRID_SIZE = 20 GRID_WIDTH = WIDTH // GRID_SIZE GRID_HEIGHT = HEIGHT // GRID_SIZE # Directions UP = (0, -1) DOWN = (0, 1) LEFT = (-1, 0) RIGHT = (1, 0) # Set up the display screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption('Snake Game') clock = pygame.time.Clock() def draw_grid(): for x in range(0, WIDTH, GRID_SIZE): pygame.draw.line(screen, WHITE, (x, 0), (x, HEIGHT), 1) for y in range(0, HEIGHT, GRID_SIZE): pygame.draw.line(screen, WHITE, (0, y), (WIDTH, y), 1) class Snake: def init(self): self.positions = [(GRID_WIDTH // 2, GRID_HEIGHT // 2)] self.direction = RIGHT self.length = 1 self.score = 0 def get_head_position(self): return self.positions[0] def move(self): head = self.get_head_position() x, y = self.direction new_head = ((head[0] + x) % GRID_WIDTH, (head[1] + y) % GRID_HEIGHT) if new_head in self.positions[1:]: return False # Game over self.positions.insert(0, new_head) if len(self.positions) > self.length: self.positions.pop() return True def grow(self): self.length += 1 self.score += 1 def change_direction(self, direction): # Prevent 180-degree turns if (direction[0] * -1, direction[1] * -1) != self.direction: self.direction = direction def draw(self): for position in self.positions: rect = pygame.Rect(position[0] * GRID_SIZE, position[1] * GRID_SIZE, GRID_SIZE, GRID_SIZE) pygame.draw.rect(screen, GREEN, rect) pygame.draw.rect(screen, BLACK, rect, 1) class Food: def init(self): self.position = (0, 0) self.randomize_position() def randomize_position(self): self.position = (random.randint(0, GRID_WIDTH - 1), random.randint(0, GRID_HEIGHT - 1)) def draw(self): rect = pygame.Rect(self.position[0] * GRID_SIZE, self.position[1] * GRID_SIZE, GRID_SIZE, GRID_SIZE) pygame.draw.rect(screen, RED, rect) pygame.draw.rect(screen, BLACK, rect, 1) def main(): snake = Snake() food = Food() game_over = False while not game_over: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() return elif event.type == pygame.KEYDOWN: if event.key == pygame.K_UP: snake.change_direction(UP) elif event.key == pygame.K_DOWN: snake.change_direction(DOWN) elif event.key == pygame.K_LEFT: snake.change_direction(LEFT) elif event.key == pygame.K_RIGHT: snake.change_direction(RIGHT) if not snake.move(): game_over = True break if snake.get_head_position() == food.position: snake.grow() food.randomize_position() # Make sure food doesn't spawn on snake while food.position in snake.positions: food.randomize_position() screen.fill(BLACK) draw_grid() snake.draw() food.draw() # Display score font = pygame.font.SysFont('Arial', 20) score_text = font.render(f'Score: {snake.score}', True, WHITE) screen.blit(score_text, (5, 5)) pygame.display.update() clock.tick(10) # Controls game speed # Game over screen font = pygame.font.SysFont('Arial', 36) game_over_text = font.render('Game Over!', True, WHITE) score_text = font.render(f'Final Score: {snake.score}', True, WHITE) screen.blit(game_over_text, (WIDTH // 2 - 100, HEIGHT // 2 - 50)) screen.blit(score_text, (WIDTH // 2 - 120, HEIGHT // 2 + 10)) pygame.display.update() time.sleep(3) pygame.quit() if name == "main": main() ## How to Play: 1. Use arrow keys (, , , ) to control the snake 2. Eat the red food to grow longer and increase your score 3. Avoid hitting the walls or yourself ## Requirements: - Python 3.x - Pygame library (install with pip install pygame) ## Features: - Score tracking - Grid visualization - Game over screen with final score - Snake grows when eating food - Prevent 180-degree turns You can customize the game by adjusting: - GRID_SIZE to change the size of the snake and food - clock.tick(10) to change game speed - Colors by modifying the RGB values

2.1M
Online Players
2022
Release Date
PC/Mac
Platforms
Multi
Languages

About This Game

Snake Game Here's a simple implementation of the classic Snake game in Python using Pygame: python import pygame import...

Key Features

  • Massive open world with diverse environments
  • Rich storyline spanning multiple expansions
  • Challenging dungeons and raids
  • Player vs Player combat systems
  • Guild system for team play
  • Extensive character customization
  • Regular content updates

Latest Expansion: The War Within

Venture into the depths of Azeroth itself in this groundbreaking expansion. Face new threats emerging from the planet's core, explore mysterious underground realms, and uncover secrets that will reshape your understanding of the Warcraft universe forever.

Game Information

Developer: Blizzard Entertainment
Publisher: Activision Blizzard
Release Date: November 23, 2004
Genre: MMORPG
Players: Massively Multiplayer

Subscription Plans

$14.99/month Monthly
$41.97/3 months Quarterly
Screenshot 1
Screenshot 2
Screenshot 3
Screenshot 4
Screenshot 5
Screenshot 6

Minimum Requirements

OS: Windows 10 64-bit
Processor: Intel Core i5-3450 / AMD FX 8300
Memory: 4 GB RAM
Graphics: NVIDIA GeForce GTX 760 / AMD Radeon RX 560
DirectX: Version 12
Storage: 70 GB available space

Recommended Requirements

OS: Windows 11 64-bit
Processor: Intel Core i7-6700K / AMD Ryzen 7 2700X
Memory: 8 GB RAM
Graphics: NVIDIA GeForce GTX 1080 / AMD Radeon RX 5700 XT
DirectX: Version 12
Storage: 70 GB SSD space

Player Reviews

EpicGamer42
December 15, 2024
5.0

Amazing expansion!

The War Within brings so much fresh content to WoW. The new zones are absolutely stunning and the storyline is engaging. Been playing for 15 years and this expansion reignited my passion for the game.

RaidLeader99
December 12, 2024
4.0

Great raids, some bugs

The new raid content is fantastic with challenging mechanics. However, there are still some bugs that need to be ironed out. Overall a solid expansion that keeps me coming back for more.

Latest News & Updates

News

Patch 11.0.5 Now Live

Major balance changes to all classes, new dungeon difficulty, and holiday events are now available. Check out the full patch notes for details.

December 14, 2024 Blizzard Entertainment
News

Holiday Event: Winter's Veil

Celebrate the season with special quests, unique rewards, and festive activities throughout Azeroth. Event runs until January 2nd.

December 10, 2024 Community Team