feat(game): implement base functions and board rendering

This commit is contained in:
2025-09-23 00:42:24 +03:30
parent f6e9fc3577
commit 7fd468078a
+57
View File
@@ -0,0 +1,57 @@
#include <bits/stdc++.h>
#include <iostream>
#include <bits/stdc++.h>
#include <conio.h>
using namespace std;
bool gameOver;
const int width = 40;
const int height = 40;
int x, y, fruitX, fruitY, score;
enum eDirection { STOP = 0, LEFT, RIGHT, UP, DOWN };
eDirection dir;
void setup() {
gameOver = false;
dir = STOP;
x = width / 2;
y = height / 2;
fruitX = rand() % width;
fruitY = rand() % height;
score = 0;
}
void draw() {
system("cls");
for(int i = 0; i < width + 2; i++) cout << "#";
cout << "\n";
for(int i = 0; i < height; i++) {
for(int j = 0; j < width; j++ ) {
if(j == 0) cout << "#";
cout << " ";
if(j == width - 1) cout << "#";
}
cout << "\n";
}
for(int i = 0; i < width + 2; i++) cout << "#";
cout << "\n";
}
void input() {
}
void logic() {
}
int main() {
setup();
while(!gameOver){
draw();
input();
logic();
}
}