### Random Post

### Recent Posts

### Recent Comments

Hugh Casement on Enigma 1070: Time to work | |

Jim Randell on Enigma 1070: Time to work | |

Jim Randell on Enigma 1070: Time to work | |

geoffrounce on Enigma 440: Three X | |

Jim Randell on Enigma 1588: As easy as 1… |

### Archives

### Categories

- article (11)
- enigma (1,157)
- misc (2)
- project euler (2)
- puzzle (39)
- site news (44)
- tantalizer (42)
- teaser (3)

### Site Stats

- 177,568 hits

Advertisements

Basically the same puzzle as

Enigma 1748. So it is unsurprising that the same technique can be used to solve it. This Python program – the same as my solution forEnigma 1748, but with some parameters altered – runs in 38ms.Solution:The numbers in the third column are: 3, 1, 2, 1.Here’s the completed grid:

And here’s my modified version of 1748:

Hi,

Execution time of your code on my machine is almost 7.5 seconds

Indeed. Here is a faster version:

I used the same approach where I did use in Enigma 1748,

I start to walk from the first cell,

1376513633.509371

Cells [-1, 2, 5, 6, 1, 9, 7, 10, 0, 4, 8]

1376513633.540597

Timing in my machine is like above,

Cells [-1, 2, 6, 5, 1, 9, 7, 10, 0, 4, 8] must be replaced with the previous one, the first one in invalid and “path[0][0]= True” must be replaced with path[2][0]=True at the top of the code, and in the valid function [0][0] cell is not checked, instead, [2][0] cell will be checked, as the first cell has been given already, no need to check that.

Ahmet, why are you still using such an error prone method for timing your code when you know that this has caused you problems in the past?

If for some reason you don’t want to use a better method, you could at least put ‘start=time.time()’ at the beginning and ‘print(time.time() – start)’ at the end to avoid the need to do the manual subtraction.

Hi Brian,

You are right 🙂

Cells [-1, 2, 6, 5, 1, 9, 7, 10, 0, 4, 8]

0.015599966049194336

I did that what you said, I guess this means 15 ms almost 16 ms, and my machine’s cpu 2.60 Hz and 6GB Ram.

You would like to test the timing on your processors, if you wish.

You are lucky to find the right path Ahmet as there is another bug in your code. When you reach the end of your path you need to check that the last move gets you back to the first cell but you don’t check this since you only use 10 of the eleven cards. As it happens the unused card on your path is (0,-1) so it does get back to (0, 0), which was lucky 🙂

Here is a a commented and (I hope) corrected version of your code that uses Jim’s new timer in his latest enigma version

Do not despair – you are not the only one with bugs this week!

I am sad to say that in doing this one I found a bug in my two solutions to enigma 1748 😦 I don’t like leaving buggy code around so if you could correct my two programs for that enigma, Jim, I would be most grateful – the return on line 45 in the first and line 48 in the second should be indented by two more spaces (one more level).

Here is this one:

As I have forgotton to uncomment two lines in my previous code, I have deleted those two lines, and I have changed so, yeah, my code had a small bug, but the algorithm is the same as the previous one, sorry for that. This is the last one and the timing is the same as in the previous one, I am sorry to have uncommented those two lines.