Tuesday, May 7, 2013

Cotswold Way - Walk 4

Walk 4: Winchcombe - Cleeve Hill



7th May 2013: Teasel and I set off from Winchcombe at 11am, on what had originally been forecast to be a cold, rainy day, but in fact turned out to be the hottest day of the year so far. The bad weather having been postponed until tomorrow.

This part of the Cotswold Way has undergone considerable re-routing, so watch out if you have old maps or guides. The route now cuts across the fields soon after crossing the bridge on Vinyard Street, and continues along a leafy pathway to emerge at Corndean Lane, where most of the walking on the public road is avoided by a path that winds through a thin strip of woodland alongside the road. Although the route then picks up a private tarmac drive for Corndean Hall, but after the cricket pitch cuts uphill through a large meadow with views back to Winchcombe and Sudeley Castle, emerging back on the road by a wood.

Crossing the road and climbing through the wood and skirting around the edge of a field brings you out onto a 300m plateau, and emerging from a shady path along the top edge of a wood brings you out at the rather impressive Stone Age Long Barrow of Belas Knap.

From here the path follows the plateau through fields to emerge on a track heading to Wontley Farm. Formerly the path passed Wontley Farm approaching close to the masts by the highest point of Cleeve Hill before heading North. Now, it takes a sharp right across fields, passing within 3/4 miles of the summit of Cleeve Hill, and then heads into Breakheart Plantation and descends steeply before emerging from the wood - apparently heading back towards Winchcombe. But it turns sharply Westwards and heads down through a pleasant wood to cross a small stream (where Teasel did a bit more paddling).

The route now passes through fields and a farm heading towards Postlip Hall, although the Hall itself becomes hidden from view and doesn't re-emerge as you follow tracks around it. Heading North and finally emerging on to Cleeve Common, the track brings you out on the golf course, and we stopped at 1:30pm by the club house.

Walk Distance: 5.8 miles (9.3 km), 2h33m.
Cumulative Distance: 25.1 miles (40.4 km), 9h50m.

Monday, May 6, 2013

Cotswold Way - Walk 3

Walk 3: Stanway - Winchcombe


[See the photos on Facebook]

6th May 2013: We set off at 10:30am from Stanway on a fine Bank Holiday Monday (if you can believe such a thing), passing through a well crafted kissing gate by the Watermill and crossing the B4077 and continuing through fields to Wood Stanway. Here the path climbs uphill through fields to rejoin the B4077 at Stumps Cross.

From here the path follows a broad farm track, past a tin barn raised on staddle-stones, and then across more fields to Beckbury Hill Fort (270m) perched on the edge of the escarpment. From here there were fine views back towards Stanway House and saw the 300ft fountain operating (the tallest fountain in Britain). We stopped for lunch by the monument (Cromwell's Seat, named for Thomas Cromwell, although the monument is dwarfed by the trees, Cromwell's Clump).

From here the path drops down, crossing more fields to come out at a track along the edge of Hailes Wood, passing Hayles Fruit Farm to arrive at the ruined Cistercian Hailes Abbey (originally founded in the 13th Century) and the non-ruined Hailes Church (dating back to 1135). The path crosses a field (allowing you to photograph the ruins of the Abbey through the hedge), and then proceeds across more fields to pick up Puck Pit Lane which leads to the B4632 into Winchcombe.

Instead of following the main road into Winchcombe we departed from the official way to follow a footpath parallel to the road along the River Isbourne (and Teasel had a paddle). This brings you out on Castle Street, which can then be followed to rejoin the official route on the High Street.

This completes "Section 1" (Chipping Campden to Winchcombe) of Cotswold Way from the OS Recreational Path Guide, which splits the walk into seven sections.

Walk Distance: 6.7 miles (10.7 km), 2h32m.
Cumulative Distance: 19.3 miles (31.1 km), 7h17m.

Walk 4 will probably happen on the 7th or 8th of May.

Friday, May 3, 2013

Cotswold Way - Walk 2

Walk 2: Broadway to Stanway


