Commit 6949db4d authored by Nelson Phillips's avatar Nelson Phillips

autosave

parent 3a943d72
...@@ -55,7 +55,8 @@ vector <Body> parts; ...@@ -55,7 +55,8 @@ vector <Body> parts;
bool Snake::draw(){ bool Snake::draw(){
for (int i = 0; i < 29; i++){
for (int i = 0; i < 29; i++){
for (int q = 0; q < 60; q++){ for (int q = 0; q < 60; q++){
if (x < 1)return false; if (x < 1)return false;
if (y < 1)return false; if (y < 1)return false;
...@@ -65,12 +66,13 @@ vector <Body> parts; ...@@ -65,12 +66,13 @@ vector <Body> parts;
if (h == i || o == q) if (h == i || o == q)
grid[h][o] = '*'; grid[h][o] = '*';
if (i == 27 || i == 0) if (i == 27 || i == 0)
grid[i][q] = '|'; grid[i][q] = '-';
if(q == 0 || q == 59) if(q == 0 || q == 59)
grid[i][q] = '_'; grid[i][q] = '|';
for ( int count = 0; count < parts.size(); count++){
for ( int count = 0; count < parts.size(); count++){
if (grid[parts[0].getX()][parts[0].getY()] == '-') return false; if (grid[parts[0].getX()][parts[0].getY()] == '-') return false;
if (count == 0){ if (count == 0){
if( direction == 2) if( direction == 2)
...@@ -89,14 +91,10 @@ vector <Body> parts; ...@@ -89,14 +91,10 @@ vector <Body> parts;
} }
else else
grid[parts[count].getX()][parts[count].getY()] = '-'; grid[parts[count].getX()][parts[count].getY()] = '-';
} }
} }
} }
for (int i = 0; i < 29; i++){ for (int i = 0; i < 29; i++){
cout << endl; cout << endl;
for (int q = 0; q < 60; q++){ for (int q = 0; q < 60; q++){
...@@ -113,7 +111,7 @@ if (grid [x][y] == grid[h][o] ){ ...@@ -113,7 +111,7 @@ if (grid [x][y] == grid[h][o] ){
bdy.newBody(); bdy.newBody();
bonusBody--; bonusBody--;
} }
return true; return hi;
} }
int Snake::snekoScore(){ int Snake::snekoScore(){
return score; return score;
...@@ -148,10 +146,7 @@ return true; ...@@ -148,10 +146,7 @@ return true;
" |_____||__,_|_| |_| |_||___| |____/ |_/ |___|_|" << endl; " |_____||__,_|_| |_| |_||___| |____/ |_/ |___|_|" << endl;
} }
void Body::changeX(bool updown){ void Body::changeX(bool updown){
......
...@@ -17,6 +17,7 @@ class Snake { ...@@ -17,6 +17,7 @@ class Snake {
int getY(); int getY();
void newBody(); void newBody();
void GameOver(); void GameOver();
bool fillspace();
private: private:
......
g++ *.cpp -o main.out -pthread -std=c++11 && ./main.outf
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment