Tuesday 1 December 2020

Covid-19 explained for bikers

When thinking about these strange times it can be helpful to relate what's going on to things we understand. Here is a Q&A for those of a biker persuasion.

Q: "Covid-19 is just another flu virus, why should I worry about that ?"

In the same way that most bikes have two wheels, an engine and handlebars they are not all the same. Outsiders just see a motorbike, we see a Harley, a Ducatti, a Triumph etc. The internals matter, some bike are screaming two strokes and some big capacity four strokes. This particular virus is a killer and disabler that has a much higher than flu impact on some of those that get it. 

Q: "Is this lockdown is just a way to control us all?"

Sometimes you just have to follow club rules. We all saw the impact of this virus and how it got around the world in a matter of weeks using sneaky tactics of "spreading but not showing" and "jumping on the already weak". Not catching the bug and not passing it on gives us the control over the bug.


Q: "How do masks help ?"

Masks are the new crash helmets.  A bit annoying but reduces the medical impact of an incident. Probably not needed 9/10 times but noone knows when that 1/10 prang is going to happen and when it does it's probably the other persons fault for getting the virus/pulling out of junction.



Q: "This Covid-19 situation is a government conspiracy to control us."

Certainly lots of countries are using the same tactics to reduce the impact of the global virus and they all started doing the similar things within a few weeks in March.  However this is not the first time bugs have traveled round the world think Bubonic plague, "Spanish" flu ( which BTW actually started in Kansas), SARS, MERS, HIV and others. Reaching for the infection prevention playbook is the sensible action that every government should have done. See the extra impact this bug has had on countries that were slow to take avoiding actions reminds us all to "look down the road" and "prepare for the unexpected actions of other road users". We all know some fools that ride like a nutter and are always in scrapes and spills.

March 2020

Q: Why are the restrictions rules always changing ?

There is no doubt that lockdowns and furloughs have a bad impact on the economy whilst reducing the spread of infection. We have seen that more lockdown results in less bugs. Less lockdown means a better economy but more deaths and infections.  There is a slim balance between medical and economic welfare but that balance depends on how the situation is in any country at any time. The ongoing discussion is similar to "Whats the best bike - racer or cruiser ?"  Just sometimes the answers to that question is "Neither - we need a snowmobile this week because there is three feet of snow all over."

Q: How bad has it been ?

That's a complex question that comes down to the excess deaths figures as seen here for the UK  Overall about 12% more people have died than expected. About a 10..15% impact on economic production GDP for 2020 with remanning levels of unemployment not seen since the early 90's. Huge levels of government support spending have pilled trillions £ on the national debt. Yes it has been pretty bad.

Q: I don't know anybody that had Covid-19.

Yes but you live in Devon where the infection rate is lower than most of the rest of the country.  About 1 in 100 people currently have the bug in our region and sometimes that 1 doesn't know they have it. Just 31 people out of 1,200,000 residents across the whole of Devon have passed away directly from the bug ( as at 1st Dec 2020). 

This bug is real, it kills people, you can most likely avoid it.


Thanks to the internet for the insightful memes. 

 

Thursday 22 October 2020

Apple computers and Cray Research - some notes

If you like this check out Cray-History.net

What are the Cray Research connections with Apple Computers ?

Cray XMP/48 with Apple SE inside
(c)1987 John Greenleigh

Cray Research and Apple Computers, seemly at opposite ends of the computer price spectrum, do have some subtle historical links. It is well known that Seymour Cray used an Apple desktop when designing Cray Computer Corp machines.  Macintosh computers where the desktop of choice and used almost exclusively whilst the company worked on the Cray-3 and Cray-4 projects. Much of the work was moving text and graphic files around a shared network.  "Seymour said he thought it was odd that Apple bought a Cray to design Macs because he was using Macs to design Crays. He sent me his designs for the Cray 3 in MacDraw on a floppy." reports KentK.

Apple Computer had a sequence of Cray machines starting in 1986 with an XMP/48 shown above followed by another XMP in Feb 1991. An upgrade to a Cray YMP-2E arrived later in 1991 and finally one of the smaller air-cooled Cray Y-MP EL from Dec '93 to Jun '98. 

Legend has that Apple's first XMP was bought by Steve Jobs after he walked into the Cray facility in Mendota Heights. However "Mike" a more reliable source relates ....

"The first machine installed at Apple was an X-MP/48 completed in August 1986. It had painted purple metallic columns and black power supplies. John Scully was the CEO, and he called the Western Region office in Pleasanton, Ca to get the salesman for his area of Cupertino, and his call was directed to Mike Wilhelm, the Western Region Manager, who after a lengthy conversation dispatched the salesman Bence Gerber, who sold the machine. I was standing at the receptionist desk who took John Scully's call when it came in, and got excited that Apple called us, and then went to Mike Wilhelm's secretary to hear what happened. I was also present for the installation, and spent many days covering the site."

According to a quote from MacObserver Website the timeline would indicate that John Scully was indeed in charge by install time.

