well i am a new in this stuff and i am trying to make a snake game for some reason the border moves when i try to edd the fruit or the snake head, i dont know maybe its my visual studio because my friend did the same code and the stars did not move.
#include<conio.h>
#include<Windows.h>
#include<stdbool.h>
#include<time.h>
#include<stdlib.h>
#include<iostream>
bool gameover;
const int height = 20;
const int width = 20;
int x, y, fruitX, fruitY, score;
void setup()
{
gameover = false;
x = width / 2;
y = height / 2;
srand(time(0));
fruitX = rand() % height;
fruitY = rand() % width;
}
void board()//הקירות של הסנייק
{
for (int i = 1; i <= width; i++)//רוחב קיר עליון
{
printf("#");
}
for (int i = 1; i <= width; i++)//מספר שורה
{
printf("\n");
for (int j = 1; j <= width; j++)//השורה
{
if (j == 1 || j == width)
printf("#");
else
{
if (i == fruitY && j == fruitX)
printf("f");
else
if (i == y && j == x)
printf("o");
else
printf(" ");
}
}
}
printf("\n");
for (int i = 0; i < width; i++)//רוחב קיר תחתון
{
printf("#");
}`enter code here
`
