Commit cbf98761 authored by Nelson Phillips's avatar Nelson Phillips

autosave

parent d3d201c3
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
#include "Snake.h" #include "Snake.h"
using namespace std; using namespace std;
bool hi = 0;
Snake bdy; Snake bdy;
vector <Body> parts; vector <Body> parts;
...@@ -116,14 +115,25 @@ if (grid [x][y] == grid[h][o] ){ ...@@ -116,14 +115,25 @@ if (grid [x][y] == grid[h][o] ){
int Snake::getY(){ int Snake::getY(){
return y; return y;
} }
int Snake::getLeng(){
return length;
}
void Snake::lengthed(){
length++;
}
void Snake::newBody(){ void Snake::newBody(){
Body segment (x - length, y); Body segment (x,y);//parts[bdy.getLeng()].getX(), parts[bdy.getLeng()].getY()
cout << x << endl << x << endl << x << endl << x << endl << x << endl << x << endl << x << endl << x << endl << x << endl << x << endl << x << endl;
parts.push_back(segment); parts.push_back(segment);
} }
void Body::changeX(bool updown){ void Body::changeX(bool updown){
if (updown) if (updown)
x--; x--;
...@@ -151,7 +161,4 @@ if (grid [x][y] == grid[h][o] ){ ...@@ -151,7 +161,4 @@ if (grid [x][y] == grid[h][o] ){
return y; return y;
} }
void Snake::lengthed(){
length++;
}
\ No newline at end of file
...@@ -17,6 +17,7 @@ class Snake { ...@@ -17,6 +17,7 @@ class Snake {
int getY(); int getY();
void newBody(); void newBody();
void lengthed(); void lengthed();
int getLeng();
private: private:
int x = 5, y = 5, i = 0, q = 0, score = 0, int x = 5, y = 5, i = 0, q = 0, score = 0,
h = (rand() % 14), o = (rand() % 14); h = (rand() % 14), o = (rand() % 14);
......
...@@ -43,7 +43,6 @@ void charCall() { ...@@ -43,7 +43,6 @@ void charCall() {
} }
int main() int main()
{ {
BrdSet.newBody();
thread first (charCall); // spawn new thread that calls input() thread first (charCall); // spawn new thread that calls input()
thread second (snakePrint); // spawn new thread that calls snakePrint(0) thread second (snakePrint); // spawn new thread that calls snakePrint(0)
......
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