"1985: Apple's board of directors authorizes John Sculley to remove Steve Jobs as executive VP and general manager of the faltering Macintosh division. Sculley, who genuinely liked Jobs, didn't act right away, hoping to make a smooth transition. Only after discovering Jobs' plan for a coup the following month did Sculley finally strip the founder of all operational responsibilities."

The Apple Cray machines were originally purchased to help out on a computer on a chip project and other engineering projects. Such projects included using the first Cray XMP as a Macintosh emulator for user interface design improvements. The site analyst reports ..

".. they sometimes ran the first XMP as a single user MacOS emulator ... They had a custom built frame buffer and a mouse hooked up to the IOP (Input/Output Processor).

Other applications were Computational Fluid Dynamics codes for disk drive head design improvement and complex chip and board logic proving tests. The Apple Cray machines eventually earned their keep running MOLDFLOW an injection plastic modelling program ( producing some results in the form of Quicktime movies) and later as a file server. 

Example of MOLDFLOW output


 T3d cube of cubes logo animated by changing the size of the surrounding balls.

What is less well known however is that the small active display panel on the front of the Cray T3D machines was an Apple powerbook. The powerbook ran a Macromedia presentation showing the T3D cube of cubes logo with an orbiting growing/shrinking sphere. The display at one site was changed to alternate with a presentation plaque display. It was rumoured that one site engineer ordered a collection of spare bits that, over time, comprised a complete new powerbook.

Cray T3D Tool Time Sales booklet showing the T3D with Powerbook generated logo front and centre (Scale T3D is aprox 2500mm tall) 
 

The Sept 1999 launch on the www.Apple.com web site of the G4 Macintosh computers displayed a YMP-8D computer on the processor details page. Whilst there was no direct reference to that particular machine there was a re-quote of the Seymour quote about "using an Apple to simulate the Cray-3" in a sidebar. The G4 was being touted as a "Supercomputer for the desktop" and with the performance figures of a Gigaflop/s (1 CPU) which is certainly up to at least 1992 supercomputer cpu speeds. The YMP pictured on the site would have had 0.333 Gflop/s per cpu but was sold as sustaining 1 Gflop/s, for the whole machine, on real life applications. Only comparable benchmarks would show if the Apple G4 could match the memory size, memory bandwidth and IO capacity the 8 year old Cray shown. There is however no doubt that the G4 would be cheaper to purchase than any machine from the Cray range.

The once popular Macintosh telnet communications program developed by NCSA (National Centre for Supercomputing Applications at the university of Illinois) in has an icon which is an Cray XMP surrounded by a network with Macs. NCSA had a Cray accessed by Macs and thus needed to develop such a program. 

One of those strange coincidences between Apple and Cray were problems using Perspex as a chassis material. Apple had problems with the Power PC G4 Cube machine as the corners were subject to cracking in some instances. Over at Cray the innovative total immersion cooling Cray 2 had cylindrical coolant reservoirs and cascades. After some time the coolant reservoirs tower material started to "craze" and fine cracks appeared. This was remediated by a new designed a new rectangular cascade that had a smaller footprint, was made of glass that solved the problem. 

Apple Power PC G4 Cube
(scale 180mm tall)

Early Cray-2 showing Cylindrical coolant reservoirs
(scale Cray-2 in foreground is 1200mm tall)

Cray-2 showing revised coolant reservoir 
( scale Cray-2 is 1200mm tall)


See other Cray historical notes at The Cray FAQ over at 0x07bell.net.

Further details in this article from Cray Channels 1987 (c)Cray Research Written by Kent Koeninger at or about the time of Apple's first Cray purchase.

Cray Research at Apple
computers

Cray Research at Apple
computers




Monday 10 August 2020

Three noses of the Mercedes Benz SLK

 With the early versions of this prestige sports brand reaching 25 years old it’s certainly time to review the versions and features available in this now affordable car. The Mercedes-Benz SLK is a luxury sports roadster named after Sportlich (sporty), Leicht (light), and Kurz (short). All models are built at the Mercedes plant in Breman, Germany. The later R172 model was renamed SKC-Class to fit with other Mercedes Benz series. 

Model and yearsEngine size / gearsBody Styles
Notable features
Current approx costs
SLK Mk1 - R170; 
1996–2004
SLK 320 is V6 others are 2 litre mostly with Kompressor (supercharger)2 door with power retractable hardtop
Facelift and new engines in 2000
Gearbox 6 Speed after 2001
£1500 - £6000 for low milage top spec example
SLK Mk2 -  R171;
2004–2011
1800 Kompressor 4 Cyl, 2000cc  V6 and 5439 cc V8 Available
Retractable Hardtop
pronounced F1 style nose.
Airscarf, 
Facelift and new engines 2008
£5000 - £9000
Add £500 for AMG badge
SLK Mk3  - R172; 
2011–2019
SLC-Class
4 cyl, V6 & V8 with turbos  also available as diesel in SLK 250 CDI
Retractable Hardtop
Flat front similar to other MB cars.
2015 on  BlueEFFICIENCY 
Facelift 2016 renamed to SLC
Electronically operated window tint shade for the sunroof, called Magic Sky Control.
Auto folding mirrors.
£7500 to £40000
More for some specials variants

