Ramikan-BR
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -14,6 +14,84 @@ tags:
|
|
14 |
- gguf-my-repo
|
15 |
---
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
# Ramikan-BR/P3-mini-v6-Q8_0-GGUF
|
18 |
This model was converted to GGUF format from [`Ramikan-BR/P3-mini-v6`](https://huggingface.co/Ramikan-BR/P3-mini-v6) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
|
19 |
Refer to the [original model card](https://huggingface.co/Ramikan-BR/P3-mini-v6) for more details on the model.
|
|
|
14 |
- gguf-my-repo
|
15 |
---
|
16 |
|
17 |
+
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
18 |
+
|
19 |
+
### Input:
|
20 |
+
Write a code to create the snake game
|
21 |
+
|
22 |
+
### Output:
|
23 |
+
|
24 |
+
Here is a simple implementation of the classic Snake game in Python using the Pygame library. This code will create a window with a snake that moves in a grid, eating apples and growing in length.
|
25 |
+
|
26 |
+
```python
|
27 |
+
import pygame
|
28 |
+
import random
|
29 |
+
import time
|
30 |
+
|
31 |
+
# Initialize Pygame
|
32 |
+
pygame.init()
|
33 |
+
|
34 |
+
# Set the dimensions of the window
|
35 |
+
width, height = 640, 480
|
36 |
+
screen = pygame.display.set_mode((width, height))
|
37 |
+
pygame.display.set_caption('Snake Game')
|
38 |
+
|
39 |
+
# Define colors
|
40 |
+
white = (255, 255, 255)
|
41 |
+
black = (0, 0, 0)
|
42 |
+
red = (255, 0, 0)
|
43 |
+
green = (0, 255, 0)
|
44 |
+
|
45 |
+
# Define the snake
|
46 |
+
snake_pos = [20, 20]
|
47 |
+
snake_dir = [1, 0]
|
48 |
+
snake_size = 16
|
49 |
+
snake_length = 1
|
50 |
+
|
51 |
+
# Define the apple
|
52 |
+
apple_pos = [random.randint(20, 300), randomative(20, 300)
|
53 |
+
apple_size = 16
|
54 |
+
|
55 |
+
# Define the clock
|
56 |
+
clock = pygame.time.Clock()
|
57 |
+
|
58 |
+
# Game loop
|
59 |
+
running = True
|
60 |
+
while running:
|
61 |
+
# Handle events
|
62 |
+
for event in pygame.event.get():
|
63 |
+
if event.type == pygame.QUIT:
|
64 |
+
running = False
|
65 |
+
|
66 |
+
# Move the snake
|
67 |
+
new_pos = [snake_pos[0] + snake_dir[0], snake_pos[1] + snake_dir[1]]
|
68 |
+
if new_pos[0] < 0 or new_pos[0] > width - snake_size:
|
69 |
+
snake_dir[0] *= -1
|
70 |
+
if new_pos[1] < 0 or new_pos[1] > height - snake_size:
|
71 |
+
snake_dir[1] *= -1
|
72 |
+
snake_pos[0] = new_pos[0]
|
73 |
+
snake_pos[1] = new_pos[1]
|
74 |
+
|
75 |
+
# Check for apple collision
|
76 |
+
if snake_pos[0] == apple_pos[0] and snake_pos[1] == apple_pos[1]:
|
77 |
+
apple_pos = [random.randint(20, 300), random.randint(20, 300)]
|
78 |
+
snake_length += 1
|
79 |
+
|
80 |
+
# Draw the screen
|
81 |
+
screen.fill(white)
|
82 |
+
pygame.draw.rect(screen, red, [apple_pos[0], apple_pos[1], apple_size, apple_size])
|
83 |
+
for i in range(snake_length):
|
84 |
+
pygame.draw.rect(screen, green, [snake_pos[0] - i * snake_size, snake_pos[1], snake_size, snake_size])
|
85 |
+
pygame.display.flip()
|
86 |
+
|
87 |
+
# Control the frame rate
|
88 |
+
clock.tick(10)
|
89 |
+
|
90 |
+
pygame.quit()
|
91 |
+
```
|
92 |
+
|
93 |
+
This code will create a window with a snake that moves in a grid, eating apples and growing in length. The snake will bounce off the walls of the window. To play the game, simply run the code and use the arrow keys to control the snake.<|endoftext|>
|
94 |
+
|
95 |
# Ramikan-BR/P3-mini-v6-Q8_0-GGUF
|
96 |
This model was converted to GGUF format from [`Ramikan-BR/P3-mini-v6`](https://huggingface.co/Ramikan-BR/P3-mini-v6) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
|
97 |
Refer to the [original model card](https://huggingface.co/Ramikan-BR/P3-mini-v6) for more details on the model.
|