6 frog game solution




















How far does the dot travel? Main menu Search. Hide Menu. Related Collections Other videos. You may also like All in the Mind Imagine you are suspending a cube from one vertex and allowing it to hang freely. Instant Insanity Given the nets of 4 cubes with the faces coloured in 4 colours, build a tower so that on each vertical wall no colour is repeated, that is all 4 colours appear. Is There a Theorem? We received lots of solutions for this, with lots of good reasoning.

Well done! Mind Tools: Applications and Solutions. Lee Humphries. Last week my friend Jack emailed me a puzzle. Chinese second-graders are said to solve it in two minutes. I mustered my courage and gave it a try. You need not work the puzzle to understand this article.

The puzzle involves seven rocks and six frogs. See Fig. The seven rocks are laid out in a horizontal line and numbered left to right. The six frogs are evenly divided into a green trio and a brown trio.

The green frogs sit on Rocks 1, 2, and 3, facing right. The brown frogs sit on Rocks 5, 6, and 7, facing left. Rock 4 is vacant. The challenge is to transpose the trios, jumping the green frogs to Rocks 5, 6, and 7 and the brown frogs to Rocks 1, 2, and 3. Their movement is restricted. A frog can only jump forward, either hopping to a vacant rock one place ahead or leaping over its neighbor frog to a vacant rock two places ahead.

Seven rocks and six frogs. Let me report that I would be a dismal second grader in the People's Republic of China and probably in most other countries as well. Prodding six frogs to opposing destinations along a one-lane road of seven rocks took me far longer than two minutes. To rediscover it, I had to start over. Could I have done better? Remembrance of Things Past. Having no idea what pattern underlay the solution, I began with my only option—spontaneous action.

I jumped my frogs by impulse, observed the result, and tried to get a feel for the situation. For meaningful problems, I keep a running log of what I'm doing and thinking—a substitute for my unreliable memory.

That was a mistake: Lacking a catalog of failed strategies as a reference, I wasted time retracing previously unsuccessful paths.

Eventually, certain jump sequences, repeated ad nauseam, stuck in my brain. Recalling them, I eliminated the wrong ones and conjoined the right ones. Before my memory faded again, I recorded the entire sequence of fifteen correct jumps—not in a list, but in a diagram.

The correct jump sequence. A diagram of the jumps has a coherence that a list of the jumps lacks. Viewable at a glance, it presents the complete data set all-at-once , integrating the many jumps into a single visual gestalt.

With the total configuration in plain sight, there is nothing to recall; the demand on short-term memory is negligible. A list, on the other hand, must be processed incrementally via many disconnected eye shifts. So, a list is a memory-intensive presentation. I only knew the jump sequence itself and its mirror image, which also solves the puzzle.

I wondered if the sequence followed some pattern. Should a pattern exist, anyone who knew it—say, a Chinese second-grader—could implement it and quickly solve the puzzle. Knowing this pattern, one would have a deeper understanding of the solution. And what if that pattern derived from some general organizing principle that underlies the solutions to many puzzles; puzzles different in their particulars but alike in their form? Knowing the principle, one would have a very deep understanding of the solution; one could easily solve sundry puzzles and seem a miracle worker to naive onlookers.

I examined the solution for patterns, looking for one that governed the jump sequence. There were several of interest. Then I've added a TreeView. In TreeView , you can see how the computer makes his moves. In the end, I've added a simulation of the game.

With the program, you can also play the game. The control contains a TableLayoutPanel with labels for the position of the frog and seven buttons. These buttons share a lot of properties, so I put them in a table of buttons. Each button is initialized with the letter L or R and has registered an event handler called LegalMove. Method MoveB moves the button to the left or to the right. To validate if the move is legal, I've used a StringBuilder variable called situation.

After each move, the control changes the variable situation. In the program, we also need to fire an event when a user makes a move. So I've added an event called NextM.

The parameter of the event is the position of the button which was moved. The event is fired on every click on the button. In the main form, I've put an object of type ATable and then I've programmed the event handler:. We could program a new user control with pictures of frogs instead of buttons. The program should work with small changes. My program doesn't search all the solutions for the game.

When it finds the first sequence of moves, which leads to the goal, it ends. You can see the unexploited moves in the TreeView. They have a white background and black text color. With the same algorithm, we could solve other problems like eight queens on a chess board or search the way through a labyrinth.



0コメント

  • 1000 / 1000