SLK Mk1 - R170 
MK1 SLK R170

Developed by Bruno Sacco from the SLK 1 concept cars and introduced at the 1996 Turin motor show. Standard features included power roof, power seats, power windows, power steering, anti-lock brakes, stability and climate control. The AMG model option added side skirts and chrome tailpipe and 17inch wheels. The power roof opening in less than 30s was undoubtedly the headline feature of the car.
The top of the range SLK 32 AMG of which only 4,333 examples exist out of total SLK Mk1 production of 311,222,  features a V6 engine plus a supercharger delivering 349 Horsepower with a 5.2s over 0..60. 
See one driven with Mike “Every time I get behind the wheel of a car with no roof I wonder why aren’t all cars made this way. and Edd from Wheeler Dealers here  https://www.youtube.com/watch?v=DD6myeGfRY8  and internal build and servicing examined in 40 mins of germanic detail here https://www.youtube.com/watch?v=id-42g2XSPk 

SLK Mk2 -  R171



The second generation SLK introduced in 2004 at the Geneva motor show has a distinctive nose with multiple grills inspired after F1 cars of the time. With a longer wheel base and six speed auto gearbox the upgraded model retained the series defining power retractable roof. The engine sizes start from normally aspirated 1.8 to 1.8 with supercharger onward  through 3 and 3.5 liter V6s to the AMG version 5.4L V8s.  A long list optional extras included bi-Zenon headlights and Airscarf headrest heaters and Harmon Kardon sound systems. 

The post 2008 facelift version retained the distinctive nose but added a more pronounced arrow shape front bumper and interior improvements such as a Red leather option and voice control. 

See with review and buyers guide common issues here https://www.youtube.com/watch?v=OvJ1VOuvWUU and in action with detailed review here https://www.youtube.com/watch?v=FjFVAorBn3Q 

SLK Mk3  - R172




The final generation SLK with it’s more traditional upright Mercedes nose was introduced at the Geneva motor show in 2011. Retaining the electric folding roof the final variant featured a swap from supercharger to turbo assisted engines. Starting with a 4 cylinder 1.8L and rising to 2L with 3.5 L V6 versions available up to the range topper 5.4l V8 in the SLK 55 AMG. Continuously adjustable electronically controlled suspension controlled the handling. Auto engine start-stop, seven speed auto gearbox, a low drag Cd factor contributed to the Blue Efficiency naming. The 2012 SLK250 introduced the 2.1L turbo diesel engine along with other facelifts to the range.  

The fancy feature in the range is the innovative "Magic Sky Control" center panel. Unlike opaque solid steel roofs or heavily tinted glass panels (both are offered on the new SLK), the German engineers have come up with a optional trick glass panel utilizing LCD-type technology that goes from mostly clear when voltage is applied, to mostly opaque when it loses its charge. (Getting technical, it drops measured sun "intensity" from about 1050 watts with an open sky to just 200 watts when closed in "clear" mode. Switch it to "opaque" mode, and the intensity drops to about 45 watts.) While it cuts UV, infrared and visible light significantly, the panel never goes completely opaque. 

Team test by 5th Gear available here on https://www.youtube.com/watch?v=fVMwkUH9GKQ  and 2014 test drive by Bill with review  https://www.youtube.com/watch?v=ZKtY81MVrco 

Comentry
Possibly the 3rd generation has lost its’ way from pure sports car moving toward luxury small sedan in appearance and dynamics but this range of cars provides open top motoring at its slightly more modern best. User forums here https://www.slkworld.com 

Car online hunting grounds

Find where various cars appear in TVs shows and movies over at the internet movies car database.   https://www.imcdb.org 

Acknowledgements : Wikipedia, YouTube and Autoblog.com

The First Fifteen Lives of Harry August

The First Fifteen Lives of Harry AugustThe First Fifteen Lives of Harry August by Claire North
My rating: 5 of 5 stars

I have always been fond of time travel stories and warped (but plausible) viewpoints on this and other worlds. This book was a revelation, a stand out giant of a story. The premise, quite simple, as a "kalachakra", Harry August the hero reincarnations resets his life back to zero but he keeps memories to build on previous experience. Other such souls exist some working for timeline stability others have a dark selfish agenda seeking to dominate world via accelerated technological advancement. The conflict works out over the 15 lives of Harry in which he comes to terms with his illegitimate birth origins and circles around with his deepest friend/enemy both working for and against the world breaking cause. The paradoxes of time manipulation are not over exaggerated serving to move the narrative along without over complication. Lives are long and not always exciting adding to the genuine autobiographical feel of the book.
A really great read that evolves over the course of Harrys personal development. Once hooked in I could not put this one down and has left me with a confirmed impression that humanity is often not ready for the technology we have developed
Was read just after "The Rise and Fall of D.O.D.O" By Neal Stevenson which is in the same time manipulation fiction sub-sub-genre but that's another review.



