Example #1
0
void CubePBC::InitPos(string type)
{
    if("fcc" == type)
        SetupFCC();
    else if("cubic" == type)
        SetupCubic();
    UpdateCoord();
}
Example #2
0
void Ghost::Update()
{
	UpdateCoord();

	if (objType != GOT_PLAYER)
	{
		UpdateAngle();
		UpdateAI(1, true);   // in order to ghosts don't stop

		// updating AI after moving to the next cell
		if (!(i == mi && j == mj))
		{
			if (pGame->IsDifficultyHard() && pGame->GetMode() == "rl")
			{
				if (Velocity == pGame->cGhostList().cbegin()->Velocity)
					UpdateAI(0.4, false);   //0.3
				else
					UpdateAI(0.8, false);   //0.2
			}
			else if (pGame->GetCell(i, j) == 4 || pGame->GetCell(i, j) == 5)
			{
				if (pGame->GetMode() == "s")
					UpdateAI(0.8, false);
				else
				{
					double call_prob = 0.8;             //0.5   0.8
					if (pGame->GetMode() == "rl")
						call_prob = 0.3;                //0.4   0.8   0.2

					if (pGame->IsDifficultyHard())
						// for labyrinth mode
						UpdateAI(call_prob, false);
					else
					{
						if (RANDOM < 0.7)
							UpdateAI(call_prob, false);
						else
							UpdateAI(call_prob);
					}
				}
			}
		}
	}

	Update_mij();   // isn't used if (objType == GOT_PLAYER) -> for future needs
}