Exemplo n.º 1
0
char testFunctionCallback(float seconds, float frequency)
{
  MMRESULT result;

  HWAVEOUT waveOut;
  result = waveOutOpen(&waveOut,
		       WAVE_MAPPER,
		       &waveFormat,
		       (DWORD_PTR)&waveOutCallback,
		       0,
		       CALLBACK_FUNCTION);
  if(result != MMSYSERR_NOERROR) {
    printf("waveOutOpen failed (result=%d)\n", result);
    return 1;
  }

  printf("[tid=%d] Opened Wave Mapper!\n", GetCurrentThreadId());
  fflush(stdout);
  
  waitForKey("to start rendering sound");

  DWORD sampleCount = seconds * waveFormat.nSamplesPerSec;
  LPSTR block1 = allocateBlock(sampleCount);
  LPSTR block2 = allocateBlock(sampleCount);
  fillSinWave(block1, frequency, sampleCount);
  fillSinWave(block2, frequency * 1.5, sampleCount);
  
  printf("Writing block (0x%p)...\n", block1);
  fflush(stdout);

  {
    WAVEHDR header1;
    WAVEHDR header2;
    
    ZeroMemory(&header1, sizeof(WAVEHDR));
    header1.dwBufferLength = sampleCount * waveFormat.nBlockAlign;
    header1.lpData = block1;
    
    writeBlock(waveOut, &header1);

    ZeroMemory(&header2, sizeof(WAVEHDR));
    header2.dwBufferLength = sampleCount * waveFormat.nBlockAlign;
    header2.lpData = block2;
    
    writeBlock(waveOut, &header2);
  }
  waitForKey("to close");

  waveOutClose(waveOut);

  return 0;
}
Exemplo n.º 2
0
// Randomly generates a new playlist of the day.
void RadioStation::generatePlaylistOfTheDay(const unsigned int numberOfMusics) {
	srand((int)time(NULL));
	int MAXIMUM = searchLastID("radioStationMusics.csv") + 1;
	int musicToCopy;

	if(getAllMusicsList().size() != 0)
	{

		playlistOfTheDay.clear();

		for(unsigned int music = 0; music < numberOfMusics; music++) {
			do
			{
				musicToCopy = (rand() % MAXIMUM);
			} while(getMusicFromAllMusicsList(musicToCopy).getAvailable() == 0);
			playlistOfTheDay.push_back(allMusicsList[musicToCopy]);
		}
		checkForHitsOnAllUsers();
	}
	else
	{
		clearScreen();
		cout << msg_vector_empty();
		waitForKey();
	}

	savePlaylistOfTheDayToFile();
}
Exemplo n.º 3
0
// ============================================================
// ===================================================
// PRIZE
// ===================================================
// Prints all users in descending order (best number of hits to worst number of hits). Prints also the winner.
// Uses all below function (from PRIZE category)!
void RadioStation::prizeWinner() {

	vector <User> allUsersVec = loadAllUsersToVector();
	sortAllUsersByHits(allUsersVec);

	clearScreen();
	
	if(!allUsersVec.size() == 0) {

		cout << setw(8) << "Name"
			 << setw(8) << "Age"
			 << setw(8) << "Gender"
			 << setw(16) << "Number of Hits"
			 << endl;

		if(allUsersVec.size() > 10) {
			for(vector<User>::iterator vPtr = allUsersVec.begin(); vPtr != allUsersVec.begin()+10; vPtr++) {
				vPtr->displayUserInformation();
			}

		} else {

			for(vector<User>::iterator vPtr = allUsersVec.begin(); vPtr != allUsersVec.end(); vPtr++) {
				vPtr->displayUserInformation();
			}
		}

		cout << "\n\n\n\n The winner is --> " << userWithMostNumberOfHits(allUsersVec).getName() << endl << endl;
		waitForKey();

	}

}
Exemplo n.º 4
0
/*
    MAINLINE
*/
int main(int argc, const char *argv[]){
  printf("MakeTreeSpawn - Gareth Bradshaw Feb 2003\n");

  /*
     parse command line
  */
  decodeIntParam(argc, argv, intParams);
  decodeBoolParam(argc, argv, boolParams);
  printf("Options : \n");
  writeParam(stdout, intParams);
  writeParam(stdout, boolParams);

  /*
     look for filenames and construct trees
  */
  int numFiles = 0;
  for (int i = 1; i < argc; i++){
    if (argv[i] != NULL){
      constructTree(argv[i], yaml);
      numFiles++;
      }
    }

  /*
     check we had a file name
  */
  if (numFiles == 0)
    error("no files given :(");

  waitForKey();
}
Exemplo n.º 5
0
STATIC void usage( void ) {

    char        msgbuff[MAX_RESOURCE_SIZE];
    int         previous_null = 0;
    int         i;

    header();
    for( i = MSG_USE_BASE;; i++ ) {
        MsgGet( i, msgbuff );
        if( ( msgbuff[ 0 ] == '.' ) && ( msgbuff[ 1 ] == 0 ) ) break;
        if( previous_null ) {
            if( msgbuff[0] != '\0' ) {
                waitForKey();
                PrtFmt( msgbuff );
                PrtFmt( "\n" );
                previous_null = 0;
            } else break;
        } else if( msgbuff[0] == '\0' ) {
            previous_null = 1;
        } else {
            PrtFmt( msgbuff );
            PrtFmt( "\n" );
        }
    }
    exit( EXIT_FAILURE );
}
Exemplo n.º 6
0
void initBoardTest(void) {
	is_board_test_mode = true;
	addConsoleAction("n", nextStep);
	addConsoleActionI("set", setIndex);

	chThdCreateStatic(btThreadStack, sizeof(btThreadStack), NORMALPRIO, (tfunc_t) ivThread, NULL);

	// this code is ugly as hell, I had no time to think. Todo: refactor

	processAdcPin(&fastAdc, 0, "fast");
	while (currentIndex < slowAdc.size()) {
		processAdcPin(&slowAdc, currentIndex, "slow");
		currentIndex++;
	}

	currentIndex = 0;

	int pinsCount = sizeof(BLINK_PINS) / sizeof(brain_pin_e);
	while (currentIndex < pinsCount) {
		currentPin = BLINK_PINS[currentIndex];

		printBoardTestState();
		mySetPadMode2("test", currentPin, PAL_STM32_MODE_OUTPUT);

		currentIndex++;
		waitForKey();
	}
	// no buffered logger still, just plain old stdout
	while (1) {
		print("Board test done, thank you! Time to remove that jumper and reboot\r\n");
		print("Bye!\r\n");
		chThdSleepSeconds(1);
	}
}
Exemplo n.º 7
0
void error( const char* message )
{
	printf( "%s\n", message );
	printf( "Press any key to exit..." );
	waitForKey();
	exit( 1 );
}
Exemplo n.º 8
0
// Deletes all rating files (is invoked when all likes/dislikes are reseted)
void RadioStation::deleteAllRatings() {

	std::string filename;
	std::string line;

	for(unsigned int tempID = 0; tempID < numberOfUsers; tempID++)
	{
		filename = createFilenameWithSequence("ratingsUser", ".csv", 3, tempID);

		fstream fileSave(filename);

		// Checks if playlist file already exists. If so, removes it.
		if(fileSave.good())
		{
			fileSave.close();
			if(remove(filename.c_str()) != 0)
			{
				cout << cantRemoveFileMsg() << endl;
				waitForKey();
			}
		}
		else
		{
			return;
		}
	}

}
Exemplo n.º 9
0
/*
    error handler
*/
int error(const char *errorMsg, const char *errorMsg1){
  if (errorMsg1)
    printf("ERROR : %s (%s)\n", errorMsg, errorMsg1);
  else
    printf("ERROR : %s\n", errorMsg);

  waitForKey();
  exit(-1);
}
Exemplo n.º 10
0
void Plotter::close(){
    string buffer = "replot\n";
    fprintf(gnuplotPipe, buffer.c_str());
    fflush(gnuplotPipe);
    
    waitForKey();
    
#ifdef _WIN32
    _pclose(gnuplotPipe);
#else
    pclose(gnuplotPipe);
#endif


    closed=true;
}
Exemplo n.º 11
0
int main( int argc, char **argv )
{
#ifdef WIN32
	SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sigint_handler, TRUE );
