コード例 #1
0
ファイル: Program.cs プロジェクト: hakgrig98/MarbleGame
        private static void ReadInput()
        {
            string line = Console.ReadLine();

            int[] splitarr = Array.ConvertAll(line.Trim().Split(' '), (s) => int.Parse(s));

            _squareCount = splitarr[0];
            _pointMatrix = new IPoint[splitarr[0], splitarr[0]];

            int countOfMarbles = splitarr[1];
            int countOfWalls   = splitarr[2];

            for (int i = 0; i < countOfMarbles; i++)
            {
                string marbleLine       = Console.ReadLine();
                int[]  marlbeCordinates = Array.ConvertAll(marbleLine.Trim().Split(' '), (s) => int.Parse(s));

                string holeLine       = Console.ReadLine();
                int[]  holeCordinates = Array.ConvertAll(holeLine.Trim().Split(' '), (s) => int.Parse(s));

                _pointMatrix[marlbeCordinates[0], marlbeCordinates[1]] = _pointFactory.Create(_marbleFactory.Create(marlbeCordinates[0], marlbeCordinates[1], _holeFactory.Create(holeCordinates[0], holeCordinates[1])), null);
            }

            for (int i = 0; i < countOfWalls; i++)
            {
                string wallLine       = Console.ReadLine();
                int[]  wallCordinates = Array.ConvertAll(wallLine.Trim().Split(' '), (s) => int.Parse(s));

                _pointMatrix[wallCordinates[0], wallCordinates[1]] = _pointFactory.Create(null, _wallFactory.Create(wallCordinates[0], wallCordinates[1], _helper.GetPosition(wallCordinates[0], wallCordinates[1], wallCordinates[2], wallCordinates[3])));
            }
        }
コード例 #2
0
 public IPoint BuildExistingPoint(int eid, PointValue value, List <IPointEquation> equations)
 {
     return(_pointFactory.Create(eid, value));
 }