View all my reviews

Wednesday 8 July 2020

Three noses of the Toyota MR2

From the definitive 80's wedge to the excellent handling of the last Roadster incarnation this popular mid-engined two seater has accumulated many fans over the 36 year span of the three models presented here. 
 

Model and yearsEngine size / gearsBody StylesNotable featuresCurrent approx costs
MR2  Mk1a & Mk1b
1984–1989  
AW10 - 1.5L Petrol
AW11 - 1.6L DOHC
5 speed manual, 4 speed auto
Hard top and T-Bar Super charger on some Japan domestic cars£300 project to  £7,000 mint
MR2 Mk2 GT Coupe and GT T-Bar 
1989–1999 

SW20: Various 2.0L 
some Turbos
Tin top and T-Bar
coupe. 
Also unbranded Spyder version
Rear Spoilers lots of after markets body kits and goodies.£300 project to £5,000 mint or special racer
MR2 “Spyder” and “Roadster"
1999–2007

SW30: 1.8L Petrol
5 or 6 speed gearbox
Softtop with removable hard top option
SMT paddle gear shift option

£300 Project to £7,000 mint

Mk1 A & B 1984 - 1989



The Toyota MR2 (midship runabout) was introduced at the Toyko motor show in October 1983 and launched the following year to the UK and USA markets. Using a fuel injection, 4 cylinder DOHC design generating just over 100HP, weighed in a just over a tonne. The sprightly car could easily out run both of it's contemporaries the Fiat X-19 and USA Pontiac Fiero. The MX5 appeared a few years later as a soft top from the start.

A super charger was introduced a couple of years later to the Japan and US markets but was not sold directly in the UK. The supercharger was belt-driven but actuated by an electromagnetic clutch, so that it would not be driven except when needed, increasing fuel economy. 

Worst featureMK1's rust from the inside out due to aerial (Mk1a) and roof drains sending water into the sills.
when engine is operated the heat warms the moisture which causes condensation in lower sills, which settles over rear arches and box sections. They then rot out. Earlier engines were less robust with smaller internal components such as crank and rods. Brake calliper and discs were smaller in earlier cars and suspension components less durable.

Drivers opinion. from Overtake films “When I first saw it I remember think wow that design is so right. The engine really likes to rev with a red lines a 7750 rpm making about 123 hp. It comes alive as soon as you sit in it. It feels agile. It has no ABS or power steering but it feels lighter than a front wheel drive Peugeot 205. The more you work the car the more it does for you. It feel way more sorted and capable and planted than a modern car.”

Also See 1987 Toyota Mk1 MR2 AW11 Review and Drive - Why it's a little bit of Magic on 4 wheels    https://www.youtube.com/watch?v=7rSvzch7Fis 

Mk2 Coupe 1989-1999
The MK2 version of the MR2 moved to a more rounded body style from the very wedge Mk1 and introduced larger 2.0L engines.  The new car was larger, weighed 159 to 181 kg more than its predecessor due to having a more luxurious and spacious cabin, larger engine sizes, sturdier transaxle, and a more durable suspension setup. The overall design of the automobile received more rounded, streamlined styling, with some calling the MR2 SW20 a "baby Ferrari" or "poor man's Ferrari", since the car did have several design cues borrowed from Ferrari.
There were no turbo models officially offered to the European market but many Japanese import models were sold and re-sold via the grey JDM import market. This car extensively adopted by the racing and moving scene of the early 00’s with a proliferation of after market parts and upgrades available directly from Japan and other suppliers.

Worst feature : Snap oversteer on early models during in-corner liftoffs like many mid and rear engined car.  Finally the "hose from hell" - a coolant hose so buried in the mid engine bay and surrounded on all side that it requires an engine drop to replace. 

Drivers opinion. from Rex H.  “Has a small throw clutch and short throw shifter. You can feel everything that engine is doing. The steering is sharp and there are no plastic creeks and noises. Overall driving experence very nice casual drive and aggressive as you want to be. Handling all the bumps very well. Interior is big enough for up to about six foot three.  ” Youtube on https://www.youtube.com/watch?v=pMaP6e6G0Vg  or

See also Five things to know about a MR2 Turbo.  https://www.youtube.com/watch?v=EgOA_P6EkVQ 


Mk3 Roadster 1999 - 2007
The final car of the sequence is the round Mk3 version that continued the mid engine format but lightened the weight and moved to 1.8L Twin Cam engines. Unlike its predecessors, however, the engine was placed onto the car the other way round, with the exhaust manifold towards the rear of the car instead of towards the front. The retractable soft and optional removable hardtop replaced the fixed and T-bar top-lines. The MR2 Spyder chief engineer Harunori Shiratori said, "First, we wanted true driver enjoyment, blending good movement, low inertia and light weight. Then, a long wheelbase to achieve high stability and fresh new styling; a mid-engine design to create excellent handling and steering without the weight of the engine up front; a body structure as simple as possible to allow for easy customizing, and low cost to the consumer."