3rd May 2013: We set off from Broadway at 11am. The route crosses the fields to the west of the town and then heads up to higher ground giving views over the Vale of Evesham. Farm tracks cross the plateau and lead to Shenberrow Hill (300m), site of an Iron Age Settlement.

The path then descends to the pretty village of Stanton, where the thatched cottages are topped with various ornaments (we saw a kangaroo(!), a fox, some ducks and possibly an owl). Leaving the village through more fields we emerged into the parkland of Stanway House, and finished the walk at Stanway Church.

Walk Distance: 6.3 miles (10.1 km), 2h20m.
Cumulative Distance: 12.7 miles (20.4 km), 4h45m.

Walk 3 will be on Monday (6th May).

Thursday, May 2, 2013

The Cotswold Way in May

As we are now living in Painswick we are right in the middle of the Cotswold Way, so I've walked the bits in to and out of Painswick with Teasel quite a few times.

According to Wikipedia, The Cotswold Way was officially inaugurated as a National Trail on 24th May 2007. This was my 40th birthday, and also my self imposed deadline for "compleating" the Munros. On discovering this recently Caroline suggested that I might like to try and walk the entire Cotswold Way with Teasel before my next birthday - a little over three weeks hence.

The first of May dawned a beautiful day, so I decided to start my attempt to do the whole thing in May (weather permitting).

Walk 1: Chipping Campden to Broadway


[See the photos on Facebook]

1st May 2013: Teasel and I set off from St James Church (the unofficial start) in Chipping Campden at noon. The route takes you along the High Street and past the Town Hall (the official start) and then out of the village and up to Dover's Hill (230m), with fine views over the Vale of Evesham, and the home to the "Cotswold Olympicks". A perfect place for lunch.

The walk continues along the broad grassy track of The Mile Ride, crosses the A44 at Fish Hill and continues to Broadway Tower (313m), another excellent view point. From there we descended the grassy slopes through fields to arrive in Broadway at 2:24pm.

Walk Distance: 6.4 miles (10.3 km), 2h24m.

If any of my walking friends would like to join me on a subsequent leg do get in touch as I'll be walking fairly frequently in the next few weeks to try and complete the whole thing in May 2013.

Walk 2 is likely to be tomorrow - 3rd May 2013.

Monday, April 22, 2013

Keeping OS X Awake

Wake up and smell the coffee...

OS X 10.8 has quite an agressive sleep strategy. Quite often, when writing programs for the Enigmatic Code site, I need to stop my laptop sleeping while it runs a program to generate a solution to one of the problems.

I found out last year about the caffeinate command in OS X, which stops the system from sleeping while a command is running. So I often use something like this:
time caffeinate pypy enigma82.py 6

if I want to leave my laptop running something when I'm out, or overnight (and know how long it took).

But what happens if a program has been running for a while and you forgot caffeinate it before you started? You don't want to kill it off and lose all the work it's done, just so you can restart it under caffeinate.

Well the answer is simple, just write a quick Python¹ program to monitor the process you are interested in, and caffeinate that instead.

Here's my quick Python program - I called it pid-exists - it just monitors a process (using the pid specified as the command line argument), until it disappears, and then exits itself.
import sys
import os
import time

PID = int(sys.argv[1])

while True:
  try:
    os.kill(PID, 0)
  except OSError:
    break
  time.sleep(10)

Then you caffeinate that instead. For example:
caffeinate pid-exists 57905

will stop the laptop from sleeping while the process while pid 57905 is active. Once the process 57905 terminates then so will the pid-exists process and the parent caffeinate process and the laptop will go back to it's normal sleep strategy.

Note: On OS X 10.11 you can now just use:
caffeinate -w <pid>
to keep the computer awake while process <pid> is running.

───
¹ Other scripting languages are available.

Wednesday, April 10, 2013

Sliding Puzzle in Python

As part of making a constructive solution to Enigma 1444 I wrote a some Python code to capture a simple "sliding puzzle" solving algorithm. (You can see my code on the Enigmatic Code site).

This is all very well, but I wanted to see the algorithm in action. So instead of cutting up pieces of paper and sliding them around my desk, I wrote a Tk app using Python.


