Exemple #1
0
        public async Task StartAsync()
        {
            int k = await FileBoundary.GetKAsync();

            int[,] visibility = await FileBoundary.ReadVisibilityMatrixAsync();

            int[,] communications = await FileBoundary.ReadCommunicationsMatrixAsync();

            var solver = new CspSolver(k, visibility, communications);
            var result = solver.Solve();
            await FileBoundary.WriteBackResultAsync(result);
        }
Exemple #2
0
        public async Task ReadVisibilityMustWork()
        {
            var visibility = await FileBoundary.ReadVisibilityMatrixAsync();

            var expected = new int[6, 2]
            {
                { 1, 1 },
                { 0, 1 },
                { 0, 1 },
                { 0, 1 },
                { 1, 1 },
                { 1, 0 },
            };

            Assert.IsTrue(
                Enumerable.Range(0, 6)
                .Zip(Enumerable.Range(0, 2), (first, second) => (first, second))
                .All(pair =>
                     visibility[pair.first, pair.second] == expected[pair.first, pair.second]));
        }