Draco Torre

David G Shrock

Draco Calculation Update: No Ads

Update to Draco Calculation v1.05 removes ads and improves hint suggestion quality. Still free.

DracoCalcIcon 200

Since iAd will be closing down soon, and I have no intentions on using an alternative ad provider, I removed ads. The primary reason I implemented iAd was for the experience and secondarily to help pay license fees. The AI improvements for suggestions address several cases playing to the tableau that might block future play. My goal for the AI is to play better than a beginner, and not nearly as good as an expert. Suggestions should be learning opportunities for beginners without becoming a crutch or giving away advanced strategy. There’s room for more improvement, but I believe the AI has reached my goal.

Thanks for playing.

Prime Factors Problem 2: Largest Prime Factor

Like the previous problem, this problem comes from ProjectEuler.net, “Problem 3”.

Find the largest prime factor of 600,851,475,143.

Now that’s a big number. Test your code with smaller values that you can calculate or look up. “Problem 3” states the largest prime factor of 13,195 is 29, a good test case. Finding primes can take time, so we’ll need to consider our method before tackling 600,851,475,143. There’s some fancy algorithms you could find online, but try it on your own. This makes for a decent software engineer interview question, or just for fun.

Give it a try before looking at my process or solution. Write a function to calculate the largest prime factor of a natural number.

Prime Factors Problem 1: LCM

I’ve been looking over ProjectEuler.net and found a few fun problems involving factoring and prime numbers. This first one is easy for computer and math geeks, but should be do-able by anyone with a calculator and a recollection of factoring. I’ll go through it step-by-step.

Find the smallest number divisible by all integers between 1 and n, where n > 2.

This is based on “Problem 5” of Project Euler, but before you look at the page, first try attacking an easy case. When n is 3, it’s painfully easy. 1 x 2 x 3 = 6, so 6 is is it. Try an interesting value. Let n = 10.

What is the smallest number divisible by all integers between 1 and 10?

Go ahead and think about how you might solve this. (Hint: title of this post.)

Programming Problem: Single-Edit Difference

This question is based on a problem found in Cracking the Coding Interview by Gayle Laakmann McDowell which contians nearly 200 problems.

Test if two strings are different by only a single-character edit.

An edit is defined as an inserted character, deleted character, or replaced character. Note that zero edits (same string) counts as a character replacement where the replaced character is the same. In other words, can you add a character, remove a character, or replace a character to result in the other string?

  • “save” and “safe” = true
  • “Mark Henry” and “MaRk Henry” = true
  • “sve” and “save” = true
  • “sve” and “saVe” = false

Give it a try in your preferred language then check out my solution below. In an interview, you may want to quickly go over any assumptions or observations before writing code.

assumptions

  • An empty string is acceptable.
  • The length of a string is manageable and reasonably short for our system.

observations

  • Difference in text length greater than one require more than one edit.
  • Cases to consider: insert, remove, replace.
  • Insert is the same as remove in reverse.

Setup for Script Work with Bethesda’s Creation Kit and Notepad++

Get setup for working on scripts and scripting events for TES V: Skyrim and Fallout 4 by Bethesda Game Studios using Creation Kit and Notepad++. For scripting the Creation Kit uses “Papyrus” scripting system, and you’ll need to setup for working with the “Papyrus Compiler.” Instead of working on scripts within the Creation Kit, you may find it preferable to work an external editor like Notepad++. Sublime and Visual Studio Code also support “Papyrus” syntax highlighting. Many scripts for Skyrim may also work for Fallout 4. Review the differences on this Creation Kit wiki article.

Resources:

Familiarity with using the command prompt, archive utilities, batch files, and some scripting or programming experience is assumed. The following example is for Skyrim.

Source files and compiler setup

You’ll need the game’s Papyrus source files (extension psc) and the “Papyrus Compiler” found with Creation Kit. (And the game, of course.) You may want to backup your game’s data files in case something gets overwritten, or a mod plugin stops working correctly.

If you haven’t yet, install Creation Kit which can be found in Steam by selecting Library and Tools in the drop-down. Find “Skyrim Creation Kit” and install. In the instructions below, if you need help finding your game folder, in Steam right-click the game, select properties, view “Local Files” tab and click “Browse Local Files” button.