Work in progress

This commit is contained in:
fl3ka 2024-05-15 16:29:11 +02:00
parent bd8f0464d0
commit dcbc403a8b
2 changed files with 52 additions and 0 deletions

BIN
Snakes/snakes Executable file

Binary file not shown.

52
Snakes/snakes.cpp Normal file
View File

@ -0,0 +1,52 @@
#include <iostream>
#include <cstdlib>
using namespace std;
const int width = 80;
const int height = 20;
bool gameover;
const int snakeX = width/2;
const int snakeY = height/2;
void start(){
gameover=false;
}
void draw(){
//Change "clear" to "cls" if compiling for Windows
system("clear");
for(int i=0; i<width; i++){
cout << "#";
}
cout << endl;
for(int i=0; i<height; i++){
for(int j=0; j<=width; j++){
if(j==0 || j==width){
cout<<"#";
}
if(j==snakeX && i==snakeY)
cout<<"o";
else
cout<<" ";
}cout<<endl;
}
for(int i=0; i<width; i++){
cout << "#";
}
cout<<endl;
}
int main(){
while(!gameover)
draw();
return 0;
}