File size: 2,451 Bytes
6c90348
 
 
 
 
 
 
 
 
 
 
a9137b9
6c90348
f77da6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6c90348
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
base_model: unsloth/mistral-7b-v0.3-bnb-4bit
language:
- en
license: apache-2.0
tags:
- text-generation-inference
- transformers
- unsloth
- mistral
- trl
- sft
---
```python
<s> Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.

### Input:
Write a code to create the snake game

### Output:

```python
import pygame
import random

# Initialize the pygame library
pygame.init()

# Set the width and height of the game window
width = 600
height = 600

# Set the title of the game window
pygame.display.set_caption("Snake Game")

# Create a white background surface
background = pygame.Surface((width, height))
background.fill((255, 255, 255))

# Create a snake object
snake = []
snake.append([width // 2, height // 2])

# Create a food object
food = [random.randint(0, width - 1), random.randint(0, height - 1)]

# Create a clock object to control the game speed
clock = pygame.time.Clock()

# Game loop
running = True
while running:
   # Handle events
   for event in pygame.event.get():
       if event.type == pygame.QUIT:
           running = False

   # Move the snake
   keys = pygame.key.get_pressed()
   if keys[pygame.K_LEFT]:
       snake.append([snake[-1][0] - 10, snake[-1][1]])
   elif keys[pygame.K_RIGHT]:
       snake.append([snake[-1][0] + 10, snake[-1][1]])
   elif keys[pygame.K_UP]:
       snake.append([snake[-1][0], snake[-1][1] - 10])
   elif keys[pygame.K_DOWN]:
       snake.append([snake[-1][0], snake[-1][1] + 10])

   # Check if the snake has eaten the food
   if snake[-1] == food:
       food = [random.randint(0, width - 1), random.randint(0, height - 1)]

   # Check if the snake has hit a wall or itself
   if snake[-1][0] < 0 or snake[-1][0] >= width or snake[-1][1] < 0 or snake[-1][1] >= height or snake[-1] in snake[:-1]:
       running = False

   # Update the game window
   pygame.display.update()
   clock.tick(10)

# Quit the pygame library
pygame.quit()
```</s>
````



# Uploaded  model

- **Developed by:** Ramikan-BR
- **License:** apache-2.0
- **Finetuned from model :** unsloth/mistral-7b-v0.3-bnb-4bit

This mistral model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.

[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)