示例#1
0
    public void RenderFittestChromosomePath()
    {
        ClearPathTiles();
        Genome fittestGenome = geneticAlgorithm.Genomes[geneticAlgorithm.FittestGenome];

        int[]   fittestDirections = geneticAlgorithm.Decode(fittestGenome.Bits);
        Vector2 position          = startPosition;

        foreach (int direction in fittestDirections)
        {
            position = Move(position, direction);
            GameObject pathTile = Instantiate(pathPrefab);
            pathTile.transform.position = new Vector3(position.x, 0, -position.y);
            pathTiles.Add(pathTile);
        }
    }