Some owner switched out the 1ZZ-FE engine in exchange for the 141 kW; 189 bhp; 192 PS 2ZZ-GE found in the US-market Celica GTS

Worst features : Very small luggage space and digests own pre-cat from exhausts manifold.

Drivers opinion. from  Doug DeMuro  “Everything is nice and well put together, nothing is extremely luxurious or special, looks durable. Clutch and shifters are easy. Flooring it - it moves but not tremendously quickly. It could have been a little faster. It’s a little harsh. I am surprised how precise the steering and the handling is very responsive. It’s nice being in an open top car roof down being that guy. It really is Toyota take on a sports car, durable and quick handling. This car is cool.”  


For the Racers: The 750 Motor club has runs a MR2 challenge series with entries for all the versions. Double race weekends are run seven times ( in normal years) at top UK circuits.  For car race gamers the Toyota MR2 appears in every main Gran Turismo game to date since the original Gran Turismo. Although initially not available in Gran Turismo Sport, the 1997 MR2 GT-S was later introduced as part of Update 1.13, released on February 28, 2018. The first and third generations are available in every game starting from Gran Turismo 2.

Future collectability : The march of time is eating many of the early cars with a combination of rust and racing making finding a good original version harder over time. Engine parts are generally still available but trim and special parts are getting hard to locate. Many of the sources of after market upgrades have moved on to new models but have left a rich heritage to be discovered in the recycle market. The 80s are swinging back into fashion with fast Fords from that era pushing prices sky-high maybe it’s time to look around for other desirable cars from that time.

Acknowledgements : Wikipedia, YouTube and MR2 Owners club sites.

May 2020. 

Sunday 28 June 2020

Made during lockdown with recycled decking boards


Last year we had the balcony on the back of the house replaced with a new metal and GRP structure. The decking was made out of plastic composite boards from Envirobuild and we had some left over. Lockdown provided some time to recycle these boards into some new projects.  These grey waterproof boards should prove to be a suitable non-rot replacement for perished wood.

One important thing to note with these boards is that the "sawdust" is in fact small micro plastic shavings. All cutting and drilling was done on a tarp so that these shaving could be collected, bagged and disposed of properly.

Thanks to Shane for the work on the trug.

Old arse trug

New arse trug

Now with beans and radishes


Pot and stuff moving trolly


 Has caster in each corner


New front for the compost heap

Friday 5 June 2020

Electric scooter Advert overanalysed

Electric scooters - what's the fuss ?

This snap is taken from a glossy video promoting the use of electric scooters film on UK roads. Reactions:

  • No helmet.
  • Going wrong side of junction as shown by markings and arrow.
  • Electric scooters not yet legal on UK roads.
  • In frame before this one shows two people riding on same single person scooter going the wrong way up one way street. (Large white arrow on road).

The clip was probably filmed this way to use the available lighting on that side of the street. This appears to be a major triumph of marketing over both legality and responsibility. Karen is filling complaint to the Advertising Standards Authority even as I type.


Monday 13 April 2020

Bad Blood (Theranos) and The Smartest Guys in the Room (Enron) describe toxic workplaces that allow frauds and cons to flourish.

Bad Blood about Theranos
Smartest Guys in the room



Having recently read Bad Blood (Theranos) and The Smartest Guys in the room (Enron)  I was stuck by the similarity of the toxic workplaces that allowed these huge frauds to continue.

Enron used "creative" accounting and corrupt financial business practices to hide loses in the energy sector. Each quarter's results snowball on previous failures leading to a huge implosion in 2001

Theranos developed blood testing machine intended to replace the need for off-site blood tests using just a few drops of blood. The devices never worked reliably or accurately compared to established testing machines. As a silicon valley "Unicorn" this company burnt millions in start up finance.

Similarities

  • Both companies were driven by charismatic characters with little grasp of the actual underlying science of the business.
  • Both had "Bulldog" partners that bullied and coerced employees into compliance.
  • Facts were hidden, one company used creative accounting methods to hide the real business financial facts, the other hid the miserable product performance from regulators and investors.
  • Both companies prevented cross company employee engagement to prevent effective collaboration.
  • Both companies had ineffective but high profile governance boards that were in thrall to the CEOs.
  • Both company had highly paid employees who job description was vague and performance marginal.
  • Original innovators leave in disgust or under a pretence cloud.
  • Both companies had the internal culture of a cult. "All in or get out".
  • Both companies valued long hours, apparent dedication over actual effective results.
  • Both companies employed outside "consultants" to aid and abet the toxic business processes; Accountants in one case, Lawyers in the other.
  • Whistleblowers were either ignored or legally threatened sued and silenced.
  • Investors wanted to believe the "Too good to be true" story above the realities of market sense.  

Loses
Enron -In excess of $70 Billion. A publicly listed company who's loses were spread across the regular stock market.

Theranos - In excess of $600 Million as well as 1000s of inaccurate blood test results leading to real medical harm. A private company who's loses hit a smaller group of private investors.

** Update Dec 2022 Balwani to serve 13 years serious prison time.

See also
Bernie Madoff and This list  of other large corporate failures.

Wednesday 1 April 2020

Apple's secret recycling program reveals Apple store design secret.

The hidden secret behind the design of prestige Apple stores can at last be revealed. In an press briefing yesterday Apple executives revealed to ARCHITECTUREAL DIGEST the design driver that has made Apple retail stores so iconic.

At the regular start of quarter meeting today an investigative reporter from AD probed the Apple retail store design manager for further information about the practice that has led to outrage across Apple iPhone users.

Many loyal Apple users have suffered the loss by cracking and breakage of their beloved iPhone only to be charged $100s for a screen repair. The little known policy that can at last be revealed today is that the Apple repair service has been recycling the glass from broken iPhones into frontages and stair features at iconic Apple stores.

The Apple manager, Toby Gillimond, responsible for this hidden program is quoted "Whilst it takes many broken iPhone screens to make the stairs in an Apple store we receive so many busted and smashed phones that we have been opening a new store every month. The glass is tough and strong and once recombined into new glass slabs makes an excellent staircase."  When probed to establish if the owners of the broken iPhones were compensated Toby evasivly replied. "Apple makes many excellent products using materials from a variety of sources. We feel that recycling broken iPhone glass into a useful industrial material fits well within our recycling program parameters."

There you have it folks when next visiting an Apple store ( set to be reopened after the Covid-19 crisis) remember that you walk upon the tears of owners with broken iPhones.


Broken iPhones

Glass staircase in Exeter Apple store



Not for public release before 1st April 2020. 

Friday 20 March 2020

Solving Kenken (and Killer) using an SMT (integer) solver

Continuing in the short series of reframing puzzles and using an SMT integer solver to find a solution we look now at solving the Kenken (sometimes known as killer Sudoku) class of problem.  This popular number placement puzzle seen in the UK papers Daily Telegraph and Daily Mail. This puzzle is similar to killer-Sudoku using a rectangular grid of numbers where target sums are set for small regions of cells. The numbers 1..9 are placed in the grid such that the sum of the numbers equals the targets provided for each region. Any number can only used once in each row and column.

This 9 by 9 hard example is from www.Kenken.com. Looking at this puzzle we see regions of cells each of which has a total and an operation +,-,*,/ in the top left most region cell. 



The encoding of this puzzle relies on a region identifier being placed in each group of cells that belong to the same sum. The target sum and operation are encoded with the region letter.  The top left cell is labeled  a16+ and the two below as just a. The encoding is {group identification letters}{target number}{operation} for the first cell in a group then just the {group letter  identification letter} for the rest.

When the operand of a sum is - or / the cells can be used in either order. This is the encoding for the puzzle above.

#kenken www.kenken.com kk_91.png 73491
a16+,b1-,b,e5-,e,f3/,f,g13+,g
a,c4/,c,h3-,j45*,j,l22+,l,g
a,d3+,d,h,k2-,k,l,m2-,m
n3/,p1-,q8-,r120*,r,r,t20*,u2-,v2
n,p,q,s2-,s,t,t,u,w17+
aa9+,bb63*,cc1-,dd5-,dd,ff1-,gg48*,w,w
aa,bb,cc,ee5-,ee,ff,gg,hh4/,hh
kk3,mm432*,xx20+,xx,yy18+,zz3+,zz,ab13+,cd2-
mm,mm,xx,xx,yy,yy,yy,ab,cd

A script is used to generate the SMT2 lines for the solver.  For this puzzle because of the inclusion of * and / operands the UFNIA: Non-linear integer arithmetic with uninterpreted sort and function symbols logic is used.  The words after a ; on a line are comments.

Set the logic to UFNIA and declare the variables V0 .. V80 then set the range for each variable.
(set-logic UFNIA)
(set-option :produce-models true)
(set-option :produce-assignments true)
(declare-const V0 Int)
(declare-const V1 Int)
(declare-const V2 Int)
......
(declare-const V79 Int)
(declare-const V80 Int)
(assert (and (> V0 0) (< V0 10)))
(assert (and (> V1 0) (< V1 10)))
.......
Next the constraints for each number has to be unique on the row and unique in a column. There are 18 of these lines.

(assert (distinct V0 V1 V2 V3 V4 V5 V6 V7 V8 )) ; line 0 1
(assert (distinct V0 V9 V18 V27 V36 V45 V54 V63 V72 )) ; line 0 9
........
Next the constrains for the number regions. Notice the "or" logic for the - and / operands. There is one line for each cell region, 36 in all for this puzzle example.

(assert (= 48 (* V51 V60))) ;   Region gg
(assert (or (= 2 (- V34 V43))(= 2 (- V43 V34)))) ;      Region u
(assert (= 3 (+ V19 V20))) ;    Region d
(assert (or (= 2 (- V39 V40))(= 2 (- V40 V39)))) ;      Region s
(assert (= 13 (+ V70 V79))) ;   Region ab
(assert (or (= 3 (/ V5 V6))(= 3 (/ V6 V5)))) ;  Region f
.......
and finally the wrap up and answers extract. 
(check-sat)
(get-value (V0 V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 V22 V23 V24 V25 V26 V27 V28 V29 V30 V31 V32 V33 V34 V35 V36 V37 V38 V39 V40 V41 V42 V43 V44 V45 V46 V47 V48 V49 V50 V51 V52 V53 V54 V55 V56 V57 V58 V59 V60 V61 V62 V63 V64 V65 V66 V67 V68 V69 V70 V71 V72 V73 V74 V75 V76 V77 V78 V79 V80 ))
(exit)

As with the previous puzzles the script was coded to read in the solvers output and then generate output using the original puzzle and check the answers provided. Using display colours help identify the cells of a region. Amusingly we could have done the cell colouring with just four colours using the solver technique described here.

The performance of the two solvers used vary dramatically MathSat5 took about 7 minutes
424.79 real       
421.93 user         
1.75 sys 
but Z3 solver took substantially longer at 45 minutes but gave the same answers.
real 45m38.547s
user 45m21.082s
sys 0m10.940s


In short mode the script just provides region name and cell values.

a 7b 5b 4e 6e 1f 9f 3g 2g 8
a 1c 2c 8h 4j 9j 5l 7l 6g 3
a 8d 1d 2h 7k 4k 6l 9m 3m 5
n 6p 4q 9r 5r 3r 8t 1u 7v 2
n 2p 3q 1s 8s 6t 4t 5u 9w 7
aa 4bb 7cc 5dd 3dd 8ff 2gg 6w 1w 9
aa 5bb 9cc 6ee 2ee 7ff 3gg 8hh 4hh 1
kk 3mm 6xx 7xx 9yy 5zz 1zz 2ab 8cd 4
mm 9mm 8xx 3xx 1yy 2yy 7yy 4ab 5cd 6

In verbose mode each cell has R= Region identifier, Ro= Operand, Rn= region total and Val=cell value.

R=a Ro=+ Rn=16 Val=7R=b Ro=- Rn=1 Val=5R=b Ro=- Rn=1 Val=4R=e Ro=- Rn=5 Val=6R=e Ro=- Rn=5 Val=1R=f Ro=/ Rn=3 Val=9R=f Ro=/ Rn=3 Val=3R=g Ro=+ Rn=13 Val=2R=g Ro=+ Rn=13 Val=8
R=a Ro=+ Rn=16 Val=1R=c Ro=/ Rn=4 Val=2R=c Ro=/ Rn=4 Val=8R=h Ro=- Rn=3 Val=4R=j Ro=* Rn=45 Val=9R=j Ro=* Rn=45 Val=5R=l Ro=+ Rn=22 Val=7R=l Ro=+ Rn=22 Val=6R=g Ro=+ Rn=13 Val=3
R=a Ro=+ Rn=16 Val=8R=d Ro=+ Rn=3 Val=1R=d Ro=+ Rn=3 Val=2R=h Ro=- Rn=3 Val=7R=k Ro=- Rn=2 Val=4R=k Ro=- Rn=2 Val=6R=l Ro=+ Rn=22 Val=9R=m Ro=- Rn=2 Val=3R=m Ro=- Rn=2 Val=5
R=n Ro=/ Rn=3 Val=6R=p Ro=- Rn=1 Val=4R=q Ro=- Rn=8 Val=9R=r Ro=* Rn=120 Val=5R=r Ro=* Rn=120 Val=3R=r Ro=* Rn=120 Val=8R=t Ro=* Rn=20 Val=1R=u Ro=- Rn=2 Val=7R=v Ro= Rn=2 Val=2
R=n Ro=/ Rn=3 Val=2R=p Ro=- Rn=1 Val=3R=q Ro=- Rn=8 Val=1R=s Ro=- Rn=2 Val=8R=s Ro=- Rn=2 Val=6R=t Ro=* Rn=20 Val=4R=t Ro=* Rn=20 Val=5R=u Ro=- Rn=2 Val=9R=w Ro=+ Rn=17 Val=7
R=aa Ro=+ Rn=9 Val=4R=bb Ro=* Rn=63 Val=7R=cc Ro=- Rn=1 Val=5R=dd Ro=- Rn=5 Val=3R=dd Ro=- Rn=5 Val=8R=ff Ro=- Rn=1 Val=2R=gg Ro=* Rn=48 Val=6R=w Ro=+ Rn=17 Val=1R=w Ro=+ Rn=17 Val=9
R=aa Ro=+ Rn=9 Val=5R=bb Ro=* Rn=63 Val=9R=cc Ro=- Rn=1 Val=6R=ee Ro=- Rn=5 Val=2R=ee Ro=- Rn=5 Val=7R=ff Ro=- Rn=1 Val=3R=gg Ro=* Rn=48 Val=8R=hh Ro=/ Rn=4 Val=4R=hh Ro=/ Rn=4 Val=1
R=kk Ro= Rn=3 Val=3R=mm Ro=* Rn=432 Val=6R=xx Ro=+ Rn=20 Val=7R=xx Ro=+ Rn=20 Val=9R=yy Ro=+ Rn=18 Val=5R=zz Ro=+ Rn=3 Val=1R=zz Ro=+ Rn=3 Val=2R=ab Ro=+ Rn=13 Val=8R=cd Ro=- Rn=2 Val=4
R=mm Ro=* Rn=432 Val=9R=mm Ro=* Rn=432 Val=8R=xx Ro=+ Rn=20 Val=3R=xx Ro=+ Rn=20 Val=1R=yy Ro=+ Rn=18 Val=2R=yy Ro=+ Rn=18 Val=7R=yy Ro=+ Rn=18 Val=4R=ab Ro=+ Rn=13 Val=5R=cd Ro=- Rn=2 Val=6

