Perl-Sensitive Sunglasses PerlMonks

### comment on

 Need Help??

Whilst waiting for my tea to brew, and thinking about my latest programming problem, I found myself 'walking the diagonals' on my tiled kitchen floor.

Walking the diagonals means starting in one corner of the rectangle and walking away at 45 degrees:

```+---+---+---
| \ |   |
+---+---+---
|   | \ |
+---+---+---
|   |   | \

And when you hit the opposite edge, 'reflect' back in the other direction:

```   | \ |   |   | / |
---+---+---+---+---+
|   | \ | / |   |
+---+---+---+---+---

Ditto at the ends:

```|   | / |
+---+---+---
| / |   | /
+---+---+---+
| \ | / |
+---+---+---+

The walk ends when you arrive directly into a corner. See the first diagram, but going the other way.

What I noticed was that starting in one corner, and continuing until I encountered another corner, I found myself in the diagonally opposite corner. When I drew a diagram on a post-it, I discovered that I had walked on every tile exactly once.

This was interesting, because I've been doing this 'walking the diagonals' when deep in thought -- a mindless repetitious activity that frees the mind for deeper things -- and recalled that in my old house kitchen, where the rectangle was the same width, but 2 tiles shorter, the tour also ended up in the opposite diagonal; also covered every tile exactly once and was 14 10 steps smaller.

How big is the rectangle in my current kitchen? Answer: 13 x 5.

(Other answers are possible, particularly 5x9 solution; but most of them would either have required me to use one of the terms: 'kitchenette' or 'galley' (as in train or ship) rather than kitchen :)

I was going to post code, but choroba's is much prettier; especially if you a) stop it considering even numbers; b) add a system 'cls'; or equivalent into the redraw loop; c) reduce the sleep time after the for loop to 1/10th second. Quite hypnotic once the sizes get up a bit (I start it at 21 and inc by 2).

Solution:

```Old: 5x11

s/\/\/\/\/\
/\/\/\/\/\/
\/\/\/\/\/\
/\/\/\/\/\/
\/\/\/\/\/e

New: 5x13

s/\/\/\/\/\/\
/\/\/\/\/\/\/
\/\/\/\/\/\/\
/\/\/\/\/\/\/
\/\/\/\/\/\/e

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-09-14 03:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
The PerlMonks site front end has:

Results (21 votes). Check out past polls.

Notices?
 • erzuuli ‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.