Esempio n. 1
0
	} // RunSolve_MonteCarlo

	private Solution TryRandomSolution()
	{
		Solution solution = new Solution();
		MapLayout layout = m_initialLayout.Duplicate();
		while ( layout.NumAreas > 0 )
		{
			int areaToRemove = Random.Range( 0, layout.NumAreas );
			layout.RemoveArea( areaToRemove );
			solution.AreaIDs.Add( areaToRemove );
		}

		// Score the solution somehow:
		solution.FinalLayout = layout;
		solution.EmptySpaces = layout.NumEmptySpaces;
		m_scorer.ScoreLayout( layout, out solution.Score, out solution.GameScore );

		return solution;
	} // TryRandomSolution
Esempio n. 2
0
    private void Playback_ClearTileUnderCursor()
    {
        // Clear the history from this point onwards:
        if (m_playbackIndex < m_playbackLayouts.Count - 1)
        {
            m_playbackLayouts.RemoveRange(m_playbackIndex + 1, m_playbackLayouts.Count - m_playbackIndex - 1);
        }

        // Apply the change and story it in the play history:
        MapLayout nextLayout = m_playbackLayouts[m_playbackIndex].Duplicate();

        nextLayout.FloodFillAreas();
        int areaID = nextLayout.GetAreaID(m_cursorX, m_cursorY);

        if (areaID != Constants.Area_Invalid)
        {
            nextLayout.RemoveArea(areaID);
            m_playbackLayouts.Add(nextLayout);
            ++m_playbackIndex;
            UpdateMapVisuals(nextLayout, true);
            UpdatePlaybackText();
        }
    }     // Playback_ClearTileUnderCursor