Commit cbf98761 authored by Nelson Phillips's avatar Nelson Phillips

autosave

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