You need to specify the puzzle dimensions on the command line when you start the program. In this case for a 5×5 grid I used:
python sliding-puzzle.py 5 5

A window should show up with the puzzle in it, and you can interact with it by clicking on a tile (adjacent to the blank square) and it should move appropriately. It will keep track of the number of moves and the elapsed time, and if you select an appropriate Target from the drop-down menu it will tell you when you achieve it as a solution. You can choose from "Normal", which is the tiles in their "natural" position, or "Reversed", which is the tiles in reverse order. Note that it is not possible to solve a grid into the "Reversed" configuration for all puzzle dimensions, but that's what the Enigma is about, so that's the default.

There's a button marked Scramble. If you press that the grid will be placed into a random (but not impossible to reach from the initial position) configuration.

There's also a button marked Solve, which if you click it will start solving the puzzle using the algorithm I wrote for the Enigma puzzle.

When you click Solve the puzzle shows you the piece it is currently trying to place (by highlighting the piece in yellow), and also the position it is trying to place it in (by placing a yellow highlighted border around it). Once a piece is placed it is slightly greyed out. Also the Solve button changes to a Stop button, should you wish to abandon the automated solution.

If the target configuration is not possible, the message area will display Impossible Target, and the app will beep.

I used this to demonstrate that the smallest solution for Enigma 1444 - a 10×5 puzzle - is indeed possible in less than 15 minutes, and this is the configuration that the program is set to solve by default. Just fire it up, hit Solve and sit back and enjoy the show. It takes 1300 moves and on my machine it runs in about 4 minutes.

The default animation speeds mean you would have to pretty nimble-fingered to keep up with the program in real life (or use a cleverer algorithm to solve puzzles in fewer moves), as it makes around 5 moves/s. (There are command line parameters if you want to change the speed of moves). I manually reversed a 5×5 puzzle in 3 minutes (three times slower than my program), so a 10×5 puzzle should certainly be possible in under 15 minutes by hand. (Update: I reversed the 10×5 puzzle manually using this program in 824 moves, in 10m27s).

The next smallest solutions are also solved in less than 15 minutes by the program (but only just). A 14×7 puzzle is solved in 3828 moves, and a 11×10 puzzle is solved in 4122 moves. These both take about 14 minutes. After that a 22×5 solution is solved in 6344 moves and takes about 21 minutes.

If you like you can specify a target configuration on the command line. For example you can try to solve the puzzle for which Sam Lloyd offered $1,000 by running:
python sliding-puzzle.py 4 4 1 2 3 4 5 6 7 8 9 10 11 12 13 15 14

and then clicking Solve - but you'll find the solution is impossible.

There's still a few rough edges in the program, and it's not particularly efficient, but it's works sufficiently well for me to see my solution to Enigma 1444 working, so I'm unlikely to take it further.

I've tested it on Mac OS X 10.8.3 under Python 2.7.4 and Python 3.3.1 with Tk 8.5.9, and on Linux (Ubuntu 12.04.2) under Python 2.7.3 and Python 3.2.3.

Tuesday, January 1, 2013

The Complete Sherlock Holmes

Last year I decided to read the complete Sherlock Holmes stories in the order they were published before the next series of Sherlock starts (although I've since found out they are not even starting to film it until January 2013).

I started by downloading The Complete Sherlock Holmes Canon from sherlock-holm.es as a PDF file, but soon realised that reading books on a laptop was not the way I wanted to go. But then Caroline bought a Kindle e-Reader and I discovered that reading PDF files on a Kindle was also not the way I wanted to go either.

So, I downloaded the HTML version of the Canon, and converted it to an eBook using calibre and I've now managed to complete The Complete Sherlock Holmes.

As I was going along I discovered a few transcription errors, which I've mostly fixed (it didn't occur to me to fix them in the first couple of stories, so a few still remain), I re-ordered the stories to match the original publication dates, and I changed the spacing of some punctuation so as not to confuse the Kindle's dictionary function.

If you'd like to download my version here it is: