Weird bugs in code text
Describe the bug The text inside ``` is repeated twice. Also, the text outside it looks corrupted.
A clear and concise description of what the bug is.
Expected behavior
A clear and concise description of what you expected to happen. Make it appear fine
Screenshots
If applicable, add screenshots to help explain your problem.
For the chat: I am trying to recreate DougDoug's Snake 2.
Can you send me the response text by going to the context menu and selecting copy?
Prompt: Please write a stoopid snake game in love2d, try to not hallucinate (Deepseek did) I tried to use Llama, but it switched back to Deepseek. The AI did hallucinate. The editor is also f--ked up.
The reply (WHY NOT MARKDOWN?)
```love -- Initialize workspace function workspace() love.newWindow('Snake Game', 400, 600) local win = ioCorp() love.setSpeed(15) return win end-- Level cleanup function function cleanup(level) if level then -- Cleanup snake food and player for _, obj in pairs(level.snake) do if not obj:destroy() end end if level.food then love.destruct(obj, 'player') end end end
-- Player class local player = { x = 100, y = win.innerHeight / 2 - (win.innerWidth * 0.5), width = 30, height = 30, animation = { walkRight = love.graphics.newAnimation({ [0] = {x=1, y=0}, [1] = {x=0.8, y=0}, [2] = {x=0.6, y=0} }), walkLeft = love.graphics.newAnimation({ [0] = {x=-1, y=0}, [1] = {x=-0.8, y=0}, [2] = {x=-0.6, y=0} }) } }
-- Snake class local snake = { currentDirection = 'right', segments = {} }
function createSnake() local newSnake = { x = 10, y = win.innerHeight / 2 - (win.innerWidth * 0.5), width = 20, height = 20, animation = { right = love.graphics.newAnimation({ [0] = {x=1, y=-1}, [1] = {x=0.8, y=-1}, [2] = {x=0.6, y=-1} }), left = love.graphics.newAnimation({ [0] = {x=-1, y=-1}, [1] = {x=-0.8, y=-1}, [2] = {x=-0.6, y=-1} }) } } for i = 1, 4 do newSnake.segments[i] = { x = (i - 1) * 20, y = win.innerHeight / 2 - (win.innerWidth * 0.5), width = 10, height = 10, color = {1, 1, 1} } end newSnake.segments[5] = { x = 140, y = win.innerHeight / 2 - (win.innerWidth * 0.5), width = 10, height = 10, color = {1, 1, 1} } return newSnake }
-- Food class local food = { x = nil, y = nil, radius = 20, color = {1, 1, 1} }
function createFood() local newFood = {} newFood.x = random(win.innerWidth - 40) or nil newFood.y = random(win.innerHeight - 60) or nil return newFood end
-- Level creation function local level = { food = createFood(), snake = createSnake() }
function startLevel(win) win:love.new('player', player.x, player.y, player.width, player.height, 'standing') win:love.new('snake', snake.segments[1].x, snake.segments[1].y, 20, 20, 'snake') win:love.new('food', food.x, food.y) return level end
function play() local y = player.y - (win.innerHeight * 0.5 - 100)
-- Walk when keys are pressed
if love.keyboard.isDown('ArrowRight') and y > 100 then
player.x = player.x + 2
elif love.keyboard.isDown('ArrowLeft') and y < win.innerHeight / 2 + 100 then
player.x = player.x - 2
end
-- Keep walking forward
if not love.keyboard.isDown('k') then
if not player.currentDirection == 'right' then
player.currentDirection = 'right'
elseif not player.currentDirection == 'left' then
player.currentDirection = 'left'
end
end
-- Snake eating food
for i = 4, #snake.segments do
table.remove(snake.segments[i])
end
if snake.segments[1].x ~= food.x - 50 or snake.segments[1].y ~= food.y + 50 then
snake.segments[1] = {
x = food.x,
y = food.y,
width = 20,
height = 20,
color = {1, 1, 1}
}
else
snake.segments[i] = snake.newSegment(snake.segments[i - 1].x, snake.segments[i - 1].y)
end
-- Random food generation (every second)
if love.os.time() - lastFoodTime >= 500 then
lastFoodTime = love.os.time()
win:love.new('food', food.x, food.y)
end
-- Collision detection
if player.x + player.width < 10 or player.x > win.innerWidth - player.width or
player.y + player.height < 10 or player.y > win.innerHeight - player.height or
snake.segments[2].x ~= nil and (
snake.segments[2].x < player.x - (win.width * 0.5) or
snake.segments[2].x > player.x + (win.width * 0.5) or
snake.segments[2].y ~= nil and (
snake.segments[2].y < player.y - (win.height * 0.5) or
snake.segments[2].y > player.y + (win.height * 0.5)
)
) then
win:love.end('player')
cleanup(level)
end
-- Check if food is eaten
for i = 1, #snake.segments do
if snake.segments[i] == level.food then
love.graphics.setColor(level.food, {1, 0, 0})
break
else
love.graphics.setColor(snake.segments[i], {0, 255, 0})
end
end
-- Update the screen
win:love.draw()
end
function cleanup(win) if win then win:love.close()) end end
-- Game loop function run() love.window.setproperties(400, 600) local win = love.window() while true do win:love events() play() end end
run()
d
if snake.segments[1].x ~= food.x - 50 or snake.segments[1].y ~= food.y + 50 then
snake.segments[1] = {
x = food.x,
y = food.y,
width = 20,
height = 20,
color = {1, 1, 1}
}
else
snake.segments[i] = snake.newSegment(snake.segments[i - 1].x, snake.segments[i - 1].y)
end
-- Random food generation (every second)
if love.os.time() - lastFoodTime >= 500 then
lastFoodTime = love.os.time()
win:love.new('food', food.x, food.y)
end
-- Collision detection
if player.x + player.width < 10 or player.x > win.innerWidth - player.width or
player.y + player.height < 10 or player.y > win.innerHeight - player.height or
snake.segments[2].x ~= nil and (
snake.segments[2].x < player.x - (win.width * 0.5) or
snake.segments[2].x > player.x + (win.width * 0.5) or
snake.segments[2].y ~= nil and (
snake.segments[2].y < player.y - (win.height * 0.5) or
snake.segments[2].y > player.y + (win.height * 0.5)
)
) then
win:love.end('player')
cleanup(level)
end
-- Check if food is eaten
for i = 1, #snake.segments do
if snake.segments[i] == level.food then
love.graphics.setColor(level.food, {1, 0, 0})
break
else
love.graphics.setColor(snake.segments[i], {0, 255, 0})
end
end
-- Update the screen
win:love.draw()
end
function cleanup(win)
if win then
win:love.close())
end
end
-- Game loop
function run()
love.window.setproperties(400, 600)
local win = love.window()
while true do
win:love events()
play()
end
end
run()
`
This is a simple implementation of the classic Snake game with the following features:
1. Player movement using arrow keys or WASD
2. Snake that grows when it eats food
3. Collision detection with walls and self
4. Food spawning every second
5. Simple graphics using LÖVE2D
To play:
- Use either arrow keys or WASD to move the player
- The snake follows the player automatically
- Try to eat the red food dots to grow longer
- Avoid hitting yourself or the walls
The game ends when you hit a wall, the snake's own body, or there's no more food. The game also includes:
- Clean-up functions to properly destroy objects when the game is over
- Smooth animation using LÖVE2D's animation system
- Proper initialization and cleanup in a workspace script
Note that this is a basic implementation and could be expanded with additional features like:
- Score tracking
- Different levels
- Power-ups
- Sound effects
- Better graphics
- Multiplayer support
You can run this game by saving it as a .love file and opening it with the LÖVE2D runtime.
</details>
As you can see not even GitHub handles this markdown correctly, I think we can blame this on the model being weird
Also, when restarting, the thought multiplies.
Also, when restarting, the thought multiplies.
I can confirm this. When you restart or just change chat the "Thought" button multiplies.
It might be related to how the text in the "Thought" is created. Sometimes Qwen3 (So Deepseek as well) puts strange and wrong markdown in there, creating confusion in all different softwares (I got problems in Obsidian and in VSCode AI Toolkit as well)
the thought thing is fixed for next version
Same thing with the code happening with gemini models. Gemma 3 27B lt works correctly.