Completed Unnecessary hard game *Updated*

I said in my previous post that due to this being quite popular among friends that I am going to be releasing an update to this game, It now has 10 levels and also removed the red font due to it being hard to read.

I have also changed the wording.

I have also officialy named this program as: Find My Number. (Original right? haha)

Levels are:

  • Level 1 = 0 – 10
  • Level 2 = 0 – 100
  • Level 3 = 0 – 1000
  • Level 4 = 0 – 10000
  • Level 5 = 0 – 100000
  • Level 6 = 0 – 1000000
  • Level 7 = 0 – 10000000
  • Level 8 = 0 – 100000000
  • Level 9 = 0 – 1000000000
  • BONUS Level = 0 – 2000000000
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <ctype.h>

#define FONTGREEN "\x1b[32m"
#define FONTRESET "\x1b[0m"
#define FONRRED "\x1b[31m"

int main (void){

start:

srand(time(NULL));

//Game ints
//int complete = 0;
int try;
int track;
int counter = 0;
int level1 = rand() % 10 + 1;
int complete1 = 0;
int level2 = rand() % 100 + 1;
int complete2 = 0;
int level3 = rand() % 1000 + 1;
int complete3 = 0;
int level4 = rand() % 10000 + 1;
int complete4 = 0;
int level5 = rand() % 100000 + 1;
int complete5 = 0;
int level6 = rand() % 1000000 +1 ;
int complete6 = 0;
int level7 = rand() % 10000000 + 1;
int complete7 = 0;
int level8 = rand() % 100000000 + 1;
int complete8 = 0;
int level9 = rand() % 1000000000 + 1;
int complete9 = 0;
int levelbonus = rand() % 2000000000 + 1;
int bonuscomplete = 0;

//Cheats
 int c1 = 1123456789;
 //int c2 = 2287654321;

//Game code
printf("Welcome to the guess the number game brought to you by Stephen Wilde\nLevel One: 0 - 10\n To get started simply enter your first guess: ");

	do {
    scanf("%d", &try);
	  if (try == level1){
		counter++;
		track++;
		printf(FONTGREEN "\nLevel one completed in %d tries\n" FONTRESET, counter);
        printf(FONTGREEN "\nLevel Two begins in 5 seconds\n" FONTRESET, counter);

		complete1 = 1;
		counter = 0;
		sleep (5);
        goto level2;

		}

	   if (try < level1){
		counter++;
		track++;
		printf("Try number %d is too low\ntry again: ", counter);
		}

  	    if (try > level1){
  	    counter++;
  	    track++;
  	    printf("Try number %d is too high\nPlease try again: ", counter);

  	    }

  	    if (try == c1){

        	counter++;
		counter++;
		counter++;
		counter++;
		counter++;
		track++;
		track++;
		track++;
		track++;
		track++;

  	    printf("\nThe number I need is: %d\nAdded 5 guesses to your counter for cheat use. \n", level1);
  	    printf("Enter %d here: " ,level1);


  	    }


  	    }

  	    while (complete1 == 0);

level2:

printf("\nLevel 2: 0-100\nEnter your guess: ");

	do {scanf("%d", &try);
	  if (try == level2){
		counter++;
		track++;
		printf(FONTGREEN "\nLevel Two completed in %d tries\n Level Three starts in 5 seconds" FONTRESET, counter);
		printf(FONTGREEN "\nLevel Three starts in 5 seconds" FONTRESET, counter);

		complete2 = 1;
		counter = 0;
		sleep (5);
        goto level3;

		}

	   if (try < level2){
		counter++;
		track++;
		printf("Try number %d is too low\ntry again: ", counter);
		}

  	    if (try > level2){
  	    counter++;
  	    track++;
  	    printf("Try number %d is too high\nPlease try again: ", counter);

  	    }

  	    if (try == c1){

        	counter++;
		counter++;
		counter++;
		counter++;
		counter++;
		track++;
		track++;
		track++;
		track++;
		track++;

  	    printf("\nThe number I need is: %d\nAdded 5 guesses to your counter for cheat use. \n", level2);
  	    printf("Enter %d here: " ,level2);


  	    }


  	    }

  	    while (complete2 == 0);
        level3:

printf("\nLevel 3: 0-1000\nEnter your guess: ");

	do {scanf("%d", &try);
	  if (try == level3){
		counter++;
		track++;
        printf(FONTGREEN "\nLevel Three completed in %d tries\n" FONTRESET, counter);
        printf(FONTGREEN "\nLevel Four begins in 5 seconds\n" FONTRESET, counter);

		complete3 = 1;
		counter = 0;
		sleep (5);
        	goto level4;

		}

	   if (try < level3){
		counter++;
		track++;
		printf("Try number %d is too low\ntry again: ", counter);
		}

  	    if (try > level3){
  	    counter++;
  	    track++;
  	    printf("Try number %d is too high\nPlease try again: ", counter);

  	    }

  	    if (try == c1){

        	counter++;
		counter++;
		counter++;
		counter++;
		counter++;
		track++;
		track++;
		track++;
		track++;
		track++;

  	    printf("\nThe number I need is: %d\nAdded 5 guesses to your counter for cheat use. \n", level3);
  	    printf("Enter %d here: " ,level3);


  	    }


  	    }

  	    while (complete3 == 0);



level4:

printf("\nLevel 4: 0-10000\nEnter your guess: ");

	do {scanf("%d", &try);
	  if (try == level4){
		counter++;
		track++;
        printf(FONTGREEN "\nLevel Four completed in %d tries\n" FONTRESET, counter);
        printf(FONTGREEN "\nLevel Five begins in 5 seconds\n" FONTRESET, counter);

		complete4 = 1;
		counter = 0;
		sleep (5);
        	goto level5;

		}

	   if (try < level4){
		counter++;
		track++;
		printf("Try number %d is too low\ntry again: ", counter);
		}

  	    if (try > level4){
  	    counter++;
  	    track++;
  	    printf("Try number %d is too high\nPlease try again: ", counter);

  	    }

  	    if (try == c1){

        	counter++;
		counter++;
		counter++;
		counter++;
		counter++;
		track++;
		track++;
		track++;
		track++;
		track++;

  	    printf("\nThe number I need is: %d\nAdded 5 guesses to your counter for cheat use. \n", level4);
  	    printf("Enter %d here: " ,level4);


  	    }


  	    }

  	    while (complete4 == 0);

level5:

printf("\nLevel 5: 0-100000\nEnter your guess: ");

	do {scanf("%d", &try);
	  if (try == level5){
		counter++;
		track++;
        printf(FONTGREEN "\nLevel Five completed in %d tries\n" FONTRESET, counter);
        printf(FONTGREEN "\nLevel Six begins in 5 seconds\n" FONTRESET, counter);

		complete5 = 1;
		counter = 0;
		sleep (5);
        	goto level6;

		}

	   if (try < level5){
		counter++;
		track++;
		printf("Try number %d is too low\ntry again: ", counter);
		}

  	    if (try > level5){
  	    counter++;
  	    track++;
  	    printf("Try number %d is too high\nPlease try again: ", counter);

  	    }

  	    if (try == c1){

        	counter++;
		counter++;
		counter++;
		counter++;
		counter++;
		track++;
		track++;
		track++;
		track++;
		track++;

  	    printf("\nThe number I need is: %d\nAdded 5 guesses to your counter for cheat use. \n", level5);
  	    printf("Enter %d here: " ,level5);


  	    }


  	    }

  	    while (complete5 == 0);



    level6:

printf("\nLevel 6: 0-1000000\nEnter your guess: ");

	do {scanf("%d", &try);
	  if (try == level6){
		counter++;
		track++;
        printf(FONTGREEN "\nLevel Six completed in %d tries\n" FONTRESET, counter);
        printf(FONTGREEN "\nLevel Seven begins in 5 seconds\n" FONTRESET, counter);

		complete6 = 1;
		counter = 0;
		sleep (5);
        goto level7;

		}

	   if (try < level6){
		counter++;
		track++;
		printf("Try number %d is too low\ntry again: ", counter);
		}

  	    if (try > level6){
  	    counter++;
  	    track++;
  	    printf("Try number %d is too high\nPlease try again: ", counter);

  	    }

  	    if (try == c1){

        	counter++;
		counter++;
		counter++;
		counter++;
		counter++;
		track++;
		track++;
		track++;
		track++;
		track++;

  	    printf("\nThe number I need is: %d\nAdded 5 guesses to your counter for cheat use. \n", level6);
  	    printf("Enter %d here: " ,level6);


  	    }


  	    }

  	    while (complete6 == 0);



  	    level7:

printf("\nLevel 7: 0-10000000\nEnter your guess: ");

	do {scanf("%d", &try);
	  if (try == level7){
		counter++;
		track++;
        printf(FONTGREEN "\nLevel Seven completed in %d tries\n" FONTRESET, counter);
        printf(FONTGREEN "\nLevel Eight begins in 5 seconds\n" FONTRESET, counter);

		complete7 = 1;
		counter = 0;
		sleep (5);
        	goto level8;

		}

	   if (try < level7){
		counter++;
		track++;
		printf("Try number %d is too low\ntry again: ", counter);
		}

  	    if (try > level7){
  	    counter++;
  	    track++;
  	    printf("Try number %d is too high\nPlease try again: ", counter);

  	    }

  	    if (try == c1){

        	counter++;
		counter++;
		counter++;
		counter++;
		counter++;
		track++;
		track++;
		track++;
		track++;
		track++;

  	    printf("\nThe number I need is: %d\nAdded 5 guesses to your counter for cheat use. \n", level7);
  	    printf("Enter %d here: " ,level7);


  	    }


  	    }

  	    while (complete7 == 0);



  	    level8:

printf("\nLevel 8: 0-100000000\nEnter your guess: ");

	do {scanf("%d", &try);
	  if (try == level8){
		counter++;
		track++;
        printf(FONTGREEN "\nLevel Eight completed in %d tries\n" FONTRESET, counter);
        printf(FONTGREEN "\nLevel Nine begins in 5 seconds\n" FONTRESET, counter);

		complete8 = 1;
		counter = 0;
		sleep (5);
        	goto level9;

		}

	   if (try < level8){
		counter++;
		track++;
		printf("Try number %d is too low\ntry again: ", counter);
		}

  	    if (try > level8){
  	    counter++;
  	    track++;
  	    printf("Try number %d is too high\nPlease try again: ", counter);

  	    }

  	    if (try == c1){

        	counter++;
		counter++;
		counter++;
		counter++;
		counter++;
		track++;
		track++;
		track++;
		track++;
		track++;

  	    printf("\nThe number I need is: %d\nAdded 5 guesses to your counter for cheat use. \n", level8);
  	    printf("Enter %d here: " ,level8);


  	    }


  	    }

  	    while (complete8 == 0);



  	    level9:

printf("\nLevel 9: 0-1000000000\nEnter your guess: ");

	do {scanf("%d", &try);
	  if (try == level9){
		counter++;
		track++;
        printf(FONTGREEN "\nLevel Nine completed in %d tries\n" FONTRESET, counter);
        printf(FONTGREEN "\nThe BONUS level begins in 5 seconds\n" FONTRESET, counter);

		complete9 = 1;
		counter = 0;
		sleep (5);
        	goto levelbonus;

		}

	   if (try < level9){
		counter++;
		track++;
		printf("Try number %d is too low\ntry again: ", counter);
		}

  	    if (try > level9){
  	    counter++;
  	    track++;
  	    printf("Try number %d is too high\nPlease try again: ", counter);

  	    }

  	    if (try == c1){

        	counter++;
		counter++;
		counter++;
		counter++;
		counter++;
		track++;
		track++;
		track++;
		track++;
		track++;

  	    printf("\nThe number I need is: %d\nAdded 5 guesses to your counter for cheat use. \n", level9);
  	    printf("Enter %d here: " ,level9);


  	    }


  	    }

  	    while (complete9 == 0);



  	    levelbonus:

printf("\n***BONUS LEVEL***: 0-2000000000\nEnter your guess: ");

	do {scanf("%d", &try);
	  if (try == levelbonus){
		counter++;
		track++;
        printf(FONTGREEN "\nBONUS LEVEL completed in %d tries\n" FONTRESET, counter);
        printf(FONTGREEN "\nFull game completion in %d guesses\n" FONTRESET, track);
        printf(FONTGREEN "\nGame re-setting in 60 seconds");
        printf(FONTGREEN "\n\n\n **The End***");
        printf(FONTGREEN "\nThis game was created by Stephen Wilde\n");


		bonuscomplete = 1;
		counter = 0;
		sleep (60);
        	goto start;

		}

	   if (try < levelbonus){
		counter++;
		track++;
		printf("Try number %d is too low\ntry again: ", counter);
		}

  	    if (try > levelbonus){
  	    counter++;
  	    track++;
  	    printf("Try number %d is too high\nPlease try again: ", counter);

  	    }

  	    if (try == c1){

        	counter++;
		counter++;
		counter++;
		counter++;
		counter++;
		track++;
		track++;
		track++;
		track++;
		track++;

  	    printf("\nThe number I need is: %d\nAdded 5 guesses to your counter for cheat use. \n", levelbonus);
  	    printf("Enter %d here: " ,levelbonus);


  	    }


  	    }

  	    while (bonuscomplete == 0);



  	    return 0;
  	    }

Related Post

Leave a Reply

Your email address will not be published.