Ejemplo n.º 1
0
        public static IGameOfLifePattern CreatePattern(Pattern pattern)
        {
            IGameOfLifePattern golPattern = null;

            switch (pattern)
            {
            case Pattern.Blinker:
                golPattern = new BlinkerPattern();
                break;

            case Pattern.Smiley:
                golPattern = new SmileyPattern();
                break;

            case Pattern.DieHard:
                golPattern = new DieHardPattern();
                break;

            default:
                golPattern = new DieHardPattern();
                break;
            }

            return(golPattern);
        }
Ejemplo n.º 2
0
        private void DrawRandomShape(int shape, Point point)
        {
            var      cell    = CellMapping[point];
            IPattern pattern = null;

            switch (shape)
            {
            case 1:
                pattern = new BeehivePattern();
                break;

            case 2:
                pattern = new GliderPattern();
                break;

            case 3:
                pattern = new BlinkerPattern();
                break;

            case 4:
                pattern = new PentaDecathlonPattern();
                break;

            case 5:
                pattern = new LightWeightSpaceShipPattern();
                break;

            case 6:
                pattern = new RPentominoPattern();
                break;

            case 7:
                pattern = new AcornPattern();
                break;

            case 8:
                pattern = new DiehardPattern();
                break;
            }

            pattern?.DrawPattern(cell);
        }