Hanoi Puzzles Flip Match ~REPACK~
Let us define the game of Tri-Tac-Toe as a game for 3 players, X, Y, and Z.The object is to get 3 in a row. However, they play on a 3D board that is 3 by 3 by 3.They take turns in a round-robin protocol.Give an expression for the number of distinct states that can be achieved after 6 movesand evaluate it to a number.Such a state should have 2 X's, 2 Y's, and 2 Z's on the board, filling six of the27 available voxels.You may assume that 2 states are distinct even if one can be matched to another by somerotation of the cube. Purple Paperweights (15 points)The Purple Paperweight Company sells a line of paperweights that come in the followingsizes: 2 cm by 2 cm, 4 cm by 4 cm, 6 cm by 6 cm, etc. Thus a typical paperweight is ofsize n by n, measured in centimeters. Its design is an array of purple and gold squareseach of size 1 centimeter on a size. The underside is just black felt, with no pattern.The company promotes the paperweights by explaining how great a variety of patterns theycome in, because the arrangements of purple vs gold in the grid positions are more orless random. Give a formula for the number of distinct paperweights having size n by n.This formula should consider the possibility of various symmetries and double-countingsituations, and it should not do any double counting. Hints: (1) patterns with 4-way (90-degree) rotational symmetry are not double counted;patterns with 2-way (180-degree) rotational symmetry, but not 4-way symmetry, are double counted; other patterns are quadruple counted.(2) try working out all the patterns for n=2 and use that as a check on your formulas.
Bitty Paperweights (Optional, for 5 points of extra credit)The Bitty Paperweight Company, trying to compete with Pretty Paperweight Company,uses a different pair of colors for their designs, and their products have designson both the top and the bottom.Like their competitor, they sell a line of paperweights that come in the followingsizes: 2 cm by 2 cm, 4 cm by 4 cm, 6 cm by 6 cm, etc. Thus a typical paperweight is ofsize n by n, measured in centimeters. However, its design is an array of gold and silver squares,each of size 1 centimeter on a size. You can turn one of these over and another gold andsilver grid pattern is revealed, not necessarily the same as the one on the flip side.This company, like the other, promotes the paperweights by explaining how great a variety of patterns theycome in. By having patterns on both top and bottom, there are vastly more distinct paperweightsof any particular size.Give a formula for the number of distinct Bitty-manufactured paperweights having size n by n.This formula should consider the possibility of various symmetries and double-countingsituations, and it should not do any double counting. This is explained in the following.The company makes the paperweights in small batches by randomly designing the top and bottom patterns,creating a "mold" that somehow controls whether each square looks gold or silver in color,and then a bunch of copies are made. If two of these are compared right at the end of theassembly line, they look identical. However, as soon as you shake them around a little,they usually look different, due to rotations by 90 or 180 degrees and the possibility thatone got flipped over and the other didn't. But they are not really different and all therepresentatives from a particular manufacturing run should be counted as no more than 1.However, it is possible that two separate random designs could be equivalent, eitherbecause every detail turned out, by coincidence, to be the same, or because onedesign turned out to be a rotated version or flipped version, or rotated and flippedversion of the other.Note also that two paperweights next to each other that look alike (possibly after a 90 degreerotation by one or both), could still be the same or different, depending on what theirpatterns are on the other side. Even if one side of paperweight A matches a side ofpaperweight B and the other side of A matches the other side of B, the two might notbe considered equivalent if after aligning them, you flip each over the same way andthe flip sides don't match without one being rotated again. However, they WOULD beconsidered equivalent if each can be positioned in some way so that the top sides matchand the bottom sides match, with no further rotation.
Part II. 75 Points.The Python code for a program that performs iterative depth-first search to solvea Towers of Hanoi puzzle is given in the two filesItrDFS.pyandTowersOfHanoi.pyImplement the followingBreadth-First Search (10 points).Using ItrDFS.py as a guide, create a program ItrBreadthFS.py that usesbreadth-first search rather than depth-first search to solve the Towers of Hanoi puzzle.Show the states on a shortest solution path for the Towers of Hanoi puzzle with 4 disks.
Basic 8 Puzzle Formulation (20 points).Create a file BasicEightPuzzle.pythat provides the same kinds of problem elements that the TowersOfHanoi.py file provides:metadata, initial state, operators, and a few utility functions such as HASHCODE andDEEP_EQUALS.Show that it can solve some easy instances of the puzzle, such as instances requiring onlythree or four moves. Here are four instances to try:# puzzle0:CREATE_INITIAL_STATE = lambda x: [0, 1, 2, 3, 4, 5, 6, 7, 8]# puzzle1a:CREATE_INITIAL_STATE = lambda x: [1, 0, 2, 3, 4, 5, 6, 7, 8]# puzzle2a:CREATE_INITIAL_STATE = lambda x: [3, 1, 2, 4, 0, 5, 6, 7, 8]# puzzle4a:CREATE_INITIAL_STATE = lambda x: [1, 4, 2, 3, 7, 0, 6, 8, 5]
A-Star Implementation (15 points).Implement a search program AStar.py that, like ItrDFS.py, will accept as a command-lineargument the name of a problem template such as EightPuzzle but also accepts (a) the nameof a heuristic evaluation function to use in the AStar searchand (b) the name of a puzzle instance file that contains a particular initial state.For examplepython3 AStar.py EightPuzzleWithHeuristics h_euclidean puzzle2a.pyThe contents of puzzle2a.py would have this form:CREATE_INITIAL_STATE = lambda x: [3, 1, 2, 4, 0, 5, 6, 7, 8]
Implementing and Comparing Heuristics (30 points).Implement three heuristic evaluation functions for the 8 Puzzle: h_euclidean(s),h_hamming(s), and h_manhattan(s).The first should compute the euclidean distance for each tile from its location instate s to its location in the goal state. Then it should add up these distancesand return that sum. The second function should determine the number of tiles that,in state s, are not where they should end up in the goal state.The third function should find, for each tile, how rows it is away from its goal state rowplus how many columns it is away from its goal state column, and it should add thosedistances for each of the tiles. When computing these distances, include the empty squareas if it were a virtual tile.Include these in a new version of your 8 puzzle formulation: EightPuzzleWithHeuristics.py.Define the actual functions at the end of the COMMON-CODE section, but create new line of codeat the end of the file as follows.HEURISTICS = 'h_euclidean': h_euclidean, 'h_hamming':h_hamming, 'h_manhattan':h_manhattanCompare the performance of these heuristics on each of the example puzzles (given below).For each puzzle-heuristic pair,report whether the puzzle was successfully solved and alsoreport the count of states processed (taken off of OPEN and put on CLOSED).Put this information into a table.If it takes more than 30 seconds to solve a particular problem with a particularheuristic then note that; you may abort such runs.
Example puzzles:puzzle10a.py:CREATE_INITIAL_STATE = lambda: [4, 5, 0, 1, 2, 3, 6, 7, 8]puzzle12a.py:CREATE_INITIAL_STATE = lambda: [3, 1, 2, 6, 8, 7, 5, 4, 0]puzzle14a.py:CREATE_INITIAL_STATE = lambda: [4, 5, 0, 1, 2, 8, 3, 7, 6]puzzle16a.py:CREATE_INITIAL_STATE = lambda: [0, 8, 2, 1, 7, 4, 3, 6, 5]Please put your results for these comparisons in the form of a table in a file results.txt.What to Turn InTurn in a file A3-PartI.txt and all the files that you create for Part II.Your PartI.txt file should contain your name and the answers to the questions in Part I.Your Python files for Part II should begin with a multiline string that gives, on the first line,your name, and on the next lines the status of the program represented by the file.
Hanoi Puzzles Flip Match
More great Online Games at SpringfrogUse your creative skills to solve a wide selection of fun online jigsaw puzzles. Play the game of Reversi online against the computer.Test your logic with online Sudoku puzzles and enjoy a new challenge each time you play.Strategically position runes of matching shape and color in Runic. Blast the deadly space rocks hurtling around your ship in the arcade classic Asteroids game.Unscramble three of Springfrog's animal friends in the picture puzzle game of Flip Switch.Test your strategy over 45 formidable levels in the online solitaire game of Siji.Experience the thrills of an online baseball game with a difference in Japanese Catball, with a kitty at the bat. Play checkers online against the computer.Connect Five in the ancient strategy game of Gomoku. Match the numbers on neigboring tiles the 4 sided dominoes game of Vexed.Help a beautiful black horse get himself back in one piece in the sliding tile game of Slide Puzzle. Tiles are coming from top and bottom. Remove matching groups before they meet in the Collapsing Tile Game of Under Pressure. Solve a puzzle which according to legend has been played for many years by Hindu priests in the Multiple level Towers of Hanoi game. Win money just by visiting Springfrog 041b061a72