[ad_1]
今日の課題は Jeroen Landheer によって提供されます。
騎士がチェス盤を飛び越えてすべてのマスに触れるようにするプログラムを作成しますが、その騎士は同じ場所を 2 回使用することはありません。 開始位置はユーザーが指定する必要があり (または、ユーザー入力を受け入れたくない場合はランダムな位置として指定する必要があります)、プログラムは解を計算して座標のリストに出力する必要があります。
例:
開始: A1
解決策: A1 – B3 – C5 など
先週
彼の多言語解決策に対する ProgramFOX への特別な言及。 素晴らしい。 優勝者は、ヨルゲン・アンダーソンとグレームの間で互角だったが、グレームにさらに高い狂気の偉業をもたらすことを期待して、私はヨルゲンにそれを与えるつもりだ.
解決策 1
Warnsdorff のアルゴリズムの解釈を使用した解決策を次に示します。 騎士のツアー – ウィキペディア[^]
アップデート: コードは、パフォーマンスを犠牲にすることなくリファクタリングされました。
目的
次の目標を持つ柔軟なコア:
1. 次のような他のボード指向のパズルで再利用します。 エイト クイーンズ パズル – ウィキペディア[^]、 ルーク多項式 – ウィキペディア[^]、 と ノースリーインライン問題 – ウィキペディア[^].
2. その他の「ボーナス」タスク:
2a. 特定のボード サイズで解けるすべてのツアーを決定する
2b. 有効な解決策で最小基板サイズを決定する
2c。 決闘の騎士 – ボード上に 1 人以上の騎士がいる解決可能な解決策。
2d。 ユーザーは、ツアーを前後に視覚的にナビゲートし、行われている動きだけでなく、意思決定プロセスがどのように機能するかを確認できます。
2e. パフォーマンス – パフォーマンスよりも柔軟性を犠牲にしない
上記の目的をすべて達成するために、私は Stack(T) クラス (System.Collections.Generic)[^].
コアコード
コードは、PCL (ポータブル クラス ライブラリ) に含まれています。
パフォーマンス目標を達成するために、 Knight
クラスが初期化されると、ボードがリセットされ、すべてのポジションの動きが事前に計算されます。
1. Location
クラス:
public class Location // a Knight's move { public Location(int cols, int rows, int index) { this.cols = cols; this.rows = rows; this.index = index; } public Location(int cols, int rows, int index, int moveNum) : this(cols, rows, index) { this.moveNum = moveNum; } int cols, rows, iRow, col, row, index, moveNum; public int MoveNum => moveNum; public int Index => index; public int Col { get { if (col == 0) calcCoords(); return col; } } public int Row { get { if (row == 0) calcCoords(); return row; } } private void calcCoords() { col = index % cols; row = index / cols; iRow = rows - row; } public override string ToString() { if (col == 0) calcCoords(); if (col < 26) return $"{(char)(col % 26 + 'A')}-{iRow}"; if (col < 52) return $"{new string('A', col / 26) + (char)(col % 26 + 'A')}-{iRow}"; return $"{"AZ" + (col - 52).ToString()}-{iRow}"; } }
2. Board
クラスとインターフェース:
using System.Collections.Generic; public interface IBoard { int Columns { get; } List<List<int>> Locations { get; } IEnumerable<int> Missed { get; } int Rows { get; } IRule Rules { set; } bool[] Visited { get; } Location Init(int? cellId = default(int?)); void ResetVisits(); void UndoVisit(int index); } public class Board : IBoard { public Board(int columns, int rows) { Columns = columns; Rows = rows; Size = columns * rows; } public int Size { get; } public int Rows { get; } = 8; public int Columns { get; } = 8; public List<List<int>> Locations { get; private set; } = new List<List<int>>(); public IEnumerable<int> Missed => Locations.Where((x, i) => !Visited[i]).Select((x, i) => i); private static bool[] visited; public bool[] Visited => visited; public IRule Rules { private get; set; } public Location Init(int? locationId = null) { totalLocations = Columns * Rows; BuildMovesTable(); return new Location(Columns, Rows, locationId.HasValue && locationId.Value > -1 ? locationId.Value : r.Next(0, totalLocations), 0); } public void ResetVisits() { visited = new bool[totalLocations]; } public void UndoVisit(int index) { Visited[index] = false; } private int totalLocations; private Random r = new Random(); private void BuildMovesTable() { ResetVisits(); RebuildTable(); } private void RebuildTable() { Locations = Enumerable.Range(0, totalLocations) .Select(x => Rules.BuildLocation(x)) .ToList(); } }
3. Knight
クラス & IRule
インターフェース:
using System.Collections.Generic; public interface IRule { List<int> BuildLocation(int index); } public class Knight : IRule { public Knight(IBoard board, int? startLocation = null) { Board = board; board.Rules = this; Init(startLocation); } public void Init(int? startLocation) { Board.ResetVisits(); Moves = new Stack<Location>(); Moves.Push(Board.Init(startLocation)); CanMoveNext = true; } public IBoard Board { get; } public Location Start => Moves?.Last(); public Location Current => Moves?.Peek(); public Stack<Location> Moves { get; private set; } public bool CanMoveNext { get; private set; } public void ExecuteMoves() { while (true) { if (MoveNext() == null) break; } } public Location MovePrevious() { if (Moves.Count > 0) Board.Visited[Moves.Pop().Index] = false; CanMoveNext = true; return Moves.Count > 0 ? Moves.Peek() : null; } public Location MoveNext() { var index = Moves.Peek().Index; var c1 = Board.Locations[index]; int ndx = 0, score = int.MaxValue; for (int i = 0; i < c1.Count; i++) if (!Board.Visited[c1[i]] && c1[i] != index) { var tscore = 0; var c2 = Board.Locations[c1[i]]; for (int j = 0; j < c2.Count; j++) if (!Board.Visited[c2[j]] && c2[j] != i) tscore++; if (tscore < score) { ndx = c1[i]; score = tscore; } } Board.Visited[index] = true; CanMoveNext = score != int.MaxValue; if (CanMoveNext) { var newLoc = new Location(Board.Columns, Board.Rows, ndx, Moves.Count); Moves.Push(newLoc); return newLoc; } return null; } List<int> IRule.BuildLocation(int index) { var loc = new List<int>(); int pc = index % Board.Columns, pr = index / Board.Columns; for (int k = 0; k < rules.GetLength(0); k++) { int nc = pc + rules[k, 0], nr = pr + rules[k, 1]; if (nc < Board.Columns && nc > -1 && nr < Board.Rows && nr > -1) loc.Add(nr * Board.Columns + nc); } return loc; } private readonly int[,] rules = new int[,] { { -1, -2 }, { 1, -2 }, { 2, -1 }, { 2, 1 }, { 1, 2 }, { -1, 2 }, { -2, 1 }, { -2, -1 } }; }
チャレンジプルーフ
このプロジェクトは、a) のさまざまなボード サイズと寸法に対してコア コードをテストします。 チャレンジを完了します。 b)。 パフォーマンス。
using System; using System.Linq; using System.Diagnostics; using System.Collections.Generic; using KnightsTour.Core; static class Program { static void Main() { ResetWindow(); Console.WriteLine("Weekly Challenge: Knight's Tour"); Console.WriteLine("===============================\n"); var styles = new List<IReportStyle> { new ChessStyle(), new IndexedStyle(), new LocationStyle() }; foreach (var tour in new List<Tour> { new Tour("Standard Chess Board (8 x 8)", () => Activity(8, 8, null)), new Tour("Smallest Viable Rectangle (4 x 3)", () => Activity(4, 3, 0)), new Tour("2nd Smallest Viable Rectangle (7 x 3)", () => Activity(7, 3, 0)), new Tour("Smallest Viable Square (5 x 5)", () => Activity(5, 5, 0)), new Tour("Large Square Board", () => Activity(20, 20, null)), new Tour("Very Large Square Board", () => Activity(300, 300, 89700)), }) // choose a reporting style format... Report(tour.Activity(), styles[(int)ReportStyle.Chess]); Console.WriteLine("\n-- press any key to exit --"); Console.ReadKey(); Console.CursorVisible = true; } private static Tuple<TimeSpan, Knight> Activity(int cols, int rows, int? startLocation) { TimeSpan elapsed; var sw = new Stopwatch(); var knight = new Knight(new Board(cols, rows), startLocation); //Prime to ensure correct timings... knight.ExecuteMoves(); knight.Init(startLocation); sw.Start(); knight.ExecuteMoves(); elapsed = sw.Elapsed; sw.Stop(); return new Tuple<TimeSpan, Knight>(elapsed, knight); } private static void Report(Tuple<TimeSpan, Knight> result, IReportStyle styleWriter) { var elapsed = result.Item1; var knight = result.Item2; Console.WriteLine($"Board Size : {knight.Board.Columns}, {knight.Board.Rows}"); Console.WriteLine($"\nStarted at : {knight.Start}"); Console.WriteLine($"Final Loc'n : {knight.Current}"); Console.WriteLine($"Total moves : {knight.Moves.Count - 1:N0}"); Console.WriteLine($"Time taken : {elapsed.TotalMilliseconds:N6} ms"); if (knight.Moves.Count < 500) { Console.WriteLine("\nMoves used :"); Console.WriteLine(styleWriter.Format (knight.Moves.OrderBy(x => x.MoveNum))); } if (knight.Board.Missed.Any()) { var missedLocations = knight.Board.Missed.Select (x => new Location(knight.Board.Columns, knight.Board.Rows, x)); Console.WriteLine($"\nCells skipped : {missedLocations.Count()}"); if (knight.Moves.Count < 500) Console.WriteLine(styleWriter.Format(missedLocations)); } else { Console.WriteLine("\nCompleted the board!"); } Console.WriteLine($"\n{new string('-', 80)}\n"); } private static void ResetWindow() { Console.Title = "CODE PROJECT | WEEKLY CODE CHALENGE"; Console.CursorVisible = false; Console.SetWindowSize(80, Console.WindowHeight); Console.Clear(); } } class Tour : Job<Knight> { public Tour(string title, Func<Tuple<TimeSpan, Knight>> func) : base(title, func) { } } class Job<T> { public Job(string title, Func<Tuple<TimeSpan, T>> func) { Title = title; this.func = func; } private readonly Func<Tuple<TimeSpan, T>> func; public string Title { get; } public Tuple<TimeSpan, T> Activity() { Console.WriteLine(Title); Console.WriteLine(new string('-', Title.Length)); Console.WriteLine(); return func.Invoke(); } } enum ReportStyle { Chess, Indexed, Location } interface IReportStyle { string Format(IEnumerable<Location> moves); } class ChessStyle : IReportStyle { public string Format(IEnumerable<Location> moves) => string.Join(", ", moves); } class IndexedStyle : IReportStyle { public string Format(IEnumerable<Location> moves) { var m = moves.ToList(); return string.Join("\n", Enumerable.Range(0, m.Count - 1) .Select(i => $"{i,-3}: {m[i].Index + 1}")); } } class LocationStyle : IReportStyle { public string Format(IEnumerable<Location> moves) { var m = moves.ToList(); return string.Join(", ", Enumerable.Range(0, m.Count - 1) .Select(i => $"{{{m[i].Row}, {m[i].Col}}}")); ; } }
そして出力:
Weekly Challenge: Knight's Tour =============================== Standard Chess Board (8 x 8) ---------------------------- Board Size : 8, 8 Started at : E-2 Final Loc'n : B-2 Total moves : 63 Time taken : 0.049700 ms Moves used : E-2, G-1, H-3, G-5, H-7, F-8, G-6, H-8, F-7, H-6, G-8, E-7, C-8, A-7, C-6, B-8, A-6, B-4, A-2, C-1, B-3, A-1, C-2, E-1, G-2, H-4, F-3, H-2, F-1, D-2, B-1, A-3, B-5, D-4, F-5, G-7, H-5, G-3, H-1, F-2, G-4, E-3, D-1, C-3, E-4, D-6, E-8, F-6, D-5, C-7, A-8, B-6, D-7, E-5, C-4, A-5, B-7, D-8, E-6, F-4, D-3, C-5, A-4, B-2 Completed the board! -------------------------------------------------------------------------------- Smallest Viable Rectangle (4 x 3) --------------------------------- Board Size : 4, 3 Started at : A-3 Final Loc'n : D-1 Total moves : 5 Time taken : 0.017400 ms Moves used : A-3, C-2, A-1, B-3, D-2, B-1, C-3, A-2, C-1, D-3, B-2, D-1 Completed the board! -------------------------------------------------------------------------------- 2nd Smallest Viable Rectangle (7 x 3) ------------------------------------- Board Size : 7, 3 Started at : A-3 Final Loc'n : F-2 Total moves : 20 Time taken : 0.006800 ms Moves used : A-3, C-2, A-1, B-3, C-1, A-2, C-3, B-1, D-2, F-3, G-1, E-2, G-3, F-1, E-3, G-2, E-1, D-3, B-2, D-1, F-2 Completed the board! -------------------------------------------------------------------------------- Smallest Viable Square (5 x 5) ------------------------------ Board Size : 5, 5 Started at : A-5 Final Loc'n : B-2 Total moves : 24 Time taken : 0.009800 ms Moves used : A-5, C-4, E-5, D-3, E-1, C-2, A-1, B-3, C-5, E-4, D-2, B-1, A-3, B-5, D-4, E-2, C-1, A-2, B-4, D-5, E-3, D-1, C-3, A-4, B-2 Completed the board! -------------------------------------------------------------------------------- Large Square Board ------------------ Board Size : 20, 20 Started at : J-15 Final Loc'n : C-5 Total moves : 399 Time taken : 0.341300 ms Moves used : J-15, I-17, H-19, J-20, L-19, N-20, P-19, R-20, T-19, S-17, T-15, S-13, T-11, S-9, T-7, S-5, T-3, S-1, Q-2, O-1, M-2, K-1, I-2, G-1, E-2, C-1, A-2, B-4, A-6, B-8, A-10, B-12, A-14, B-16, A-18, B-20, D-19, F-20, G-18, H-20, J-19, L-20, N-19, P-20, R-19, T-20, S-18, T-16, S-14, T-12, S-10, T-8, S-6, T-4, S-2, Q-1, R-3, T-2, R-1, S-3, T-1, R-2, P-1, O-3, N-1, P-2, Q-4, R-6, T-5, R-4, P-3, N-2, L-1, K-3, J-1, L-2, M-4, O-5, N-3, M-1, O-2, P-4, Q-6, R-8, T-9, S-7, R-5, T-6, S-4, Q-3, P-5, N-4, L-3, J-2, H-1, G-3, F-1, H-2, I-4, K-5, J-3, I-1, K-2, L-4, M-6, O-7, Q-8, R-10, S-8, T-10, S-12, T-14, R-15, Q-17, S-16, T-18, S-20, R-18, Q-20, S-19, T-17, R-16, Q-18, O-19, M-20, N-18, O-20, Q-19, P-17, Q-15, R-17, P-18, O-16, M-17, O-18, P-16, Q-14, S-15, T-13, R-12, Q-10, S-11, R-13, Q-11, R-9, Q-7, P-9, O-11, P-13, R-14, Q-16, P-14, Q-12, P-10, R-11, Q-13, P-15, O-17, N-15, O-13, P-11, Q-9, R-7, Q-5, P-7, O-9, N-11, P-12, O-14, N-16, M-18, K-17, M-16, O-15, N-17, M-19, K-18, L-16, M-14, N-12, O-10, P-8, O-6, N-8, M-10, L-12, N-13, M-15, L-17, K-19, I-20, J-18, K-20, L-18, K-16, L-14, M-12, N-14, O-12, N-10, O-8, P-6, O-4, N-6, M-8, L-10, N-9, M-11, L-13, K-15, J-17, I-19, G-20, H-18, I-16, J-14, L-15, M-13, K-12, I-13, K-14, J-16, I-18, H-16, I-14, K-13, L-11, M-9, N-7, M-5, L-7, K-9, J-11, H-12, J-13, I-15, H-17, G-19, E-20, F-18, G-16, H-14, I-12, K-11, L-9, M-7, N-5, M-3, L-5, K-7, J-9, L-8, K-10, J-12, I-10, J-8, K-6, J-4, I-6, H-8, J-7, L-6, K-4, J-6, K-8, J-10, I-8, H-10, G-12, I-11, H-13, G-15, F-17, E-19, C-20, A-19, C-18, D-20, B-19, A-17, B-15, A-13, C-14, A-15, B-17, C-19, A-20, B-18, D-17, E-15, G-14, F-16, E-18, D-16, F-15, E-17, F-19, G-17, H-15, G-13, H-11, I-9, G-10, F-12, E-14, C-15, A-16, C-17, E-16, D-18, C-16, D-14, F-13, G-11, H-9, I-7, J-5, I-3, H-5, G-7, F-9, E-11, D-13, F-14, D-15, B-14, A-12, C-13, E-12, F-10, G-8, H-6, G-4, I-5, H-3, F-2, D-1, B-2, A-4, C-3, B-1, A-3, B-5, A-7, B-9, A-11, B-13, C-11, D-9, C-7, A-8, B-10, C-12, E-13, D-11, E-9, F-11, D-10, B-11, D-12, C-10, A-9, C-8, B-6, D-5, E-7, G-6, H-4, G-2, F-4, D-3, E-1, C-2, A-1, B-3, A-5, C-6, D-4, F-5, E-3, C-4, D-2, F-3, E-5, D-7, C-9, E-10, F-8, H-7, G-9, E-8, F-6, E-4, D-6, F-7, G-5, E-6, D-8, B-7, C-5 Completed the board! -------------------------------------------------------------------------------- Very Large Square Board ----------------------- Board Size : 300, 300 Started at : A-1 Final Loc'n : L-21 Total moves : 89,999 Time taken : 124.877700 ms Completed the board! -------------------------------------------------------------------------------- -- press any key to exit --
ボーナス タスク 1 – 可能なツアーの数
与えられたボード サイズで、利用可能な解決可能なすべてのパスを見つけます。
using KnightsTour.Core; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; class Program { static List<Tuple<TimeSpan, Knight>> Tours = new List<Tuple<TimeSpan, Knight>>(); static void Main() { ResetWindow(); Console.WriteLine("Weekly Challenge: Knight's Tour"); Console.WriteLine("===============================\n"); Console.WriteLine("Bonus Challenge: Find All Solutions for a given Board Size\n"); var styles = new List<IReportStyle> { new ChessStyle(), new IndexedStyle(), new LocationStyle() }; TripPlanner(3, 7); ReportResults(styles[(int)ReportStyle.Chess]); Console.WriteLine("\n-- press any key to exit --"); Console.ReadKey(); Console.CursorVisible = true; } private static void TripPlanner(int rows, int cols) { int size = rows * cols; // try each location for a valid solution for (int start = 0; start < size; start++) TryTour(rows, cols, start); } private static void TryTour(int rows, int cols, int startLocation) { TimeSpan elapsed; var sw = new Stopwatch(); var knight = new Knight(new Board(cols, rows), startLocation); //Prime to ensure correct timings... knight.ExecuteMoves(); knight.Init(startLocation); //Actual Task sw.Start(); knight.ExecuteMoves(); elapsed = sw.Elapsed; sw.Stop(); var success = !knight.Board.Missed.Any(); if (success) Tours.Add(new Tuple<TimeSpan, Knight>(elapsed, knight)); } private static void ReportResults(IReportStyle styleWriter) { var board = Tours[0].Item2.Board; Console.WriteLine($"Board Size : {board.Columns}, {board.Rows}"); Console.WriteLine($"Task Outcome : {(Tours.Any() ? "Completed!" : "Failed!")}"); Console.WriteLine($"Total Tours : {Tours.Count} possible"); foreach (var tour in Tours) { var elapsed = tour.Item1; var knight = tour.Item2; Console.WriteLine($"\nStarted at : {knight.Start}"); Console.WriteLine($"Final Loc'n : {knight.Current}"); Console.WriteLine($"Time taken : {elapsed.TotalMilliseconds:N6} ms"); if (knight.Moves.Count < 500) { Console.WriteLine("Moves used :\n"); Console.WriteLine(styleWriter.Format (knight.Moves.OrderBy(x => x.MoveNum))); } } } private static void ResetWindow() { Console.Title = "CODE PROJECT | WEEKLY CODE CHALENGE"; Console.CursorVisible = false; Console.SetWindowSize(80, Console.WindowHeight); Console.Clear(); } }
そして出力:
Weekly Challenge: Knight's Tour =============================== Bonus Challenge: Find All Solutions for a given Board Size Board Size : 7, 3 Task Outcome : Completed! Total Tours : 5 possible Started at : A-3 Final Loc'n : F-2 Time taken : 0.006800 ms Moves used : A-3, C-2, A-1, B-3, C-1, A-2, C-3, B-1, D-2, F-3, G-1, E-2, G-3, F-1, E-3, G-2, E-1, D-3, B-2, D-1, F-2 Started at : E-3 Final Loc'n : F-2 Time taken : 0.033800 ms Moves used : E-3, G-2, E-1, F-3, G-1, E-2, G-3, F-1, D-2, B-1, A-3, C-2, A-1, B-3, C-1, A-2, C-3, D-1, B-2, D-3, F-2 Started at : F-2 Final Loc'n : C-3 Time taken : 0.013300 ms Moves used : F-2, D-1, B-2, D-3, E-1, G-2, E-3, F-1, G-3, E-2, G-1, F-3, D-2, B-1, A-3, C-2, A-1, B-3, C-1, A-2, C-3 Started at : C-1 Final Loc'n : F-2 Time taken : 0.00600 ms Moves used : C-1, A-2, C-3, B-1, A-3, C-2, A-1, B-3, D-2, F-3, G-1, E-2, G-3, F-1, E-3, G-2, E-1, D-3, B-2, D-1, F-2 Started at : E-1 Final Loc'n : F-2 Time taken : 0.007200 ms Moves used : E-1, G-2, E-3, F-1, G-3, E-2, G-1, F-3, D-2, B-1, A-3, C-2, A-1, B-3, C-1, A-2, C-3, D-1, B-2, D-3, F-2 -- press any key to exit --
ボーナス タスク 2 – 最小の正方形と長方形のボード サイズ
このタスクでは、ボーナス 1 の概念を使用し、標準サイズの 8 x 8 のチェス盤のグリッドから見て、解ける小さな正方形および長方形の盤サイズを探します。 このタスクを実行するコードは非常にコンパクトです。
using KnightsTour.Core; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; class Program { static List<Tuple<TimeSpan, Knight>> Tours = new List<Tuple<TimeSpan, Knight>>(); static void Main() { ResetWindow(); Console.WriteLine("Weekly Challenge: Knight's Tour"); Console.WriteLine("===============================\n"); Console.WriteLine("Bonus Challenge: Find the smallest Solvable Board Sizes\n"); Console.WriteLine("Starting at the size of a Chess board size (8 x 8 = 64), determine (up to 10)\ndimensions of the smallest solvable solution for both square and rectangular\nboards.\n"); // down to 4 x 4 = 20 which is invalid & test each location as a start point for (int size = 64 - 1; size >= 9; size--) TryTour(size); // smallest grid to largest var orderedTours = Tours.OrderBy(x => x.Item2.Moves.Count); // group square boards by dimensions var bestBox = orderedTours .Where(x => x.Item2.Board.Columns.Equals(x.Item2.Board.Rows)) .GroupBy(x => $"{x.Item2.Board.Columns} x {x.Item2.Board.Rows}") .Take(10); // group rectangular boards by dimensions var bestRects = orderedTours .Where(x => !x.Item2.Board.Columns.Equals(x.Item2.Board.Rows)) .GroupBy(x => $"{x.Item2.Board.Columns} x {x.Item2.Board.Rows}") .Take(10); // false = sized grid summary only, // true = every solution by grid size var detailedReporting = false; Console.WriteLine("Smallest Boxes"); ReportSolutions(bestBox, detailedReporting); Console.WriteLine("\nSmallest Rectangles"); ReportSolutions(bestRects, detailedReporting); Console.WriteLine("\n-- press any key to exit --"); Console.ReadKey(); Console.CursorVisible = true; } private static void TryTour(int size) { // break the size into boxes var factors = getFactors(size).ToArray(); if (factors.Length == 1) // square TryTour(new int[,] { { factors[0], factors[0] } }, size); else //rectangle for (int factor = 0; factor < factors.Length / 2; factor++) { var index = factor * 2; TryTour(new int[,] { { factors[index], factors[index + 1] } }, size); } } private static void TryTour(int[,] gridSize, int size) { // try each location for a valid solution for (int start = 0; start < size; start++) { // try the normal grid TryTour(gridSize[0, 0], gridSize[0, 1], start); //try the inverted grid if failed if (!gridSize[0, 0].Equals(gridSize[0, 1])) TryTour(gridSize[0, 1], gridSize[0, 0], start); } } private static bool TryTour(int rows, int cols, int startLocation) { TimeSpan elapsed; var sw = new Stopwatch(); var knight = new Knight(new Board(cols, rows), startLocation); //Prime to ensure correct timings... knight.ExecuteMoves(); knight.Init(startLocation); sw.Start(); knight.ExecuteMoves(); elapsed = sw.Elapsed; sw.Stop(); var success = !knight.Board.Missed.Any(); if (success) Tours.Add(new Tuple<TimeSpan, Knight>(elapsed, knight)); return success; } public static IEnumerable<int> getFactors(int x) { for (int i = 2; i * i <= x; i++) if (0 == (x % i)) { yield return i; if (i != (x / i)) yield return x / i; } } private static void ReportSolutions (IEnumerable<IGrouping<string, Tuple<TimeSpan, Knight>>> bestBox, bool isDetailed = false) { foreach (var item in bestBox) { var loc = $"{{{item.First().Item2.Board.Rows},{ item.First().Item2.Board.Columns}}}"; var count = item.Count(); var moves = item.First().Item2.Moves.Count - 1; Console.WriteLine($"{loc} has {count} solutions in {moves} moves"); if (isDetailed) foreach (var result in item) { var start = result.Item2.Moves.First(); var end = result.Item2.Moves.Last(); var ms = result.Item1.TotalMilliseconds; Console.WriteLine($" - From: {start} To: {end} in {ms:N6} ms"); } } } private static void ResetWindow() { Console.Title = "CODE PROJECT | WEEKLY CODE CHALENGE"; Console.CursorVisible = false; Console.SetWindowSize(80, Console.WindowHeight); Console.Clear(); } }
そして出力:
Weekly Challenge: Knight's Tour =============================== Bonus Challenge: Find the smallest Solvable Board Sizes Starting at the size of a Chess board size (8 x 8 = 64), determine (up to 10) dimensions of the smallest solvable solution for both square and rectangular boards. Smallest Boxes {5,5} has 5 solutions in 24 moves {7,7} has 19 solutions in 48 moves Smallest Rectangles {3,4} has 6 solutions in 11 moves {4,3} has 5 solutions in 11 moves {4,5} has 5 solutions in 19 moves {5,4} has 10 solutions in 19 moves {3,7} has 5 solutions in 20 moves {7,3} has 5 solutions in 20 moves {3,8} has 11 solutions in 23 moves {8,3} has 10 solutions in 23 moves {4,6} has 10 solutions in 23 moves {6,4} has 4 solutions in 23 moves -- press any key to exit --
ボーナス タスク 3 – 騎士の決闘
このタスクでは、4 人の騎士がいる 8 x 8 のボードと、8 人の騎士がいる 20 x 20 のボードを使用しています。
using System; using System.Linq; using System.Diagnostics; using System.Collections.Generic; using KnightsTour.Core; static class Program { static void Main() { ResetWindow(); Console.WriteLine("Weekly Challenge: Knight's Tour"); Console.WriteLine("===============================\n"); Console.WriteLine("Bonus Challenge: Dueling Knights\n"); var styles = new List<IReportStyle> { new ChessStyle(), new IndexedStyle(), new LocationStyle() }; foreach (var tour in new List<Tour> { new Tour("Standard Chess Board (8 x 8)", () => Test(8, 8, new List<int?> { null, null, null, null })), new Tour("Large Board (20 x 20)", () => Test(20, 20, new List<int?> { 0, 19, 126, 133, 266, 273, 380, 399 })) }) // choose a reporting style format... ReportResults(tour.Activity(), styles[(int)ReportStyle.Chess]); Console.WriteLine("\n-- press any key to exit --"); Console.ReadKey(); Console.CursorVisible = true; } private static Tuple<TimeSpan, List<Knight>> Test(int cols, int rows, List<int?> startLocations) { TimeSpan elapsed; var sw = new Stopwatch(); bool canMove; var board = new Board(cols, rows); var knights = new List<Knight>(); foreach (var loc in startLocations) { var knight = new Knight(new Board(cols, rows), loc); //Prime to ensure correct timings... knight.ExecuteMoves(); knight.Init(loc); knights.Add(new Knight(board, loc)); } int tl = knights.Count; sw.Start(); do { canMove = false; for (int i = 0; i < tl; i++) { knights[i].MoveNext(); if (knights[i].CanMoveNext) canMove = true; } if (!canMove) { elapsed = sw.Elapsed; break; } } while (true); sw.Stop(); return new Tuple<TimeSpan, List<Knight>>(elapsed, knights); } private static void ReportResults(Tuple<TimeSpan, List<Knight>> result, IReportStyle styleWriter) { var elapsed = result.Item1; var knights = result.Item2; var board = knights[0].Board; Console.WriteLine($"Board Size : {board.Columns}, {board.Rows}"); Console.WriteLine($"Time taken : {elapsed.TotalMilliseconds:N6} ms"); Console.WriteLine($"Task Outcome : {(board.Missed.Any() ? "Failed!" : "Completed!")}"); for (int i = 0; i < knights.Count; i++) { var knight = knights[i]; Console.WriteLine($"\nStarted at : {knight.Start}"); Console.WriteLine($"Final Loc'n : {knight.Current}"); Console.WriteLine($"Total moves : {knight.Moves.Count - 1:N0}"); if (knight.Moves.Count < 500) { Console.WriteLine("Moves used :\n"); Console.WriteLine(styleWriter.Format (knight.Moves.OrderBy(x => x.MoveNum))); } } Console.WriteLine($"\n{new string('-', 80)}\n"); } private static void ResetWindow() { Console.Title = "CODE PROJECT | WEEKLY CODE CHALENGE"; Console.CursorVisible = false; Console.SetWindowSize(80, Console.WindowHeight); Console.Clear(); } }
そして出力:
Weekly Challenge: Knight's Tour =============================== Bonus Challenge: Duelling Knights Standard Chess Board (8 x 8) ---------------------------- Board Size : 8, 8 Time taken : 0.085500 ms Task Outcome : Completed! Started at : F-6 Final Loc'n : D-3 Total moves : 23 Moves used : F-6, G-8, H-6, G-4, F-2, H-3, G-1, E-2, C-3, B-1, A-3, B-5, A-7, C-8, D-6, F-5, D-4, E-6, C-5, B-3, A-1, C-2, E-1, D-3 Started at : C-1 Final Loc'n : D-3 Total moves : 23 Moves used : C-1, A-2, B-4, A-6, B-8, D-7, F-8, H-7, G-5, E-4, D-2, C-4, E-3, G-2, H-4, F-5, D-4, E-6, C-5, B-3, A-1, C-2, E-1, D-3 Started at : D-1 Final Loc'n : F-3 Total moves : 22 Moves used : D-1, B-2, A-4, B-6, A-8, C-7, E-8, G-7, H-5, F-4, D-5, E-7, C-8, D-6, F-5, D-4, E-6, D-8, F-7, H-8, G-6, E-5, F-3 Started at : H-2 Final Loc'n : D-3 Total moves : 23 Moves used : H-2, F-1, G-3, H-1, F-2, H-3, G-1, E-2, C-3, B-1, A-3, B-5, A-7, C-6, A-5, B-7, D-8, F-7, H-8, G-6, E-5, F-3, E-1, D-3 -------------------------------------------------------------------------------- Large Board (20 x 20) --------------------- Board Size : 20, 20 Time taken : 0.958200 ms Task Outcome : Completed! Started at : L-18 Final Loc'n : D-7 Total moves : 131 Moves used : L-18, K-20, M-19, O-20, Q-19, S-20, T-18, R-19, P-20, Q-18, R-16, S-14, T-12, S-10, T-8, S-6, T-4, S-2, R-4, Q-6, R-8, Q-10, R-12, Q-14, O-15, Q-16, R-14, P-13, O-11, Q-12, R-10, P-9, Q-7, R-5, P-4, R-3, T-2, R-1, P-2, N-1, O-3, P-1, R-2, Q-4, P-6, O-8, N-10, M-12, L-14, K-16, J-18, I-16, J-14, K-12, L-10, N-9, O-7, N-5, M-3, O-2, Q-1, P-3, N-4, L-3, M-1, K-2, I-1, J-3, L-4, M-6, K-5, J-7, K-9, J-11, I-13, H-15, I-17, H-19, G-17, E-16, G-15, I-14, J-12, H-13, F-12, H-11, I-9, K-10, L-8, J-9, I-11, G-10, H-8, I-10, G-11, E-12, C-11, E-10, G-9, E-8, F-10, H-9, J-8, K-6, J-4, H-5, I-3, K-4, J-2, H-1, G-3, F-5, E-7, D-9, C-7, B-5, D-6, F-7, D-8, C-6, D-4, F-3, G-5, H-7, I-5, H-3, F-2, E-4, F-6, G-4, E-5, D-7 Started at : T-20 Final Loc'n : D-7 Total moves : 131 Moves used : T-20, S-18, R-20, T-19, S-17, T-15, S-13, T-11, S-9, T-7, S-5, T-3, S-1, Q-2, O-1, M-2, K-1, I-2, G-1, E-2, C-1, A-2, B-4, A-6, B-8, A-10, C-9, A-8, B-10, A-12, B-14, C-16, E-15, F-17, D-18, E-20, G-19, I-20, K-19, L-17, M-15, N-13, M-11, L-13, K-15, M-14, L-16, N-15, M-13, N-11, P-10, Q-8, R-6, S-4, Q-3, P-5, O-7, N-5, M-3, O-2, Q-1, P-3, N-4, L-3, M-1, K-2, I-1, J-3, L-4, M-6, K-5, J-7, K-9, J-11, I-13, H-15, I-17, H-19, G-17, E-16, G-15, I-14, J-12, H-13, F-12, H-11, I-9, K-10, L-8, J-9, I-11, G-10, H-8, I-10, G-11, E-12, C-11, E-10, G-9, E-8, F-10, H-9, J-8, K-6, J-4, H-5, I-3, K-4, J-2, H-1, G-3, F-5, E-7, D-9, C-7, B-5, D-6, F-7, D-8, C-6, D-4, F-3, G-5, H-7, I-5, H-3, F-2, E-4, F-6, G-4, E-5, D-7 Started at : G-14 Final Loc'n : D-3 Total moves : 130 Moves used : G-14, F-16, E-18, D-20, B-19, A-17, C-18, B-20, A-18, C-19, A-20, B-18, C-20, A-19, B-17, A-15, C-14, D-16, E-14, C-15, D-17, E-19, G-20, I-19, K-18, J-20, L-19, M-17, O-16, Q-17, R-15, P-14, O-12, Q-13, P-15, O-17, M-18, N-16, O-14, P-12, R-11, Q-9, O-10, N-12, P-11, O-13, N-15, M-13, N-11, P-10, Q-8, R-6, S-4, Q-3, P-5, O-7, N-5, M-7, O-6, Q-5, O-4, N-2, L-1, K-3, J-1, L-2, M-4, N-6, M-8, L-6, K-8, J-6, L-5, K-7, I-8, H-10, G-12, F-14, G-16, E-17, D-15, C-13, D-11, E-13, F-15, G-13, F-11, H-12, F-13, D-12, C-10, A-11, B-13, D-14, C-12, D-10, B-9, A-7, C-8, E-9, G-8, I-7, K-6, J-4, I-6, H-4, J-5, H-6, I-4, H-2, F-1, D-2, B-1, A-3, C-2, E-1, G-2, E-3, D-1, C-3, D-5, B-6, C-4, B-2, A-4, C-5, E-6, F-8, G-6, F-4, D-3 Started at : N-14 Final Loc'n : D-7 Total moves : 131 Moves used : N-14, M-16, N-18, M-20, O-19, Q-20, S-19, T-17, S-15, R-17, T-16, S-14, T-12, S-10, T-8, S-6, T-4, S-2, R-4, Q-6, R-8, Q-10, R-12, Q-14, O-15, Q-16, R-14, P-13, O-11, Q-12, R-10, P-9, Q-7, R-5, P-4, R-3, T-2, R-1, P-2, N-1, O-3, P-1, R-2, Q-4, P-6, O-8, N-10, M-12, L-14, K-16, J-18, I-16, J-14, K-12, L-10, N-9, M-7, O-6, Q-5, O-4, N-2, P-3, N-4, L-3, M-1, K-2, I-1, J-3, L-4, M-6, K-5, J-7, K-9, J-11, I-13, H-15, I-17, H-19, G-17, E-16, G-15, I-14, J-12, H-13, F-12, H-11, I-9, K-10, L-8, J-9, I-11, G-10, H-8, I-10, G-11, E-12, C-11, E-10, G-9, E-8, F-10, H-9, J-8, I-6, H-4, J-5, I-3, K-4, J-2, H-1, G-3, F-5, E-7, D-9, C-7, B-5, D-6, F-7, D-8, C-6, D-4, F-3, G-5, H-7, I-5, H-3, F-2, E-4, F-6, G-4, E-5, D-7 Started at : G-7 Final Loc'n : D-7 Total moves : 131 Moves used : G-7, F-9, E-11, D-13, B-12, A-14, B-16, A-18, C-19, A-20, B-18, C-20, A-19, B-17, A-15, C-14, D-16, E-14, C-15, D-17, E-19, G-20, I-19, K-18, J-20, L-19, M-17, O-16, Q-17, R-15, P-14, O-12, Q-13, P-15, O-17, M-18, N-16, O-14, P-12, R-11, Q-9, O-10, N-12, P-11, O-13, M-14, L-16, J-17, H-18, F-19, H-20, I-18, J-16, H-17, I-15, K-14, L-12, J-13, K-11, M-10, O-9, P-7, O-5, N-3, M-1, K-2, I-1, J-3, L-4, M-6, K-5, J-7, K-9, J-11, I-13, H-15, I-17, H-19, G-17, E-16, G-15, I-14, J-12, H-13, F-12, H-11, I-9, K-10, L-8, J-9, I-11, G-10, H-8, I-10, G-11, E-12, C-11, E-10, G-9, E-8, F-10, H-9, J-8, I-6, H-4, J-5, I-3, K-4, J-2, H-1, G-3, F-5, E-7, D-9, C-7, B-5, D-6, F-7, D-8, C-6, D-4, F-3, G-5, H-7, I-5, H-3, F-2, E-4, F-6, G-4, E-5, D-7 Started at : N-7 Final Loc'n : D-3 Total moves : 130 Moves used : N-7, M-9, L-11, K-13, L-15, K-17, J-19, L-20, N-19, P-18, N-17, P-16, O-18, N-20, P-19, R-18, P-17, Q-15, S-16, T-14, R-13, Q-11, S-12, T-10, R-9, P-8, R-7, T-6, S-8, R-10, P-9, Q-7, R-5, P-4, R-3, T-2, R-1, P-2, N-1, O-3, P-1, R-2, Q-4, P-6, O-8, N-10, M-12, L-14, K-16, J-18, I-16, J-14, K-12, L-10, N-9, O-7, N-5, M-3, O-2, Q-1, P-3, N-4, L-3, M-1, K-2, I-1, J-3, L-4, M-6, K-5, J-7, K-9, J-11, I-13, H-15, I-17, H-19, G-17, E-16, G-15, I-14, J-12, H-13, F-12, H-11, G-13, F-11, H-12, F-13, D-12, C-10, A-11, B-13, D-14, C-12, D-10, B-9, A-7, C-8, E-9, G-8, I-7, K-6, J-4, H-5, I-3, K-4, J-2, H-1, G-3, F-1, D-2, B-1, A-3, C-2, E-1, G-2, E-3, D-1, C-3, D-5, B-6, C-4, B-2, A-4, C-5, E-6, F-8, G-6, F-4, D-3 Started at : A-1 Final Loc'n : D-7 Total moves : 131 Moves used : A-1, B-3, A-5, B-7, A-9, B-11, A-13, B-15, C-17, A-16, B-18, C-20, A-19, B-17, A-15, C-14, D-16, E-14, C-15, D-17, E-19, G-20, I-19, K-18, J-20, L-19, M-17, O-16, Q-17, R-15, P-14, O-12, Q-13, P-15, O-17, M-18, N-16, O-14, P-12, R-11, Q-9, O-10, N-12, P-11, O-13, M-14, L-16, J-17, H-18, F-19, H-20, I-18, J-16, H-17, I-15, K-14, L-12, J-13, K-11, M-10, O-9, P-7, O-5, N-3, M-5, L-7, N-8, L-9, J-10, I-12, H-14, J-15, H-16, G-18, F-20, D-19, F-18, G-16, E-17, D-15, C-13, D-11, E-13, F-15, G-13, F-11, H-12, F-13, D-12, C-10, A-11, B-13, D-14, C-12, D-10, E-12, C-11, E-10, G-9, E-8, F-10, H-9, J-8, I-6, H-4, J-5, H-6, I-4, H-2, F-1, D-2, B-1, A-3, C-2, E-1, G-2, E-3, D-1, C-3, D-5, B-6, C-4, B-2, A-4, C-5, E-6, F-8, G-6, F-4, D-3, E-5, D-7 Started at : T-1 Final Loc'n : D-7 Total moves : 130 Moves used : T-1, S-3, T-5, S-7, T-9, S-11, T-13, S-15, R-17, T-16, S-14, T-12, S-10, T-8, S-6, T-4, S-2, R-4, Q-6, R-8, Q-10, R-12, Q-14, O-15, Q-16, R-14, P-13, O-11, Q-12, R-10, P-9, Q-7, R-5, P-4, R-3, T-2, R-1, P-2, N-1, O-3, P-1, R-2, Q-4, P-6, O-8, N-10, M-12, L-14, K-16, J-18, I-16, J-14, K-12, L-10, N-9, O-7, N-5, M-3, O-2, Q-1, P-3, N-4, L-3, M-1, K-2, I-1, J-3, L-4, M-6, K-5, J-7, K-9, J-11, I-13, H-15, I-17, H-19, G-17, E-16, G-15, I-14, J-12, H-13, F-12, H-11, I-9, K-10, L-8, J-9, I-11, G-10, H-8, I-10, G-11, E-12, C-11, E-10, G-9, E-8, F-10, H-9, J-8, K-6, J-4, H-5, I-3, K-4, J-2, H-1, G-3, F-5, E-7, D-9, C-7, B-5, D-6, F-7, D-8, C-6, D-4, F-3, G-5, H-7, I-5, H-3, F-2, E-4, F-6, G-4, E-5, D-7 -------------------------------------------------------------------------------- -- press any key to exit --
ノート: 最初のツアーは 8 x 8 のチェス盤で、4 人の騎士がランダムに配置されます。 開始場所によっては、すべての 4 ナイト ツアーが完了するわけではない可能性があります。 ただし、このパズルが解ける可能性はあります。 実験して楽しんでください。
ボーナス タスク 4 – ナビゲーション付きレトロ ビジュアル ソルバー
このタスクは、タイトルが示すように非常に単純なものです – 前後に移動し、ボードが解決されるのを見てください。 これは、それだけではありません。 言葉で説明するよりも、写真の方がよくわかります… スクリーンショット[^]
このプロジェクトには数百行のコードがあるため、ここにすべてを掲載するのではなく、以下にダウンロード可能なリンクを用意しました。これを試して、騎士の動きだけでなく、アルゴリズムがどのように機能するかを視覚的に正確に確認できます。ボードのツアーで。 😉
これは、ユーザーが前後に移動できるようにするコア ナビゲーション コードの抜粋です。 ナビゲーションは、方向ごとに 1 行だけで、ツアーの最後にいるかどうかを確認します。
private static void TourGuide(int cols, int rows) { InitWorkArea(cols, rows); knight = new Knight(new Board(cols, rows)); UpdateLocation(knight.Moves.Peek()); bool Active = true; while (Active) { switch (Console.ReadKey(true).Key) { case ConsoleKey.P: isPreview = !isPreview; // show/hide break; case ConsoleKey.PageUp: case ConsoleKey.LeftArrow: case ConsoleKey.UpArrow: // back if (knight.Moves.Count > 1) { ClearLocation(knight.Moves.Peek()); UpdateLocation(knight.MovePrevious()); } break; case ConsoleKey.Spacebar: case ConsoleKey.RightArrow: case ConsoleKey.PageDown: case ConsoleKey.DownArrow: // forward if (knight.CanMoveNext) UpdateLocation(knight.MoveNext()); break; case ConsoleKey.Escape: // exit Active = false; break; } } }
出力:
Weekly Challenge: Knight's Tour =============================== Bonus Challenge: Visually let a user move through the moves of a tour Hot Keys: Forward: Down arrow / PgDn / Right arrow / SpaceBar Backward: Up arrow / PgUp / Left arrow Preview: P - toggles preview decisions before move Exit: ESC to quit -- press any key to begin --
ダウンロード
ダウンロード可能な解決策へのリンクは次のとおりです。 C# バージョン[^]
ダウンロードには、Core PCL + 上記の各ツアーのすべてのサンプル アプリが含まれています。 おまけ: このチャレンジの元のプロトタイプを含めました。 😉
詳細な記事は近日公開予定です (時間の許す限り)…
楽しみ!
解決策 3
それは楽しかった! 私のコードと答えは非常に大きくなりました。代わりに記事を次に示します。
四角いチェス盤での騎士のツアー: コーディングの課題[^]
おまけとして、騎士の道の絵やアニメーションGIFを描くこともできます:)
解決策 2
最短パスアルゴリズムに基づく私の解決策は次のとおりです。
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace KnightChess { class KnightMove { public bool ChessToIndex(string sMove, ref int Row, ref int Col) { if ((sMove[0] >= 'A' && sMove[0] <= 'H') && (sMove[1] >= '1' && sMove[1] <= '8')) { Col = System.Convert.ToInt32(sMove[0]) - 0x41; Row = System.Convert.ToInt32(sMove[1].ToString()) - 1; return true; } return false; } public bool IndexToChess(ref string sMove, int Row, int Col) { sMove += Convert.ToChar(Col + 0x41); sMove += Convert.ToString(Row + 1); return true; } public KnightMove(int Row, int Col) { this.Row = Row; this.Col = Col; } public KnightMove(string sMove) { int Row = -1, Col = -1; if (this.ChessToIndex(sMove, ref Row, ref Col) != false) this.Row = Row; this.Col = Col; } public int Row { get { return m_Row; } set { m_Row = value; } } public int Col { get { return m_Col; } set { m_Col = value; } } private int m_Row = -1; private int m_Col = -1; } class Corner { public Corner(KnightMove mv1, KnightMove mv2) { this.Move1 = mv1; this.m_Move2 = mv2; } public KnightMove Move1 { get { return m_Move1; } set { m_Move1 = value; } } public KnightMove Move2 { get { return m_Move2; } set { m_Move2 = value; } } private KnightMove m_Move1; private KnightMove m_Move2; } class KnightMoves : ICloneable { public KnightMoves() { } public KnightMoves(List<KnightMove> Path, int Length) { this.Path = Path; this.Length = Length; } public List<KnightMove> Path { get { return m_Path; } set { m_Path = value; } } public int Length { get { return m_Length; } set { m_Length = value; } } private int m_Length = -1; private List<KnightMove> m_Path = null; public object Clone() { KnightMoves Target_Moves = new KnightMoves(); Target_Moves.m_Length = Length; Target_Moves.Path = new List<KnightMove>(); foreach (KnightMove km in this.Path) Target_Moves.Path.Add(km); return Target_Moves; } } class KnightPaths : IEnumerable<KnightMoves> { private List<KnightMoves> m_PathList = null; public KnightPaths() { if (m_PathList == null) m_PathList = new List<KnightMoves>(); } public KnightPaths(KnightPaths Knight_Path) { m_PathList = new List<KnightMoves>(); foreach (KnightMoves km in Knight_Path) m_PathList.Add(km); } public void Add(KnightMoves Move) { m_PathList.Add(Move); } public KnightMoves this[int iIndex] { get { return m_PathList[iIndex]; } set { m_PathList[iIndex] = value; } } public int Count() { return m_PathList.Count(); } public void Clear() { m_PathList.Clear(); } public IEnumerator GetEnumerator() { return m_PathList.GetEnumerator(); } IEnumerator<KnightMoves> IEnumerable<KnightMoves>.GetEnumerator() { return (IEnumerator<KnightMoves>)this.GetEnumerator(); } } class Program { static bool IsValidMove(int value1, int value2, int PathID) { if ((value1 > value2) && (PathID == 0 || PathID == 1) || (value1 < value2) && (PathID == 2 || PathID == 3)) return true; return false; } static bool IsValidPath(int Row1, int Col1, int Row2, int Col2, int PathID) { if (((((Row1 == 0 && Col1 == 5) && (Row2 == 1 && Col2 == 7)) || ((Row1 == 0 && Col1 == 6) && (Row2 == 2 && Col2 == 7))) && (PathID == 0)) || ((((Row1 == 5 && Col1 == 7) && (Row2 == 7 && Col2 == 6)) || ((Row1 == 6 && Col1 == 7) && (Row2 == 7 && Col2 == 5))) && (PathID == 1)) || ((((Row1 == 7 && Col1 == 2) && (Row2 == 6 && Col2 == 0)) || ((Row1 == 7 && Col1 == 1) && (Row2 == 5 && Col2 == 0))) && (PathID == 2)) || ((((Row1 == 2 && Col1 == 0) && (Row2 == 0 && Col2 == 1)) || ((Row1 == 1 && Col1 == 0) && (Row2 == 0 && Col2 == 2))) && (PathID == 3))) return true; return false; } static void Main(string[] args) { string _StartMove = ""; Console.Write("Start At: "); _StartMove = Console.ReadLine(); Console.WriteLine(); KnightPaths Knight_Paths = new KnightPaths(); KnightMoves Knight_Moves = new KnightMoves(); Knight_Moves.Path = new List<KnightMove>(); Knight_Moves.Length = 1; Knight_Moves.Path.Add(new KnightChess.KnightMove(_StartMove)); Knight_Paths.Add(Knight_Moves); KnightPaths Knight_Paths2 = new KnightPaths(); List<Corner> Corners = new List<Corner>(); Corners.Add(new Corner(new KnightMove(0, 5), new KnightMove(1, 7))); Corners.Add(new Corner(new KnightMove(0, 6), new KnightMove(2, 7))); Corners.Add(new Corner(new KnightMove(5, 7), new KnightMove(7, 6))); Corners.Add(new Corner(new KnightMove(6, 7), new KnightMove(7, 5))); Corners.Add(new Corner(new KnightMove(7, 2), new KnightMove(6, 0))); Corners.Add(new Corner(new KnightMove(7, 1), new KnightMove(5, 0))); Corners.Add(new Corner(new KnightMove(2, 0), new KnightMove(0, 1))); Corners.Add(new Corner(new KnightMove(1, 0), new KnightMove(0, 2))); var watch = new System.Diagnostics.Stopwatch(); watch.Start(); for (int PathID = 0; PathID < 4; PathID++) { for (int Route = 0; Route < Knight_Paths.Count(); Route++) { KnightMoves CurrPath = Knight_Paths[Route]; if (Knight_Paths[Route].Path.Count() > 1) { if (IsValidPath(CurrPath.Path[Knight_Paths[Route].Path.Count() - 2].Row, CurrPath.Path[Knight_Paths[Route].Path.Count() - 2].Col, CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row, CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col, PathID)) { Knight_Paths2.Add(new KnightMoves(CurrPath.Path, CurrPath.Path.Count())); } } if (((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 1) < 8) && ((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 2) < 8)) { bool Exists = false; for (int Index = 0; Index < CurrPath.Path.Count() && !Exists; Index++) if (CurrPath.Path[Index].Row == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 1 && CurrPath.Path[Index].Col == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 2) Exists = true; int value1 = 0, value2 = 0; if (PathID == 0 || PathID == 2) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 2; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col; } if (PathID == 1 || PathID == 3) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 1; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row; } if (Exists == false && IsValidMove(value1, value2, PathID)) { KnightMoves NewPath = (KnightMoves)CurrPath.Clone(); NewPath.Length = Knight_Paths[Route].Length + 1; NewPath.Path.Add(new KnightMove(CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 1, CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 2)); Knight_Paths.Add(NewPath); } } if (((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 1) >= 0) && ((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 2) < 8)) { bool Exists = false; for (int Index = 0; Index < CurrPath.Path.Count() && !Exists; Index++) if (CurrPath.Path[Index].Row == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 1 && CurrPath.Path[Index].Col == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 2) Exists = true; int value1 = 0, value2 = 0; if (PathID == 0 || PathID == 2) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 2; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col; } if (PathID == 1 || PathID == 3) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 1; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row; } if (Exists == false && IsValidMove(value1, value2, PathID)) { KnightMoves NewPath = (KnightMoves)CurrPath.Clone(); NewPath.Length = Knight_Paths[Route].Length + 1; NewPath.Path.Add(new KnightMove(CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 1, CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 2)); Knight_Paths.Add(NewPath); } } if (((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 1) < 8) && ((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 2) >= 0)) { bool Exists = false; for (int Index = 0; Index < CurrPath.Path.Count() && !Exists; Index++) if (CurrPath.Path[Index].Row == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 1 && CurrPath.Path[Index].Col == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 2) Exists = true; int value1 = 0, value2 = 0; if (PathID == 0 || PathID == 2) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 2; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col; } if (PathID == 1 || PathID == 3) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 1; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row; } if (Exists == false && IsValidMove(value1, value2, PathID)) { KnightMoves NewPath = (KnightMoves)CurrPath.Clone(); NewPath.Length = Knight_Paths[Route].Length + 1; NewPath.Path.Add(new KnightMove(CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 1, CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 2)); Knight_Paths.Add(NewPath); } } if (((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 1) >= 0) && ((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 2) >= 0)) { bool Exists = false; for (int Index = 0; Index < CurrPath.Path.Count() && !Exists; Index++) if (CurrPath.Path[Index].Row == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 1 && CurrPath.Path[Index].Col == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 2) Exists = true; int value1 = 0, value2 = 0; if (PathID == 0 || PathID == 2) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 2; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col; } if (PathID == 1 || PathID == 3) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 1; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row; } if (Exists == false && IsValidMove(value1, value2, PathID)) { KnightMoves NewPath = (KnightMoves)CurrPath.Clone(); NewPath.Length = Knight_Paths[Route].Length + 1; NewPath.Path.Add(new KnightMove(CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 1, CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 2)); Knight_Paths.Add(NewPath); } } if (((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 2) >= 0) && ((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 1) < 8)) { bool Exists = false; for (int Index = 0; Index < CurrPath.Path.Count() && !Exists; Index++) if (CurrPath.Path[Index].Row == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 2 && CurrPath.Path[Index].Col == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 1) Exists = true; int value1 = 0, value2 = 0; if (PathID == 0 || PathID == 2) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 1; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col; } if (PathID == 1 || PathID == 3) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 2; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row; } if (Exists == false && IsValidMove(value1, value2, PathID)) { KnightMoves NewPath = (KnightMoves)CurrPath.Clone(); NewPath.Length = Knight_Paths[Route].Length + 1; NewPath.Path.Add(new KnightMove(CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 2, CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 1)); Knight_Paths.Add(NewPath); } } if (((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 2) >= 0) && ((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 1) >= 0)) { bool Exists = false; for (int Index = 0; Index < CurrPath.Path.Count() && !Exists; Index++) if (CurrPath.Path[Index].Row == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 2 && CurrPath.Path[Index].Col == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 1) Exists = true; int value1 = 0, value2 = 0; if (PathID == 0 || PathID == 2) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 2; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col; } if (PathID == 1 || PathID == 3) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 2; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row; } if (Exists == false && IsValidMove(value1, value2, PathID)) { KnightMoves NewPath = (KnightMoves)CurrPath.Clone(); NewPath.Length = Knight_Paths[Route].Length + 1; NewPath.Path.Add(new KnightMove(CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row - 2, CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 1)); Knight_Paths.Add(NewPath); } } if (((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 2) < 8) && ((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 1) >= 0)) { bool Exists = false; for (int Index = 0; Index < CurrPath.Path.Count() && !Exists; Index++) if (CurrPath.Path[Index].Row == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 2 && CurrPath.Path[Index].Col == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 1) Exists = true; int value1 = 0, value2 = 0; if (PathID == 0 || PathID == 2) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 1; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col; } if (PathID == 1 || PathID == 3) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 2; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row; } if (Exists == false && IsValidMove(value1, value2, PathID)) { KnightMoves NewPath = (KnightMoves)CurrPath.Clone(); NewPath.Length = Knight_Paths[Route].Length + 1; NewPath.Path.Add(new KnightMove(CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 2, CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col - 1)); Knight_Paths.Add(NewPath); } } if (((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 2) < 8) && ((CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 1) < 8)) { bool Exists = false; for (int Index = 0; Index < CurrPath.Path.Count() && !Exists; Index++) if (CurrPath.Path[Index].Row == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 2 && CurrPath.Path[Index].Col == CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 1) Exists = true; int value1 = 0, value2 = 0; if (PathID == 0 || PathID == 2) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 1; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col; } if (PathID == 1 || PathID == 3) { value1 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 2; value2 = CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row; } if (Exists == false && IsValidMove(value1, value2, PathID)) { KnightMoves NewPath = (KnightMoves)CurrPath.Clone(); NewPath.Length = Knight_Paths[Route].Length + 1; NewPath.Path.Add(new KnightMove(CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Row + 2, CurrPath.Path[Knight_Paths[Route].Path.Count() - 1].Col + 1)); Knight_Paths.Add(NewPath); } } } if (Knight_Paths2.Count() > 0) { Knight_Paths = new KnightPaths(Knight_Paths2); Knight_Paths2.Clear(); } } var elapsed = watch.Elapsed; watch.Stop(); int nCount = 0; for (int Index = 0; Index < Knight_Paths.Count(); Index++) { int Count = 0; KnightMoves CurrPath = Knight_Paths[Index]; for (int Move = 0; Move < CurrPath.Path.Count() - 1; Move++) { for (int nIndex = 0; nIndex < Corners.Count(); nIndex++) Count = (Corners[nIndex].Move1.Row == CurrPath.Path[Move].Row && Corners[nIndex].Move1.Col == CurrPath.Path[Move].Col && Corners[nIndex].Move2.Row == CurrPath.Path[Move + 1].Row && Corners[nIndex].Move2.Col == CurrPath.Path[Move + 1].Col) ? Count + 1 : Count; } if (Count == 4) { Console.Write("{0}. ", nCount); for (int Move = 0; Move < CurrPath.Path.Count(); Move++) { string sMove = ""; CurrPath.Path[Move].IndexToChess(ref sMove, CurrPath.Path[Move].Row, CurrPath.Path[Move].Col); Console.Write("({0};{1})", sMove[0], sMove[1]); } Console.WriteLine(" Moves = {0}", CurrPath.Path.Count()); nCount++; } } Console.WriteLine("Total = {0}", nCount); Console.WriteLine("Execution Time: {0:N6} msecs", elapsed.TotalMilliseconds); Console.ReadKey(); } } }
出力: (次のコードは、すべてのボードの正方形に触れるチェス ボードを横切るさまざまなパスを提供します)
Start At: A1 0. (A;1)(C;2)(E;3)(F;1)(H;2)(G;4)(H;6)(G;8)(E;7)(C;8)(A;7)(B;5)(A;3)(B;1) Moves = 14 1. (A;1)(B;3)(D;2)(F;1)(H;2)(G;4)(H;6)(G;8)(E;7)(C;8)(A;7)(B;5)(A;3)(B;1) Moves = 14 2. (A;1)(C;2)(E;1)(F;3)(G;1)(H;3)(G;5)(H;7)(F;8)(D;7)(B;8)(A;6)(B;4)(A;2)(C;1) Moves = 15 3. (A;1)(C;2)(D;4)(F;3)(G;1)(H;3)(G;5)(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F;3)(G;1)(H;3)(F;4)(D;5)(F;6)(H;7)(F;8)(E;6)(D;4)(C;6)(B;8)(A;6)(C;5)(E;4)(C;3)(A;2)(C;1) Moves = 21 309. (A;1)(B;3)(D;2)(F;3)(G;1)(H;3)(F;4)(D;5)(F;6)(H;7)(F;8)(E;6)(D;4)(C;6)(B;8)(A;6)(C;5)(A;4)(C;3)(A;2)(C;1) Moves = 21 310. (A;1)(B;3)(D;2)(F;3)(G;1)(H;3)(F;4)(D;5)(F;6)(H;7)(F;8)(E;6)(D;8)(C;6)(B;8)(A;6)(C;5)(E;4)(C;3)(A;2)(C;1) Moves = 21 311. (A;1)(B;3)(D;2)(F;3)(G;1)(H;3)(F;4)(D;5)(F;6)(H;7)(F;8)(E;6)(D;8)(C;6)(B;8)(A;6)(C;5)(A;4)(C;3)(A;2)(C;1) Moves = 21 Total = 312 Execution Time: 99,043500 msecs
解決策 5
うーん、私の解決策は完全ではありません。 この問題は私にとってあまり興味深いものではありませんが、理論的には、徹底的なバックトラッキングの実装を持っています。 全て ツアー。 6×6 のボードを指定すると、約 1 時間で正方形 (0,0) からのすべてのツアーであることがわかりました。 しかし、チェス盤 (8×8) が与えられた場合、それは 2 日間実行されており、まだ結果は報告されていません。
現時点で言えることは、ボードの 2 次元表現ではなく、ノードのグラフ (ネットワーク) を使用するということだけです。 再帰もありません。
探すことに興味がない a ツアーや どれでも ツアー、私はクローズド ツアーを探しています。ネットから転記するのが面倒です。 自分で見つけたい。
からのクローズドナイツツアー どれでも スクエアはクローズドナイツツアーです 毎日 四角。
とにかく、チャレンジの解決策として、私の計画は次のとおりです。
与えられた(まあ、そうではない 与えられた、上記のように)チェス盤のクローズドナイトツアー…
ツアーをハードコードし、毎回使用するだけです。
開始場所として指定された広場が何であれ、そこからハードコードされたツアーを開始し、ツアーを行います。
終わり
(私はあなたに最新情報を提供しようとします。)
そうは言っても、グラフトラバースの実装があるので、グラフのトラバースに関するより一般的な質問に対処するためにコードを一般化することを検討しています。 実は、80年代中盤の、完全に解けなかったパズルがあって、ときどき(白鯨のように)思い浮かびますが、このテクニックを応用できるのではないかと思います。
更新: 1 つの仮想 CPU を 100% 使用して丸 1 週間実行した後、私のコードはツアーをまったく検出しませんでした。 それを殺して問題を見つける時が来ました…
[ad_2]
コメント