Solving peg solitaire9/9/2023 ![]() board by 16 right/left -> moving all pegs up/down. Find the possible jumps through bit-shift operations. To try the hole-version: Swap Commented and Uncommented parts Int solutions = 0 // Number of solutions found so farĬonst ui64 bitboard = 0x001c1c7f7f7f1c1c // 1ULL Hole Ui64 moves = 0 // Number of moves made so far Typedef std::vector > vecjumps // first=from, second=to To keep it compact I have removed the lesser important parts (printing the board, generating the initial bitboard. You can try the algorithm with following C++ program. Question: Why is there such a giant (not solvable / immediately solved) difference on how to search the board for jumps? Why is it better to check the pegs instead of checking the holes for possible jumps? Analyzing pegs: Runtime 10 seconds, 2940 solutions.Analyzing holes: Runtime 23 hours no solution.Trying the jumps in the order they are found. Right (each peg is checked if there are possible jumps). Jumps), the paper-algorithm searches the board for pegs from top left to bottom Left to bottom right (each hole is checked if there are possible While my algorithm searches the board for holes from top The main difference between the algorithms is the way they find I tried the c-program from the paperĪnd the first solution was found immediately after the program started. "Depth-first search solves peg solitaire". Even after 23 hours, theĪlgorithm didn't find any solution. Should be possible to solve the game since "modern computers can easily examineĪll game positions in a reasonable time". I am trying to solve Peg Solitaire with a depth-first search algorithm – it
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |