How ya like it so far? By the way is your avatar gif saying void main = boommm lol that's hilarious!
Code:
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <ctime>
using namespace std;
static int x = 0;
static int y = 0;
int legnum(int legnumber)
{
if (legnumber < 5000)
return 1;
else if (legnumber < 12000)
return 2;
else if (legnumber < 26000)
return 3;
else if (legnumber < 50000)
return 4;
}
int legs(int leg)
{
static int doItAgain = 0;
++doItAgain;
if (doItAgain == 5)
doItAgain = doItAgain - 4;
if (doItAgain == 1)
cout << "leg 1 ";
else if (doItAgain == 2)
cout << "leg 2 ";
else if (doItAgain == 3)
cout << "leg 3 ";
else if (doItAgain == 4)
cout << "leg 4 ";
if (leg < 5000)
cout << "moved left" << endl;
else if (leg < 12000)
cout << "moved forward" << endl;
else if (leg < 26000)
cout << "moved backward" << endl;
else if (leg < 50000)
cout << "moved right" << endl;
return 0;
}
int main()
{
tryAgain:
srand( time(0));
int guess1 = rand();
int guess2 = rand();
int guess3 = rand();
int guess4 = rand();
int leg1 = guess1;
int leg2 = guess2;
int leg3 = guess3;
int leg4 = guess4;
leg1 = legnum(leg1);
leg2 = legnum(leg2);
leg3 = legnum(leg3);
leg4 = legnum(leg4);
legs(guess1);
legs(guess2);
legs(guess3);
legs(guess4);
if (leg1 == leg2 && leg1 == leg3 && leg1 == leg4 && x != 8 && x != -8 && y != 8 && y != -8)
cout << "Robot moved forward and got acceleration sense by accelometer, which is the trigger to save actions just guessed. The sense instantly matches a close match in memory and links to and initiates the saved actions, +labeled actions are done." << endl;
else
goto tryAgain;
again:
if (leg1 == 1)
x = --x;
else if (leg1 == 2)
y = ++y;
else if (leg1 == 3)
y = --y;
else if (leg1 == 4)
x = ++x;
cout << "Currently at tile " << x << " " << y << "." << endl;
if (x == 8 || x == -8 || y == 8 || y == -8)
goto tryAgain;
cout << "Enter a number to continue." << endl;
int CONTINUE;
cin >> CONTINUE;
cout << "Robot moved forward again" << endl;
goto again;
goto tryAgain;
return 0;
}