#else
	struct sigaction act;
	memset( &act, 0, sizeof( act ) );
	act.sa_handler = sigint_handler;
	sigaction( SIGINT, &act, NULL );
#endif

	com = Com_construct();

	if( argc > 1 )
	{
		Com_setAddress( com, argv[1] );
	}
	else
	{
		Com_setAddress( com, "172.26.1.1" );
		//Com_setAddress( com, "192.168.101.101" );
	}

	if( FALSE == Com_connect( com ) )
	{
		error( "Error on connect" );
	}
	else
	{
		char addressBuffer[256];
		Com_address( com, addressBuffer, 256 );
		printf( "Connected to %s\n", addressBuffer );
	}

	cbha = CompactBHA_construct();

	drive();

	CompactBHA_destroy( cbha );
	Com_destroy( com );

	printf( "Press any key to exit...\n" );

	waitForKey();
}
Exemplo n.º 12
0
 /**
  * Lights the debug led and waits for a key to be pressed in 
  * the serial console before sending the text
  */
 void stopWithMessage(String text) {
     digitalWrite(DEBUG_LED, HIGH);
     waitForKey();
     DEBUG_SERIAL.println(text);
     while(true);
 }
Exemplo n.º 13
0
int main() {

	Simulation *theSim = new Simulation;
	TrainController *tCtrl = new TrainController(theSim); //pass in sim.

	//1. read in stage, e.g how many stations, how many vehicles, how many trains
	//one file for stations and its vehicles, one for trains

	tCtrl->readInData("data/stations.dat","data/trains.dat");
	
	//2. create events from trains that have been read in
	//trains are located with pointers in trainController, sorted by dep time.
	//for each train, schedule an event, with its departure time, id, and station id.

	tCtrl->scheduleEvents();

	//print menu which lets user advance time

	char ch; //menu selection
	bool rerun = true, simHasEvents = true;
	//int cTime;
	int select, trainId,objId;

	do
	{
		cout << string(100, '\n');

		cout << endl
			<< " *-*-*-*-* MENU *-*-*-*-*" << endl
			<< " 1. Advance time" << endl
			<< " 2. Get train info" << endl
			<< " 3. Get station info" << endl
			<< " 4. Train system info" << endl
			<< " 5. Quit" << endl << endl
			<< "Please make your selection:";

		cin >>ch; // user makes their choice
		cin.get();


		// run based on user input	
		switch(ch)
		{ 
		case '1':
			cout << endl << endl;
			
			if( ! simHasEvents) {
				cout << "End of simulation. Details: " << endl << endl;
				tCtrl->printSummary();
				rerun = false;
				break;
			}
			
			cout << "time " << theSim->getTime() + TIMESTEP << ": Moved forward " << TIMESTEP << " minutes..." << endl << endl;
			simHasEvents = theSim->advance(TIMESTEP);

			waitForKey();
			break;

		case '2':
			cout << endl << endl
				<< "Which train would you like details on?";
			cin >> trainId;
			cin.get();

			tCtrl->printTrain(trainId);

			waitForKey();
			break;

		case '3':
			cout << endl << endl
				<< "Which station would you like details on?";
			cin >> objId;
			cin.get();

			tCtrl->printStation(objId);

			waitForKey();
			break;
		case '4':
			cout << endl << endl;
			tCtrl->display();
			waitForKey();
			break;
	
		case '5':
		case 'q':
		case 'Q':
		case char(27):
			rerun = false;
			break; // end program with option 3, q or Q, or escape button
		default: cout << "not an option on the list!";
			waitForKey();
		}
	}while(rerun);	

system("pause");

delete theSim;
delete tCtrl;

return 0;
}
Exemplo n.º 14
0
void OEMFGame :: initialize()
{
	float gravity = 0.5f;
	
	m_beginX = 0;
	m_beginY = 0;
	
	char levelfile[256];
	sprintf(levelfile, PREPATH "level%d.lvl", (int) m_levelNo);
	
	if (m_level != 0)
		delete m_level;
	FILE * fh = fopen(levelfile, "r");
	
	if (fh != 0)
	{
		// level found!
		fclose(fh);
		
		m_level = new OEMFLevel(levelfile);
	}
	else
	{
		m_level = new OEMFLevel(PREPATH "level1.lvl");
	}
	
	m_level->prepareForGame(); // very important!
	
	m_player = m_level->types[TYPE_START][0];
	
	m_physicsEnabled.clear();
	m_physicsEnabled.push_back(m_player); // apply physics to the player
	for (int i = 0; i < m_level->m_typeCounts[TYPE_MOVABLE]; ++i)
	{
		m_physicsEnabled.push_back(m_level->types[TYPE_MOVABLE][i]);
		m_level->types[TYPE_MOVABLE][i]->m_ay = gravity; // gravity
	}
	
	// reset the keys
	for (int i = 0; i < KEYCOUNT; ++i)
	{
		m_keyDown[i] = false;
	}
	
	// reset the physics components
	m_player->m_ay = gravity; // gravity
	
	if (fh != 0)
	{
		// initialisation done
		refreshCentered();
		refreshScoreBoard();
		updateScreen();
		
		darkenRect(160, 128, 320, 96);
		char levelbuffer[256];
		sprintf(levelbuffer, "Prepare for level %d:", m_levelNo);
		fonts[FNT_AMIGA]->blitCenterText(this, string(levelbuffer), 0xFF7700, 128 + 16, m_screenWidth);
		fonts[FNT_AMIGA]->blitCenterText(this, string("\"") + m_level->name() + "\"", 0xFFFF00, 128 + 32, m_screenWidth);
		fonts[FNT_AMIGA]->blitCenterText(this, string("Go Go Go!"), 0xFF0000, 128 + 64, m_screenWidth);
		updateScreen();
#ifndef __DEBUG__
		SDL_Delay(3000);
#endif
	}
	else
	{
		// game has ended!
		m_done = 1;
		blitImage(images[IMG_ENDSCREEN], 0, 0);
		blitImage(images[IMG_OEMFOE], 32, 320);
		fonts[FNT_AMIGA]->blitText(this,
//			"----/----|----/----|----/----|----/----|"
			"Congratulations! You reached the end of\n"
			"the game! You can now do something else\n"
			"with your life, but if you are too\n"
			"addicted, you can always use the Level\n"
			"Editor and create more worlds.\n"
			"Press any key to continue...",
			0xFFFF00, 80, 320, 320, false);
		updateScreen();
		waitForKey();
		fadeOut();
	}
}
Exemplo n.º 15
0
// Reset (in the ratings file) the rating atributed to a certain music by the user
void RadioStation::resetRatingsFromMusic(unsigned const int musicID) {
	
	std::string filename;
	std::string line;

	for(unsigned int tempID = 0; tempID < numberOfUsers; tempID++)
	{
		filename = createFilenameWithSequence("ratingsUser", ".csv", 3, tempID);
		unsigned int idCounter = 0;

		std::vector < std::vector <int> > ratingsVec;
		vector<int> row;

		ifstream fileLoad(filename);
		fstream fileSave(filename);

		if(fileLoad.is_open()) {

			getline(fileLoad, line);
			while(getline(fileLoad, line)) {

				ratingsVec.push_back(row);
				ratingsVec[idCounter].push_back(convertStrInt(extractInfo(line)));
				ratingsVec[idCounter].push_back(convertStrInt(extractInfo(line)));

				if(ratingsVec[idCounter][0] == musicID) {
					ratingsVec.erase(ratingsVec.begin()+idCounter);
					idCounter--;
				}

				idCounter++;
			}
			fileLoad.close();
		}
		else 
		{
			return;
		}

		// ============================================================
		// ============== Saves vector to file ========================
		// ============================================================

		// Checks if playlist file already exists. If so, removes it.
		if(fileSave.good()) {
			fileSave.close();
			if(remove(filename.c_str()) != 0)
			{
				cout << cantSaveFileMsg() << endl;
				waitForKey();
			}
		}

		// Creates and opens new playlist file and adds fields.
		fileSave.open(filename, ios::out);
		if(fileSave.is_open())
		{
			if(fileSave.end) {
				fileSave << "MUSIC ID, RATE" << endl;
			}

			// Appends music id to text file.
			for(unsigned int i=0; i < ratingsVec.size(); i++)
			{
				fileSave << ratingsVec[i][0] << "," << ratingsVec[i][1] << endl;
			}

			fileSave.close();
		}
		else
		{
			return;
		}
	}

}
Exemplo n.º 16
0
int main(int argc, char **argv) {
    gfxInitDefault();

    PrintConsole botScreen;
    PrintConsole topScreen;

    consoleInit(GFX_TOP, &topScreen);
    consoleInit(GFX_BOTTOM, &botScreen);
    consoleSelect(&topScreen);

    constexpr size_t NUM_SAMPLES = 160*200;
    u32 *audio_buffer = (u32*)linearAlloc(NUM_SAMPLES * sizeof(u32));
    fillBuffer(audio_buffer, NUM_SAMPLES);

    AudioState state;
    {
        auto dspfirm = loadDspFirmFromFile();
        if (!dspfirm) {
            printf("Couldn't load firmware\n");
            goto end;
        }
        auto ret = audioInit(*dspfirm);
        if (!ret) {
            printf("Couldn't init audio\n");
            goto end;
        }
        state = *ret;
    }

    state.waitForSync();
    initSharedMem(state);
    state.write().dsp_configuration->mixer1_enabled_dirty = true;
    state.write().dsp_configuration->mixer1_enabled = true;
    //state.write().dsp_configuration->limiter_enabled = 1;
    state.notifyDsp();
    printf("init\n");

    state.waitForSync();
    state.notifyDsp();
    state.waitForSync();
    for (auto& gain : state.write().source_configurations->config[0].gain) {
        for (auto& g : gain) {
            g = 0.0;
        }
    }
    state.write().source_configurations->config[0].gain[0][0] = 1.0;
    state.write().source_configurations->config[0].gain[1][0] = 1.0;
    state.write().source_configurations->config[0].gain[1][1] = 0.5;
    state.write().source_configurations->config[0].gain_1_dirty = true;
    state.notifyDsp();
    state.waitForSync();
    state.notifyDsp();
    state.waitForSync();
    state.notifyDsp();

    {
        while (true) {
            state.waitForSync();
            printf("sync = %i, play = %i, cbi = %i\n", state.read().source_statuses->status[0].sync, state.read().source_statuses->status[0].is_enabled, state.read().source_statuses->status[0].current_buffer_id);
            if (state.read().source_statuses->status[0].sync == 1) break;
            state.notifyDsp();
        }
        printf("fi: %i\n", state.frame_id);

        u16 buffer_id = 0;
        //unsigned next_queue_position = 0;

        state.write().source_configurations->config[0].play_position = 0;
        state.write().source_configurations->config[0].physical_address = osConvertVirtToPhys(audio_buffer);
        state.write().source_configurations->config[0].length = NUM_SAMPLES;
        state.write().source_configurations->config[0].mono_or_stereo = DSP::HLE::SourceConfiguration::Configuration::MonoOrStereo::Stereo;
        state.write().source_configurations->config[0].format = DSP::HLE::SourceConfiguration::Configuration::Format::PCM16;
        state.write().source_configurations->config[0].fade_in = false;
        state.write().source_configurations->config[0].adpcm_dirty = false;
        state.write().source_configurations->config[0].is_looping = false;
        state.write().source_configurations->config[0].buffer_id = ++buffer_id;
        state.write().source_configurations->config[0].partial_reset_flag = true;
        state.write().source_configurations->config[0].play_position_dirty = true;
        state.write().source_configurations->config[0].embedded_buffer_dirty = true;

        state.write().source_configurations->config[0].enable = true;
        state.write().source_configurations->config[0].enable_dirty = true;

        state.notifyDsp();

        bool continue_reading = true;
        for (size_t frame_count = 0; continue_reading; frame_count++) {
            state.waitForSync();

            if (state.read().source_statuses->status[0].current_buffer_id) {
                printf("%i cbi = %i\n", frame_count, state.read().source_statuses->status[0].current_buffer_id);
            }

            for (size_t i = 0; i < 160; i++) {
                if (state.write().intermediate_mix_samples->mix1.pcm32[0][i]) {
                    printf("[intermediate] frame=%i, sample=%i\n", frame_count, i);
                    for (size_t j = 0; j < 20; j++) {
                        printf("%08lx ", (u32)state.write().intermediate_mix_samples->mix1.pcm32[0][j]);
                    }
                    printf("\n");
                    break;
                }
            }

            for (size_t i = 0; i < 160 * 2; i++) {
                if (state.read().final_samples->pcm16[i]) {
                    printf("[final] frame=%i, sample=%i\n", frame_count, i);
                    for (size_t j = 0; j < 20; j++) {
                        printf("%04x ", (u16)state.read().final_samples->pcm16[j]);
                    }
                    printf("\n");
                    continue_reading = false;
                    break;
                }
            }

            state.notifyDsp();
        }

        state.waitForSync();
        state.write().source_configurations->config[0].sync = 2;
        state.write().source_configurations->config[0].sync_dirty = true;
        state.notifyDsp();

        while (true) {
            state.waitForSync();
            printf("sync = %i, play = %i\n", state.read().source_statuses->status[0].sync, state.read().source_statuses->status[0].is_enabled);
            if (state.read().source_statuses->status[0].sync == 2) break;
            state.notifyDsp();
        }
        state.notifyDsp();

        printf("Done!\n");
    }

end:
    audioExit(state);
    waitForKey();
    gfxExit();
    return 0;
}
Exemplo n.º 17
0
/*
    construct sphere-tree for the model
*/
bool constructTree(const boost::filesystem::path& input_file,
                   bool toYAML)
{
  boost::filesystem::path output_file
    = input_file.parent_path () / boost::filesystem::basename (input_file);

  if (toYAML)
    output_file += "-spawn.yml";
  else
    output_file += "-spawn.sph";

  printf("Input file: %s\n", input_file.c_str ());
  printf("Output file: %s\n\n", output_file.c_str ());


  /*
      load the surface model
  */
  Surface sur;

  bool loaded = false;
  std::string extension = boost::algorithm::to_lower_copy (input_file.extension ().string ());
  if (extension == ".obj")
    loaded = loadOBJ(&sur, input_file.c_str ());
  else
    loaded = sur.loadSurface(input_file.c_str ());

  if (!loaded){
    printf("ERROR : Unable to load input file (%s)\n\n", input_file.c_str ());
    return false;
    }

  /*
      scale box
  */
  // FIXME: Disable scaling for now (wrong result if a transformation is applied after)
  //float boxScale = sur.fitIntoBox(1000);
  float boxScale = 1.;

  /*
      make medial tester
  */
  MedialTester mt;
  mt.setSurface(sur);
  mt.useLargeCover = true;

  /*
      setup evaluator
  */
  SEConvex convEval;
  convEval.setTester(mt);
  SEBase *eval = &convEval;

  Array<Point3D> sphPts;
  SESphPt sphEval;
  if (testerLevels > 0){   //  <= 0 will use convex tester
    SSIsohedron::generateSamples(&sphPts, testerLevels-1);
    sphEval.setup(mt, sphPts);
    eval = &sphEval;
    printf("Using concave tester (%d)\n\n", sphPts.getSize());
    }

  /*
      verify model
  */
  if (verify){
    bool ok = verifyModel(sur);
    if (!ok){
      printf("ERROR : model is not usable\n\n");
      return false;
      }
    }

  /*
      setup for the set of cover points
  */
  Array<Surface::Point> coverPts;
  MSGrid::generateSamples(&coverPts, numCoverPts, sur, TRUE, minCoverPts);
  printf("%d cover points\n", coverPts.getSize());

  /*
      setup SPAWN algorithm
  */
  SRSpawn spawn;
  spawn.setup(mt);
  spawn.useIterativeSelect = false;
  spawn.eval = eval;

  /*
      setup SphereTree constructor - using dynamic construction
  */
  STGGeneric treegen;
  treegen.eval = eval;
  treegen.useRefit = true;
  treegen.setSamples(coverPts);
  treegen.reducer = &spawn;

  /*
      make sphere-tree
  */
  SphereTree tree;
  tree.setupTree(branch, depth+1);

  waitForKey();
  treegen.constructTree(&tree);

  /*
     save sphere-tree
  */
  if (tree.saveSphereTree(output_file, 1.0f/boxScale)){
    Array<LevelEval> evals;
    if (eval){
      evaluateTree(&evals, tree, eval);
      writeEvaluation(stdout, evals);
      }

    if (!yaml)
    {
      FILE *f = fopen(output_file.c_str (), "a");
      if (f){
        fprintf(f, "\n\n");
        fprintf(f, "Options : \n");
        writeParam(stdout, intParams);
        writeParam(stdout, boolParams);
        fprintf(f, "\n\n");
        writeEvaluation(f, evals);
        fclose(f);
      }
    }

    return true;
    }
  else{
    return false;
    }
}