Low Drag

Thoughts on things during my lifelong pursuit for zero friction – high speed, low drag.

Read this first

Swift — Twin Peaks

Objective: Character collects all gems until count is equal to randomized total, while expert moves platform as needed.
FCD9951B-4132-49B9-BF76-01BB932ADC84.png

Not only was this a very challenging level, utilizing all skills practiced until now, it also tested some erroneous assumptions I falsely introduced.

At first, I assumed that gems may also appear along the entire length of the platform, which they did not; gems only ever appeared on the ends.

Secondly, I assumed platform must be raised to an even level with each row, which it does not; only must get within jumping level. (Thanks, Samantha!)

Difference between mine and hers? 47 lines vs 31 — mine has 50% more!!

My solution

let expert = Expert()
let character = Character()
var gemCount = 0
world.place (expert, facing: north, atColumn:1, row:3)
world.place (character, facing: north, atColumn:5, row:0)
func rowRun() {
for i in 1…6 {
if...

Continue reading →


Swift — Rivers to Cross

Objective: Place monster on a specific square and facing a specific direction, and then complete the maze by collecting all gems.
1BBC9703-A4DE-4DFC-9DB4-48954FABB4A8.png

I didn’t much issues with this one, and so I challenged myself to recreate entirely new algorithm using less code — did it with 25% less lines!

Take 1

let expert = Expert()
world.place (expert, facing: .south, atColumn:1, row:8)
func gemGoLock() {
for i in 1…4 {
expert.collectGem()
expert.moveForward()
}
}
gemGoLock()
expert.turnLockDown()
expert.turnLeft()
gemGoLock()
expert.turnLockUp()
expert.turnRight()
gemGoLock()
expert.collectGem()

Take 2

let expert = Expert()
world.place (expert, facing: .south, atColumn:1, row:8)
for i in 1…12 {
expert.collectGem()
expert.moveForward()
if expert.isBlocked && expert.isBlockedRight {
expert.turnLockDown()
expert.turnLeft()
}
if expert.isBlocked &&amp...

Continue reading →


Swift — Crank Up and Down

Objective: Initialize two monsters, then have one collect all gems with the other moving platforms up and down as needed.
E3D759B1-6AD6-4708-875A-D00949294A2F.png

My assumption was to start with top left gems and then move down to lower level before finishing with far right top level. A bit heavy handed when it came to running the code — do this, then do that — with far less func’s than I’d preferred.

I suspected there was a better way, and this solution proves it. By completing the entire top level first and then moving down to complete the lower level it’s possible to complete with 30% less code!

My solution

let expert = Expert()
let character = Character()
func turnLock(up:Bool, turns: Int) {
if up == true {
for i in 1…turns {
expert.turnLockUp()
}
} else {
for i in 1…turns {
expert.turnLockDown()
}
}
expert.turnRight()
}
func getGem(move: Int) {
...

Continue reading →


Swift — Random Gems Everywhere

This was a harsh level that took me forever to solve. I eked out a decent solution in 41 lines of code, but I knew it could be done better.

I sought out other solutions to appreciate different perspectives. One came in at 25% less lines of code, but the solution by Takemichi Shibuya was humbling with less than HALF my total lines of code. (Phew!) Impressive.

Takemichi taught me how complicated my mindset was, and that a truly simple solution was there if I removed some assumptions I created.

Objective: Turn each portal on and off as needed to get all gems.
5BA60680-BDD4-4D4D-98FD-DA529A00A025.png

My solution

let totalGems = randomNumberOfGems
var gemCount = 0
var stepCount = 0
func turnAround() {
turnLeft()
turnLeft()
moveForward()
}
func getGem() {
collectGem()
gemCount += 1
}
func stepForward() {
moveForward()
stepCount += 1
}
while gemCount <= totalGems {
stepForward()
getGem()
...

Continue reading →


Swift — Corners of the World

This was the first level to truly stump me. Since I couldn’t come up with a solution myself, I turned to others. Below are two that helped me out.

The lesson I took away from this is that it’s not just the item needed to do an action to (ie get a gem or toggle a switch), but rather take a step back and see that all that’s needed is to get to a square and then do something to whatever is on that square. It’s more conceptual, but it helps to remove the barrier of distraction focusing on the things vs patterns of movement.

Objective: Turn each portal on and off as needed to retrieve all gems and turn each switch on, preferably by finding and utilizing a uniform pattern.

1C2D9258-DEBC-4735-8E0E-D1B120E8A2AE.png

Solution 1, courtesy of Jyjy Game

func turnAround () {
turnLeft()
turnLeft()
}
func collectToggle () {
if isOnGem {
collectGem()
} else if isOnClosedSwitch {
toggleSwitch()
}
}
func...

Continue reading →


Swift — It Takes Two

This was a challenging level which initially stumped me when I tried to puzzle it out in my head before writing a line of code.

To overcome this, I resigned to first just write out every single action line by line and then reviewed my code to look for patterns — which I then turned in to functions. My code came out to 49 lines (below).

I then searched for another solution that may be more efficient.

This one was built in 33 lines — and reminded me to utilize for i in 1…X with a puzzle like this one that has a known area to navigate.

Objective: Create two monsters; one to turn locks for moving platforms up or down, and the other to do actions on each — get gem or toggle switch.
0390972D-55FF-4068-B83F-AF3F33725EC0.png

let expert = Expert()
let character = Character()
var itemCount = 0
func gemSwitch() {
character.moveForward()
character.moveForward()
if character.isOnGem {
itemCount += 1
chara...

Continue reading →


tiny dreams

We must all live even our tiniest dreams, since fulfilling dreams compounds. To ge the big dreams you have to be able to reach for, accept and allow yourself to have those bigger dreams later on down the line.

It’s not that we can’t have it all; just not all at once. Eventually, you can have everything you want. Just start with what you want right now, and what’s most able to be had.

Good luck getting your dreams out there, folks.

View →


My Ideal Day, Everyday

You know that really great feeling at the end of a day when things could not have gone more perfect?

Maybe it was the weather or a reandom interaction, but often times I feel like the various parts of my day just clicked together in the right way.

It occurred to me last Fall that maybe I could have more perfect days if I just knew what to schedule. So I did. Just like Benjamin Franklin, I mapped out my ideal day.
IMG_0135.PNG

In doing so, I realized that my day wasn’t ideal unless I started it off right by having an hour or so of quiet time to myself. Having two kids is incredibly demanding, but still the best job in the world. By getting some alone time before the chaos ensues really helps anchor me for whatever comes later.

I also found that if I can get one key work thing done before the family wakes up, I don’t feel so pressured during the later work sessions. Things always seem crop up at...

Continue reading →


Yoga Craving

A funny thing happened this morning: I did yoga all on my own; my body craved it.

It hasn’t been long since I took a renewed commitment to go to a single class per week, and yet my body is already naturally calling for it more frequently after merely 6 weeks or so.

Over the past few months I’ve been fighting pneumonia, losing 21 pounds (yay!), and struggling to keep it off. Yoga was one way.

Some may say that’s a ridiculous goal, but I made such a small commitment because I knew I could keep it.

This idea of making an incredibly small goal that could easily be accomplished with little to no effort was influenced by Leo Babuta:

Take an action, no matter how tiny.
You don’t need to fix everything in your life right now. You don’t even need to fix one thing.
You just need to do one little, minuscule, almost nothing thing.

Essentially, create a goal so small you could step over it...

Continue reading →


1st Day of Not Surfing

What I learned after resigning to not stand up and just belly board for an entire session.

I love experimenting with constraints, and discovering what results when a key component is removed from a process.

Today, I removed the standing up in surfing, based on advice heard from an old friend, and had the best session of my short time surfing!

  1. Start with the right beach at the right time, with waves that are fit for your level.

  2. Anyone can catch a wave. Just takes a try.

  3. Don’t wait for the perfect wave, take a shot at every one you think is decent. If they turn out bad, you’ll have learned.

  4. Don’t aim for all, aim for best (for you). You can’t get ‘em all, but you have some.

  5. Your position makes every wave look different, and can even trump experience. Look for your best spot out there.

  6. Watch someone a bit better than you, position yourself a bit closer to shore & go when they go...

Continue reading →