ertghiu256 commited on
Commit
f07f407
ยท
verified ยท
1 Parent(s): 0ae9334

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +176 -1
README.md CHANGED
@@ -20,6 +20,12 @@ pipeline_tag: text-generation
20
  A small Qwen 3 4 billion parameter model trained on [nvidia/OpenCodeReasoning](https://huggingface.co/datasets/nvidia/OpenCodeReasoning) for coding tasks.
21
  For Coding, it is recommended to be in thinking mode.
22
 
 
 
 
 
 
 
23
  ## Strengths
24
  - Code generation
25
  - Logical question answering
@@ -33,4 +39,173 @@ For Coding, it is recommended to be in thinking mode.
33
  - [transformers](https://github.com/QwenLM/Qwen3?tab=readme-ov-file#run-qwen3)
34
 
35
  ### GGUF VERSION
36
- [gguf](https://huggingface.co/ertghiu256/qwen3-4b-code-reasoning-gguf)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  A small Qwen 3 4 billion parameter model trained on [nvidia/OpenCodeReasoning](https://huggingface.co/datasets/nvidia/OpenCodeReasoning) for coding tasks.
21
  For Coding, it is recommended to be in thinking mode.
22
 
23
+ ## Recomended parameters:
24
+ - Context window : > 10000
25
+ - Temperature : 0.7
26
+ - Top_p : 20
27
+ - Top_k : 0.95
28
+
29
  ## Strengths
30
  - Code generation
31
  - Logical question answering
 
39
  - [transformers](https://github.com/QwenLM/Qwen3?tab=readme-ov-file#run-qwen3)
40
 
41
  ### GGUF VERSION
42
+ [gguf](https://huggingface.co/ertghiu256/qwen3-4b-code-reasoning-gguf)
43
+
44
+ ## Example Usage :
45
+ ```
46
+ > Write me a snake game in python. Ensure all keybinding (WASD) work properly and all mechanics from the original snake game works. /think
47
+ <think>
48
+ Okay, I need to write a Snake game in Python where all the keybindings (WASD) work properly and all the original mechanics are included. Let me think about how to approach this.
49
+
50
+ First, I remember that the classic Snake game works by having a snake move in a direction, grow when it eats food, and die if it hits the wall or itself. The keybindings should allow the snake to change direction using W, A, S, D. But I need to make sure that the movement is smooth and that the snake can't reverse direction immediately, which might cause it to collide with itself right away.
51
+
52
+ So, the plan is to use the pygame library because it's commonly used for game development in Python. I'll need to initialize the game window, set up the display, handle the game loop, manage the snake's movement, check for collisions, and handle the food.
53
+
54
+ Let me outline the steps:
55
+
56
+ Import necessary modules: Pygame, sys, random for generating food, time for delay.
57
+ Initialize Pygame: Set up the display, clock, fonts, etc.
58
+ Define constants: Screen size, grid size (like 20x20), snake speed, colors.
59
+ Create the Snake class: Each segment of the snake. The snake moves in a direction, and each segment follows the previous one.
60
+ Create the Food class: Randomly placed on the screen, and when eaten, the snake grows.
61
+ Game loop:
62
+ Handle events (WASD for direction).
63
+ Move the snake.
64
+ Check for collisions (walls or self).
65
+ Check if food is eaten, then increase length.
66
+ Update the display.
67
+ Control the game speed with a clock.
68
+ Handle keybindings: Make sure that the snake can't reverse direction. So, if the current direction is right, the next can't be left, and so on.
69
+ Wait, but in the original Snake game, ...(Too long)
70
+ </think>
71
+
72
+ Here's a complete implementation of the **Snake Game** using the `pygame` library. The game allows the player to control the snake using the **WASD keys**, and the snake moves in the direction of the last key pressed. The game ends when the snake collides with the wall or itself, and the snake grows by one segment each time it eats the food.
73
+
74
+ ---
75
+
76
+ ### โœ… Features:
77
+ - **WASD Controls**:
78
+ - `W` โ†’ Up
79
+ - `A` โ†’ Left
80
+ - `S` โ†’ Down
81
+ - `D` โ†’ Right
82
+ - **Food Generation**:
83
+ - Randomly placed on a 32ร—24 grid (640ร—480 pixels).
84
+ - **Game Over**:
85
+ - Ends when the snake hits the wall or itself.
86
+ - **Speed Control**:
87
+ - Set with `clock.tick(10)` to control the game speed.
88
+
89
+ ---
90
+
91
+ ### ๐Ÿง  How It Works:
92
+ 1. The snake starts with 3 segments.
93
+ 2. The player uses `W`, `A`, `S`, `D` to change the direction.
94
+ 3. The snake moves in the current direction, growing if it eats the food.
95
+ 4. When the snake collides with the wall or itself, the game ends.
96
+
97
+ ---
98
+
99
+ ### ๐Ÿ“ฆ Code Implementation
100
+
101
+ ```python
102
+ import pygame
103
+ import sys
104
+ import random
105
+
106
+ # Initialize Pygame
107
+ pygame.init()
108
+
109
+ # Game settings
110
+ SCREEN_WIDTH = 640
111
+ SCREEN_HEIGHT = 480
112
+ BLOCK_SIZE = 20
113
+ GRID_WIDTH = SCREEN_WIDTH // BLOCK_SIZE
114
+ GRID_HEIGHT = SCREEN_HEIGHT // BLOCK_SIZE
115
+
116
+ # Colors
117
+ BLACK = (0, 0, 0)
118
+ GREEN = (0, 255, 0)
119
+ RED = (255, 0, 0)
120
+
121
+ # Initialize screen
122
+ screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
123
+ pygame.display.set_caption("Snake Game")
124
+
125
+ # Clock
126
+ clock = pygame.time.Clock()
127
+
128
+ # Snake
129
+ snake_segments = [(3, 3), (2, 3), (1, 3)]
130
+ direction = (1, 0) # Start moving right
131
+
132
+ # Food
133
+ def generate_food():
134
+ while True:
135
+ x = random.randint(0, GRID_WIDTH - 1)
136
+ y = random.randint(0, GRID_HEIGHT - 1)
137
+ if (x, y) not in snake_segments:
138
+ return (x, y)
139
+
140
+ food = generate_food()
141
+
142
+ # Game loop
143
+ running = True
144
+ ate_food = False
145
+
146
+ while running:
147
+ for event in pygame.event.get():
148
+ if event.type == pygame.QUIT:
149
+ running = False
150
+ elif event.type == pygame.KEYDOWN:
151
+ if event.key == pygame.K_w:
152
+ direction = (0, -1)
153
+ elif event.key == pygame.K_a:
154
+ direction = (-1, 0)
155
+ elif event.key == pygame.K_s:
156
+ direction = (0, 1)
157
+ elif event.key == pygame.K_d:
158
+ direction = (1, 0)
159
+
160
+ # Move the snake
161
+ new_head = (snake_segments[0][0] + direction[0], snake_segments[0][1] + direction[1])
162
+ snake_segments.insert(0, new_head)
163
+ if not ate_food:
164
+ snake_segments.pop()
165
+ ate_food = False
166
+
167
+ # Check for collisions
168
+ if (new_head[0] < 0 or new_head[0] >= GRID_WIDTH or
169
+ new_head[1] < 0 or new_head[1] >= GRID_HEIGHT):
170
+ pygame.quit()
171
+ sys.exit()
172
+ if new_head in snake_segments[1:]:
173
+ pygame.quit()
174
+ sys.exit()
175
+
176
+ # Check if food is eaten
177
+ if new_head == food:
178
+ food = generate_food()
179
+ ate_food = True
180
+
181
+ # Draw everything
182
+ screen.fill(BLACK)
183
+ for segment in snake_segments:
184
+ pygame.draw.rect(screen, GREEN, (segment[0] * BLOCK_SIZE, segment[1] * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE))
185
+ pygame.draw.rect(screen, RED, (food[0] * BLOCK_SIZE, food[1] * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE))
186
+ pygame.display.flip()
187
+
188
+ # Control the game speed
189
+ clock.tick(10)
190
+
191
+ pygame.quit()
192
+ sys.exit()
193
+ ```โ €
194
+
195
+ ---
196
+
197
+ ### ๐Ÿงช How to Run:
198
+ 1. Install `pygame` using pip:
199
+ `pip install pygame`
200
+ 2. Save the code in a file, e.g., `snake_game.py`.
201
+ 3. Run the file using Python:
202
+ `python snake_game.py`
203
+
204
+ ---
205
+
206
+ ### ๐Ÿš€ Tips:
207
+ - The game is fast-paced. You can slow it down by increasing the value in `clock.tick(10)` (e.g., `clock.tick(15)`).
208
+ - The snake starts in the middle of the screen, and the food is placed randomly.
209
+
210
+ Enjoy playing the **Snake Game**! ๐Ÿ๐ŸŽฎ
211
+ ```