Ejemplo n.º 1
0
/*	check_score checks the score global variable against the high score
	table, and if it makes it, gets the player's name and saves the new
	high scores in the file.
*/
void	check_score()
{
	register int	i, spot;
	char			buf[MAXNAMELENGTH];

	spot = 0;
	flock(scorefd,LOCK_EX);
	read_scores();
	flock(scorefd,LOCK_UN);
	for(i=0; i<numhighs; i++) {
		if(score > highscore[i]) {
			get_high_name(buf);
			spot = 1;
			break;
		}
	}
	if(spot == 0) {
		if(numhighs < MAXHIGHSCORES) get_high_name(buf);
		else return;
	}
	flock(scorefd,LOCK_EX);
	read_scores();
	for(i=0; i<numhighs; i++) {
		if(score > highscore[i]) {
			shift_highs(i);
			highscore[i] = score;
			highlevel[i] = level;
			sprintf(highstring[i], "%-20s     %-3d       %-9d", buf,
					level, score);
			write_scores();
			flock(scorefd,LOCK_UN);
			return;
		}
	}
	/*	Didn't beat anyone else, but if the scoreboard isn't full, let it
		in.
	*/
	if(numhighs < MAXHIGHSCORES) {
		highscore[numhighs] = score;
		highlevel[numhighs] = level;
		sprintf(highstring[numhighs], "%-20s     %-3d       %-9d", buf,
				level, score);
		numhighs++;
		write_scores();
		flock(scorefd,LOCK_UN);
		return;
	}
	/* Sorry, you got bumped off while you entered your name */
}
Ejemplo n.º 2
0
int main(int argc, char* argv[]) {
    if (argc != 2) {
        std::cerr << "Usage: " << argv[0] << " grades-file" << std::endl;
        return 1;
    }
    std::ifstream grades_str(argv[1]);
    if (!grades_str) {
        std::cerr << "Can not open the grades in file " << argv[1] << std::endl;
        return 1;
    }
    
    std::vector<int> scores;
    read_scores(scores, grades_str);
    if (scores.size() == 0) {
        std::cerr << "No scores entered. Please try again. " << std::endl;
        return 1;
    }
    double average, std_dev;
    compute_avg_and_std_dev(scores, average, std_dev);
    double median = compute_median(scores);
    
    std::cout << "Among " << scores.size() << " grades: \n"
            << "average = " << std::setprecision(3) << average << '\n'
            << "standard deviation = " << std_dev  << '\n'
            << "median  = " << median << std::endl;
            
}
Ejemplo n.º 3
0
/*	read_new_scores re-reads in the score file info just in case it has
	been changed.
*/
void	read_new_scores()
{
	flock(scorefd,LOCK_EX);
	read_scores();
	flock(scorefd,LOCK_UN);
	XFillRectangle(display, scorepixmap, ctable[CBLACK].smallgc,
					0, 0, SCOREWIDTH, SCOREHEIGHT);
	draw_scores(-1);
}
Ejemplo n.º 4
0
/*	open_scores tries to open the score file, and if it can't it tries to
	create one.
*/
void	open_scores()
{
	numhighs = 0;
	scorefd = open(SCOREPATH, O_RDWR);
	if(scorefd == -1) {
		scorefd = open(SCOREPATH, O_RDWR | O_CREAT, 0444);
		if(scorefd == -1) {
			scorefd = open("jetpack.scores", O_RDWR);
			if(scorefd == -1) {
				scorefd = open("jetpack.scores", O_RDWR | O_CREAT, 0444);
				if(scorefd == -1) {
					fprintf(stderr,"Jetpack : Couldn't open scorefile.\n");
					exit(1);
				} else {
					flock(scorefd,LOCK_EX);
					scorefile = fdopen(scorefd,"r+");
					write_scores();
					flock(scorefd,LOCK_UN);
					return;
				}
			} else {
				flock(scorefd,LOCK_EX);
				scorefile = fdopen(scorefd,"r+");
				read_scores();
				flock(scorefd,LOCK_UN);
				return;
			}
		} else {
			flock(scorefd,LOCK_EX);
			scorefile = fdopen(scorefd,"r+");
			write_scores();
			flock(scorefd,LOCK_UN);
			return;
		}
	} else {
		flock(scorefd,LOCK_EX);
		scorefile = fdopen(scorefd,"r+");
		read_scores();
		flock(scorefd,LOCK_UN);
		return;
	}
}
Ejemplo n.º 5
0
int
main (int argc, char **argv)
{
  int c;
  bool running_suid;
  void *lockstate;
  char *scorefile;
  char *nl;
  const char *prefix, *user_prefix = NULL;
  struct stat buf;
  struct score_entry *scores;
  struct score_entry newscore;
  bool reverse = false;
  ptrdiff_t scorecount, scorealloc;
  ptrdiff_t max_scores = MAX_SCORES;

  srand (time (0));

  while ((c = getopt (argc, argv, "hrm:d:")) != -1)
    switch (c)
      {
      case 'h':
	usage (EXIT_SUCCESS);
	break;
      case 'd':
	user_prefix = optarg;
	break;
      case 'r':
	reverse = 1;
	break;
      case 'm':
	{
	  intmax_t m = strtoimax (optarg, 0, 10);
	  if (m < 0)
	    usage (EXIT_FAILURE);
	  max_scores = min (m, MAX_SCORES);
	}
	break;
      default:
	usage (EXIT_FAILURE);
      }

  if (argc - optind != 3)
    usage (EXIT_FAILURE);

  running_suid = (getuid () != geteuid ());

  prefix = get_prefix (running_suid, user_prefix);

  scorefile = malloc (strlen (prefix) + strlen (argv[optind]) + 2);
  if (!scorefile)
    lose_syserr ("Couldn't allocate score file");

  strcpy (scorefile, prefix);
  strcat (scorefile, "/");
  strcat (scorefile, argv[optind]);

  newscore.score = strtoimax (argv[optind + 1], 0, 10);

  newscore.data = argv[optind + 2];
  if (strlen (newscore.data) > MAX_DATA_LEN)
    newscore.data[MAX_DATA_LEN] = '\0';
  nl = strchr (newscore.data, '\n');
  if (nl)
    *nl = '\0';

  newscore.username = get_user_id ();
  if (! newscore.username)
    lose_syserr ("Couldn't determine user id");

  if (stat (scorefile, &buf) < 0)
    lose_syserr ("Failed to access scores file");

  if (lock_file (scorefile, &lockstate) < 0)
    lose_syserr ("Failed to lock scores file");

  if (read_scores (scorefile, &scores, &scorecount, &scorealloc) < 0)
    {
      unlock_file (scorefile, lockstate);
      lose_syserr ("Failed to read scores file");
    }
  if (push_score (&scores, &scorecount, &scorealloc, &newscore) < 0)
    {
      unlock_file (scorefile, lockstate);
      lose_syserr ("Failed to add score");
    }
  sort_scores (scores, scorecount, reverse);
  /* Limit the number of scores.  If we're using reverse sorting, then
     also increment the beginning of the array, to skip over the
     *smallest* scores.  Otherwise, just decrementing the number of
     scores suffices, since the smallest is at the end. */
  if (scorecount > max_scores)
    {
      if (reverse)
	scores += scorecount - max_scores;
      scorecount = max_scores;
    }
  if (write_scores (scorefile, scores, scorecount) < 0)
    {
      unlock_file (scorefile, lockstate);
      lose_syserr ("Failed to write scores file");
    }
  if (unlock_file (scorefile, lockstate) < 0)
    lose_syserr ("Failed to unlock scores file");
  exit (EXIT_SUCCESS);
}
Ejemplo n.º 6
0
void ProcessPairedEndReads(const string& command, const string& index_file,
                           const string& reads_file_p1,
                           const string& reads_file_p2,
                           const string& output_file,
                           const uint32_t& n_reads_to_process,
                           const uint32_t& max_mismatches,
                           const string& adaptor, const uint32_t& top_k,
                           const int& frag_range, const bool& ambiguous,
                           const bool& unmapped, const bool& SAM,
                           const int& num_of_threads) {
  // LOAD THE INDEX HEAD INFO
  Genome genome;
  HashTable hash_table;

  uint32_t size_of_index;
  ReadIndexHeadInfo(index_file, genome, size_of_index);
  genome.sequence.resize(genome.length_of_genome);
  hash_table.counter.resize(power(4, F2SEEDKEYWIGTH) + 1);
  hash_table.index.resize(size_of_index);

  vector<vector<string> > index_names(2, vector<string>(2));
  index_names[0][0] = index_file + "_CT00";
  index_names[0][1] = index_file + "_CT01";
  index_names[1][0] = index_file + "_GA10";
  index_names[1][1] = index_file + "_GA11";

  vector<vector<string> > read_names(2, vector<string>(n_reads_to_process));
  vector<vector<string> > read_seqs(2, vector<string>(n_reads_to_process));
  vector<vector<string> > read_scores(2, vector<string>(n_reads_to_process));

  vector<int> ranked_results_size(2);
  vector<vector<CandidatePosition> > ranked_results(2,
          vector<CandidatePosition>(MAX_NUM_EXACT_MAPPED));

  vector<vector<TopCandidates> > top_results(2,
         vector<TopCandidates>(n_reads_to_process));

  FILE * fin[2];
  fin[0] = fopen(reads_file_p1.c_str(), "r");
  if (!fin[0]) {
    throw SMITHLABException("cannot open input file " + reads_file_p1);
  }
  fin[1] = fopen(reads_file_p2.c_str(), "r");
  if (!fin[1]) {
    throw SMITHLABException("cannot open input file " + reads_file_p2);
  }

  string adaptors[2];
  extract_adaptors(adaptor, adaptors[0], adaptors[1]);
  clock_t start_t = clock();
  FILE * fout = fopen(output_file.c_str(), "w");
  if (!fout) {
    throw SMITHLABException("cannot open input file " + output_file);
  }
  uint32_t num_of_reads[2];
  StatPairedReads stat_paired_reads(ambiguous, unmapped, output_file, SAM);
  bool AG_WILDCARD = true;
  fprintf(stderr, "[MAPPING PAIRED-END READS FROM THE FOLLOWING TWO FILES]\n");
  fprintf(stderr, "   %s (AND)\n   %s\n", reads_file_p1.c_str(),
          reads_file_p2.c_str());
  fprintf(stderr, "[OUTPUT MAPPING RESULTS TO %s]\n", output_file.c_str());
  if (SAM) {
    SAMHead(index_file, command, fout);
  }
  omp_set_dynamic(0);
  omp_set_num_threads(num_of_threads);
  for (uint32_t i = 0;; i += n_reads_to_process) {
    num_of_reads[0] = num_of_reads[1] = 0;
    for (uint32_t pi = 0; pi < 2; ++pi) {  // paired end reads _1 and _2
      AG_WILDCARD = pi == 1 ? true : false;
      LoadReadsFromFastqFile(fin[pi], i, n_reads_to_process, adaptors[pi],
                             num_of_reads[pi], read_names[pi], read_seqs[pi],
                             read_scores[pi]);
      if (num_of_reads[pi] == 0)
        break;

      //Initialize the paired results
      for (uint32_t j = 0; j < num_of_reads[pi]; ++j) {
        top_results[pi][j].Clear();
        top_results[pi][j].SetSize(top_k);
      }

      for (uint32_t fi = 0; fi < 2; ++fi) {
        ReadIndex(index_names[pi][fi], genome, hash_table);
        char strand = fi == 0 ? '+' : '-';
#pragma omp parallel for
        for (uint32_t j = 0; j < num_of_reads[pi]; ++j) {
          PairEndMapping(read_seqs[pi][j], genome, hash_table, strand,
                         AG_WILDCARD, max_mismatches, top_results[pi][j]);
        }
      }
    }
    if (num_of_reads[0] != num_of_reads[1]) {
      fprintf(stderr,
              "The number of reads in paired-end files should be the same.\n");
      exit( EXIT_FAILURE);
    }
    if (num_of_reads[0] == 0) {
      break;
    }
    stat_paired_reads.total_read_pairs += num_of_reads[0];
    ///////////////////////////////////////////////////////////
    // Merge Paired-end results
    for (uint32_t j = 0; j < num_of_reads[0]; ++j) {
      for (uint32_t pi = 0; pi < 2; ++pi) {
        ranked_results_size[pi] = 0;
        while (!top_results[pi][j].candidates.empty()) {
          ranked_results[pi][ranked_results_size[pi]++] =
              top_results[pi][j].Top();
          top_results[pi][j].Pop();
        }
      }

      MergePairedEndResults(genome, read_names[0][j], read_seqs[0][j],
                            read_scores[0][j], read_seqs[1][j],
                            read_scores[1][j], ranked_results,
                            ranked_results_size, frag_range, max_mismatches,
                            SAM, stat_paired_reads, fout);
    }

    if (num_of_reads[0] < n_reads_to_process)
      break;
  }

  fclose(fin[0]);
  fclose(fin[1]);
  fclose(fout);

  OutputPairedStatInfo(stat_paired_reads, output_file);
  fprintf(stderr, "[MAPPING TAKES %.0lf SECONDS]\n",
          (double(clock() - start_t) / CLOCKS_PER_SEC));
}
Ejemplo n.º 7
0
int main(int argc, char *argv[]) {
	int i;
	char **menutext;

	/* Allocate space for menu texts and write them there */

	menutext = malloc(5*sizeof(*menutext));
	for(i=0;i<5;i++)
		menutext[i] = malloc(64*sizeof(**menutext));

	sprintf(menutext[0],"Play speed mode");
	sprintf(menutext[1],"Play time mode");
	sprintf(menutext[2],"Players: 1");
	sprintf(menutext[3],"Settings");
	sprintf(menutext[4],"Quit");

	/* Init allegro and stuff I need */
	allegro_init();
	install_keyboard();
	/* install_mouse(); */

	/* Init gfx mode */
	set_color_depth(24);
	set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800,600,0,0);
	set_window_title("Anton Pirogov's MoneyMan v1.0");

	/* Init logic tick timer */
	install_timer();
	LOCK_VARIABLE(speed_counter);
	LOCK_FUNCTION(increment_speed_counter);
	install_int_ex(increment_speed_counter, BPS_TO_TIMER(60));
	/* Lock coin movement timer */
	LOCK_VARIABLE(coinmove_counter);
	LOCK_FUNCTION(increment_coinmove_counter);

	set_close_button_callback( close_button_handler ); /* Close with X */

	/* Set colors */
	titlecol=makecol(255,192,0);
	infocol=makecol(255,128,192);
	menucol=makecol(0,0,255);
	menuselcol=makecol(171,171,255);
	backcolor=makecol(245, 245, 220); /* beige */
	scoretitcol=makecol(0,128,128);
	scorenamcol=makecol(128,64,255);
	scorescrcol=makecol(255,128,255);

	/* Load font */
	myfont = load_font("gfx/Komikaboogie18px.tga",NULL,NULL);

	/* Show main menu */
	read_scores();
	generic_menu(menutext,5,mainmenu_event,backcolor,menucol,menuselcol,fontpxsize,0,0,renderscores);

	/* Finish clean up */
	for (i=0;i<4;i++)
		free(menutext[i]);
	free(menutext);
	allegro_exit();
	return 0;
}
Ejemplo n.º 8
0
void do_highscores(int score)
{
   read_scores();

   ResourceManager& rm = ResourceManager::getInstance();
   Input *input = (Input *)rm.getData(RES_INPUT);
   ALLEGRO_FONT *sm_font = (ALLEGRO_FONT *)rm.getData(RES_SMALLFONT);
   ALLEGRO_FONT *big_font = (ALLEGRO_FONT *)rm.getData(RES_LARGEFONT);
   
   bool is_high = score >= highScores[NUM_SCORES-1].score;
   bool entering = is_high;
   double bail_time = al_get_time() + 8;
   int letter_num = 0;
   char name[4] = "   ";
   int character = 0;
   double next_input = al_get_time();
   double spin_start = 0;
   int spin_dir = 1;

   for (;;) {
      /* Catch close button presses */
      ALLEGRO_EVENT_QUEUE *events = ((DisplayResource *)rm.getResource(RES_DISPLAY))->getEventQueue();
      while (!al_is_event_queue_empty(events)) {
         ALLEGRO_EVENT event;
         al_get_next_event(events, &event);
#ifdef ALLEGRO_IPHONE
         if (event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING || event.type == ALLEGRO_EVENT_DISPLAY_SWITCH_OUT) {
            switch_game_out(event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING);
         }
         else if (event.type == ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING || event.type == ALLEGRO_EVENT_DISPLAY_SWITCH_IN) {
            switch_game_in();
         }
#else
         if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
            exit(0);
#endif
      }

      input->poll();
      
      if (entering && al_get_time() > next_input) {
         float lr = input->lr();

         if (lr != 0) {
            if (lr < 0) {
               character--;
               if (character < 0)
                  character = 25;
               spin_dir = 1;
            }
            else if (lr > 0) {
               character++;
               if (character >= 26)
                  character = 0;
               spin_dir = -1;
            }
            next_input = al_get_time()+0.2;
            my_play_sample(RES_FIRESMALL);
            spin_start = al_get_time();
         }

         if (input->b1() && letter_num < 3) {
            name[letter_num] = 'A' + character;
            letter_num++;
            if (letter_num >= 3) {
               entering = false;
               bail_time = al_get_time()+8;
               insert_score(name, score);
               write_scores();
            }
            next_input = al_get_time()+0.2;
            my_play_sample(RES_FIRELARGE);
         }
      }
      else if (!entering) {
         if (al_get_time() > bail_time) {
            return;
         }
         else if (input->b1() && al_get_time() > next_input) {
            al_rest(0.250);
            return;
         }
      }

      al_rest(0.010);

#ifdef ALLEGRO_IPHONE
      if (switched_out) {
         continue;
      }
#endif

      al_clear_to_color(al_map_rgb(0, 0, 0));

      if (entering) {
         float a = ALLEGRO_PI*3/2;
         float ainc = ALLEGRO_PI*2 / 26;
         double elapsed = al_get_time() - spin_start;
         if (elapsed < 0.1) {
            a += (elapsed / 0.1) * ainc * spin_dir;
         }
         float scrh = BB_H / 2 - 32;
         float h = al_get_font_line_height(sm_font);
         for (int i = 0; i < 26; i++) {
            int c = character + i;
            if (c >= 26)
               c -= 26;
            char s[2];
            s[1] = 0;
            s[0] = 'A' +  c;
            int x = BB_W/2 + (cos(a) * scrh) - al_get_text_width(sm_font, s);
            int y = BB_H/2 + (sin(a) * scrh) - h/2;
            al_draw_textf(sm_font, i == 0 ? al_map_rgb(255, 255, 0) : al_map_rgb(200, 200, 200), x, y, 0, "%s", s);
            a += ainc;
         }
         char tmp[4] = { 0, };
         for (int i = 0; i < 3 && name[i] != ' '; i++) {
            tmp[i] = name[i];
         }
         al_draw_textf(big_font, al_map_rgb(0, 255, 0), BB_W/2, BB_H/2-20, ALLEGRO_ALIGN_CENTRE, "%s", tmp);
         al_draw_text(sm_font, al_map_rgb(200, 200, 200), BB_W/2, BB_H/2-20+5+al_get_font_line_height(big_font), ALLEGRO_ALIGN_CENTRE, "high score!");
      }
      else {
         int yy = BB_H/2 - al_get_font_line_height(big_font)*NUM_SCORES/2;
         for (int i = 0; i < NUM_SCORES; i++) {
            al_draw_textf(big_font, al_map_rgb(255, 255, 255), BB_W/2-10, yy, ALLEGRO_ALIGN_RIGHT, "%s", highScores[i].name);
            al_draw_textf(big_font, al_map_rgb(255, 255, 0), BB_W/2+10, yy, ALLEGRO_ALIGN_LEFT, "%d", highScores[i].score);
            yy += al_get_font_line_height(big_font);
         }
      }

#ifdef ALLEGRO_IPHONE
      input->draw();
#endif

      al_flip_display();
   }
}
Ejemplo n.º 9
0
int
main (int argc, char **argv)
{
  int c;
  bool running_suid, running_sgid;
  void *lockstate;
  char *scorefile;
  char *end, *nl, *user, *data;
  const char *prefix, *user_prefix = NULL;
  struct score_entry *scores;
  struct score_entry newscore;
  bool reverse = false;
  ptrdiff_t scorecount, scorealloc;
  ptrdiff_t max_scores = MAX_SCORES;

  srand (time (0));

  while ((c = getopt (argc, argv, "hrm:d:")) != -1)
    switch (c)
      {
      case 'h':
	usage (EXIT_SUCCESS);
	break;
      case 'd':
	user_prefix = optarg;
	break;
      case 'r':
	reverse = 1;
	break;
      case 'm':
	{
	  intmax_t m = strtoimax (optarg, &end, 10);
	  if (optarg == end || *end || m < 0)
	    usage (EXIT_FAILURE);
	  max_scores = min (m, MAX_SCORES);
	}
	break;
      default:
	usage (EXIT_FAILURE);
      }

  if (argc - optind != 3)
    usage (EXIT_FAILURE);

  running_suid = (getuid () != geteuid ());
  running_sgid = (getgid () != getegid ());
  if (running_suid && running_sgid)
    lose ("This program can run either suid or sgid, but not both.");

  prefix = get_prefix (running_suid || running_sgid, user_prefix);

  scorefile = malloc (strlen (prefix) + strlen (argv[optind]) + 2);
  if (!scorefile)
    lose_syserr ("Couldn't allocate score file");

  char *z = stpcpy (scorefile, prefix);
  *z++ = '/';
  strcpy (z, argv[optind]);

  newscore.score = normalize_integer (argv[optind + 1]);
  if (! newscore.score)
    {
      fprintf (stderr, "%s: Invalid score\n", argv[optind + 1]);
      return EXIT_FAILURE;
    }

  user = get_user_id ();
  if (! user)
    lose_syserr ("Couldn't determine user id");
  data = argv[optind + 2];
  if (strlen (data) > MAX_DATA_LEN)
    data[MAX_DATA_LEN] = '\0';
  nl = strchr (data, '\n');
  if (nl)
    *nl = '\0';
  newscore.user_data = malloc (strlen (user) + 1 + strlen (data) + 1);
  if (! newscore.user_data
      || sprintf (newscore.user_data, "%s %s", user, data) < 0)
    lose_syserr ("Memory exhausted");

  if (lock_file (scorefile, &lockstate) < 0)
    lose_syserr ("Failed to lock scores file");

  if (read_scores (scorefile, &scores, &scorecount, &scorealloc) < 0)
    {
      unlock_file (scorefile, lockstate);
      lose_syserr ("Failed to read scores file");
    }
  if (push_score (&scores, &scorecount, &scorealloc, &newscore) < 0)
    {
      unlock_file (scorefile, lockstate);
      lose_syserr ("Failed to add score");
    }
  sort_scores (scores, scorecount, reverse);
  /* Limit the number of scores.  If we're using reverse sorting, then
     also increment the beginning of the array, to skip over the
     *smallest* scores.  Otherwise, just decrementing the number of
     scores suffices, since the smallest is at the end. */
  if (scorecount > max_scores)
    {
      if (reverse)
	scores += scorecount - max_scores;
      scorecount = max_scores;
    }
  if (write_scores (scorefile, running_sgid ? 0664 : 0644,
		    scores, scorecount) < 0)
    {
      unlock_file (scorefile, lockstate);
      lose_syserr ("Failed to write scores file");
    }
  if (unlock_file (scorefile, lockstate) < 0)
    lose_syserr ("Failed to unlock scores file");
  exit (EXIT_SUCCESS);
}
Ejemplo n.º 10
0
/** This constuctor will be the window that houses the gameplay and buttons */
DoodleDiveWindow::DoodleDiveWindow() {

	highScore_ = new Scores(); 

	read_scores(); 
	
	//std::cout << "BLLLLOOOP"<< std::endl; 
	
	setWindowTitle("Doodle Dive!"); 
	
	QVBoxLayout* vertLayout = new QVBoxLayout;
	QHBoxLayout* horzLayout = new QHBoxLayout;  
	
	/**Horizontal elements: gameplay and vertical elements */
	
	gameplay_ = new DoodleDiveGameplay(this); 
	gameplay_ -> setFixedSize(400, 600); 
	
	/**Vertical elements: start, stop, quit, score, level, health*/
	
	start_ = new QPushButton("START");
	pause_ = new QPushButton("PAUSE"); 
	quit_ = new QPushButton("QUIT"); 
	nameBox_ = new QLineEdit("ENTER NAME"); 
	
	//connect functions here
	connect(quit_, SIGNAL(clicked()), qApp, SLOT(quit()));
	connect(start_, SIGNAL(clicked()), gameplay_, 
		SLOT(start_DoodleDive())); 
	connect(pause_, SIGNAL(clicked()), gameplay_, 
		SLOT(pause_DoodleDive()));
	
	/** Code to implement to show scores */
	
	//std::cout<<"CHECKKKK"<< std::endl;
	
	QString* highName = new QString(QString::fromStdString(highScore_->name_)); 
	//highName = &(QString::fromStdString(highScore_->name_));
	 
	
	highScoreName_ = new QLabel(*highName); 
	
	QLabel* scoreLabel = new QLabel("SCORE"); 
	QLabel* levelLabel = new QLabel("LEVEL"); 
	QLabel* healthLabel = new QLabel("HEALTH"); 
	QLabel* nameLabel = new QLabel("NAME"); 
	QLabel* highLabel = new QLabel("HIGH SCORE");
	QLabel* highNameLabel = new QLabel(*highName); 
	
	scoreLabel->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); 
	levelLabel->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); 
	healthLabel->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); 
	nameLabel->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); 
	highLabel->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); 
	highNameLabel->setAlignment(Qt::AlignRight | Qt::AlignBottom); 
	
	scoreLCD_ = new QLCDNumber (4); 
	levelLCD_ = new QLCDNumber (2); 
	healthLCD_ = new QLCDNumber (3); 
	highLCD_ = new QLCDNumber (4); 
	
	highLCD_-> setSegmentStyle(QLCDNumber::Outline);
	scoreLCD_->setSegmentStyle(QLCDNumber::Outline);
	levelLCD_->setSegmentStyle(QLCDNumber::Outline);
	healthLCD_->setSegmentStyle(QLCDNumber::Outline);
	
	highLCD_->display(highScore_->score_);
	scoreLCD_->display(score_); 
	levelLCD_->display(level_); 
	healthLCD_->display(health_); 
	
	/** Adding buttons and scores to a vertical layout */  
	
	vertLayout->addWidget(start_); 
	vertLayout->addWidget(pause_); 
	vertLayout->addWidget(quit_);
	
	vertLayout->addWidget(nameLabel); 
	vertLayout->addWidget(nameBox_); 
	
	vertLayout->addWidget(highLabel); 
	vertLayout->addWidget(highNameLabel); 
	vertLayout->addWidget(highLCD_); 
	
	vertLayout->addWidget(scoreLabel);
	vertLayout->addWidget(scoreLCD_); 
	
	vertLayout->addWidget(levelLabel); 
	vertLayout->addWidget(levelLCD_);
	
	vertLayout->addWidget(healthLabel); 
	vertLayout->addWidget(healthLCD_); 
	
	/** Adding gameplay and vertLayout to horzLayout */
	
	horzLayout->addWidget(gameplay_); 
	horzLayout->addLayout(vertLayout); 
	
	/** Set layout of DoodleDiveWindow (widget) */
	
	setLayout(horzLayout); 
}