The check output looks like this where the occurrence of each digit is counted. There should be 9 each of the 1..9 digits.

1=9,2=9,3=9,4=9,5=9,6=9,7=9,8=9,9=9,

then the region formulas are checked.
Region a = OK as 16 + over 0 9 18
Region aa = OK as 9 + over 45 54
Region ab = OK as 13 + over 70 79
Region b = OK as 1 - over 1 2
Region bb = OK as 63 * over 46 55
..........
Region v = OK as 2=2
Region w = OK as 17 + over 44 52 53
Region xx = OK as 20 + over 65 66 74 75
Region yy = OK as 18 + over 67 76 77 78
Region zz = OK as 3 + over 68 69


This encoding and solver technique can be used for many similar integer constraint puzzles such as the DM Killer (which just has addition operations) and Telegraph Killer Sudoku Pro.

Killer

Killer is a combination of sudoku and kenken but the sub regions just use +.



The same methodology as kenken is used. The encoding becomes:

#Killer Sudoku _01 DM
a14+,a,c14+,d6+,e15+,f13+,g8+,h9+,h
a,b9+,c,d,e,f,g,i12+,h
j11+,b,c,k13+,l8+,l,m16+,i,p22+
j,s11+,k,k,n12+,n,m,p,p
s,s,t17+,v11+,v,w14+,m,q20+,q
u12+,u,t,w,w,w,m,r4+,q
x25+,x,x,x,y9+,y,z21+,r,aa10+
cc7+,dd10+,ee7+,ff10+,gg22+,gg,z,aa,aa
cc,dd,ee,ff,ff,gg,z,bb13+,bb

For the output region letters are displayed and coloured.

1=9,2=9,3=9,4=9,5=9,6=9,7=9,8=9,9=9,

a 9a 3c 7d 1e 8f 4g 5h 2h 6
a 2b 4c 6d 5e 7f 9g 3i 8h 1
j 8b 5c 1k 3l 6l 2m 9i 4p 7
j 3s 1k 2k 8n 5n 7m 4p 6p 9
s 4s 6t 8v 9v 2w 3m 1q 7q 5
u 5u 7t 9w 6w 4w 1m 2r 3q 8
x 7x 9x 5x 4y 3y 6z 8r 1aa 2
cc 1dd 2ee 4ff 7gg 9gg 8z 6aa 5aa 3
cc 6dd 8ee 3ff 2ff 1gg 5z 7bb 9bb 4

Region a = OK as 14 + over 0 1 9

Region a = OK as 14 + over 0 1 9
Region aa = OK as 10 + over 62 70 71
Region b = OK as 9 + over 10 19
....

Example of Killer Sudoku

Encoded and works the same as kenken.




Appendix Usage of logic generation script 

Usage: KenKen {options} < puzzel.txt  or
    KenKen {options} -f puzzel.txt < SolverOutput
    -v N :Be verbose to level N ( use v=1 for detailed output )
    -f puzzel.txt :Puzzel file needed when reading Solver output use STDIN otherwise
    
    Programs reads STDIN looking for either puzzelFile format lines or Solver output lines
        If the input is in puzzelFile format the program will generate solver input lines.
        If the input is in Solver output lines format the program will expect a -f puzzelFile paremeter.
            Using both these input streams program will then generate display .html output.
Game Rules
Each cell can be 1..N only. Repeats NOT allowed in any row or column.
Encoding Rules
Each cell belongs to a single region/cage that has a letter and formula in the first occurance of the region.
Region names must be unique. Puzzels must be square. N*N puzzel has answers 1..N.
    For Example
    b2-,b, ...  the values in the b labeled cells must satisfy b-b=2
    Numbers may repeat with a region but not in a row or column.

Each KenKen puzzel Input as follows each caged squares must belong to a region
        region_lable{Value}{operation+-*/}
        
        #KenKen DM x
        a2/,b2-,b,c3/,c,d4
        a,e72*,f4,g90*,g,h3+
        e,e,i5+,j5,g,h
        j17+,j,i,i,k4,l2/
        j,m7+,m,n7+,n,l
        j,o5-,o,n,p2-,p
....
to generate an SMT2 input file. Use a .. z and A .. Z or aa .. zz for region/cage names

OR Process results from solver in the following format
    sat
    ( (V0 9)
    (V1 7)
    (V2 5)
    (V3 3)
    ....
to generate an html table as output