This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
haas:spring2019:unix:projects:pct1 [2019/04/29 22:07] – created wedge | haas:spring2019:unix:projects:pct1 [2019/04/29 22:46] (current) – [Background] wedge | ||
---|---|---|---|
Line 4: | Line 4: | ||
</ | </ | ||
- | ======Project: | + | ======Project: |
=====Errata===== | =====Errata===== | ||
Line 11: | Line 11: | ||
=====Objective===== | =====Objective===== | ||
- | To continue to cultivate your problem solving, critical thinking, analytical, and observation skills; to apply your skills on the UNIX command-line. | + | To continue to cultivate your problem solving, critical thinking, analytical, and observation skills. |
The aim here is on observation, | The aim here is on observation, | ||
Line 19: | Line 19: | ||
This project puts you in contact with such endeavours. | This project puts you in contact with such endeavours. | ||
+ | We ramp up the abstraction a bit by altering the number base involved. No longer can you assume decimal values. Be on the lookout for specified bases, and solve in accordance with the available counting digits in that number base. | ||
====Long Division==== | ====Long Division==== | ||
Letter division is a category of logic problem where you would take an ordinary math equation (in long form), and substitute all the numbers for letters, thereby in a direct sense masking the numeric values present that correctly enable the problem to work from start to completion. It is your task, through exploring, experimenting, | Letter division is a category of logic problem where you would take an ordinary math equation (in long form), and substitute all the numbers for letters, thereby in a direct sense masking the numeric values present that correctly enable the problem to work from start to completion. It is your task, through exploring, experimenting, | ||
Line 133: | Line 134: | ||
Then, as I figure things out (either what certain are, but mostly, which ones they are NOT), I can mark it up accordingly. | Then, as I figure things out (either what certain are, but mostly, which ones they are NOT), I can mark it up accordingly. | ||
+ | ===Determining B and I from initial glances=== | ||
Right from the start, we can already make some important connections: | Right from the start, we can already make some important connections: | ||
Line 183: | Line 185: | ||
</ | </ | ||
+ | ===Whittling down K and T=== | ||
- | + | We also have a lead on K, thanks to two identical subtractions taking place, in the top term: | |
- | Now, FURTHERMORE, | + | |
- | + | ||
- | * O < L, but also: L < J | + | |
- | * L < J, but also: J < K | + | |
- | + | ||
- | That implies | + | |
- | + | ||
- | * O < L < J < K | + | |
- | + | ||
- | So from that initial observation and connection, we now have two disconnected relationships: | + | |
- | + | ||
- | * V < G | + | |
- | * O < L < J < K | + | |
- | + | ||
- | From what we've done so far, we do not know where V,G fall in respect to O,L,J,K. They might be less than, OR greater than. We won't know without further information. | + | |
- | + | ||
- | Yet, even WITH this information, | + | |
- | + | ||
- | * since V is less than G, we know V can NOT be 9. | + | |
- | * similarly, G can NOT be 0. | + | |
- | * O cannot be 9, 8, 7, because we know O is 3 less than K. So even though we don't know what K actually is, because K COULD be 9, we know what O, L, and J can NOT be. | + | |
- | * L cannot be 9 or 8 | + | |
- | * J cannot be 9 | + | |
- | * on the other side, K cannot be 0, 1, or 2 | + | |
- | * J cannot be 0 or 1 | + | |
- | * L cannot be 0. | + | |
- | + | ||
- | So, if we update our range chart accordingly: | + | |
< | < | ||
- | B = { 0, 1, 2, 3, 4, 5, 6, 7, 8 } | + | KK |
- | G = { 1, 2, 3, 4, 5, 6, 7, 8, 9 } | + | TT |
- | J = { 2, 3, 4, 5, 6, 7, 8, } | + | == |
- | K = { 3, 4, 5, 6, 7, 8, 9 } | + | |
- | L = { 1, 2, 3, 4, 5, 6, 7, } | + | |
- | M = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } | + | |
- | O = { 0, 1, 2, 3, 4, 5, 6, } | + | |
- | P = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } | + | |
- | R = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } | + | |
- | V = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } | + | |
</ | </ | ||
- | Moving on, dealing with details of discovering those one-off relations, | + | See that? While in isolation, we don't have any clear read on K's relationship to T (we don't immediately know if the leftmost E-Z=T is being taken from), from these two identical examples, we can now tell: |
- | * L is less than K (which we actually know to be 2 less than K), so L - K needs to BORROW | + | * T << K, because if K was less than T, it would need to borrow, and because the rightmost |
- | * J is less than K (which we know is 1 less than K), so J - K needs to BORROW | + | * similarly, Y << K. |
- | * V is apparently also less than K (which we didn't previously know), so V - K needs to BORROW | + | |
- | * now knowing than V << K, we can connect our other relational fragment in (I use the double '<<' to denote "less than" by an unknown amount, because while we know V is less than K, we don't know by how much). | + | |
- | So: V < G << O < L < J < K | + | This causes some updates in our relational chains: |
- | This allows us some further whittling of our ranges: | + | * Z << E |
+ | * T << E | ||
+ | * X << Y << K | ||
+ | * T << Y << K | ||
- | * V cannot be 9, 8, 7, 6, or 5 | + | In our chart, T cannot be 7, 6, or 5 (since there are now THREE identified values greater than T- E, Y, and K). |
- | * G cannot be 9, 8, 7, or 6 | + | |
- | * O cannot be 0, or 1 | + | |
- | * L cannot be 0, 1, or 2 | + | |
- | * J cannot be 0, 1, 2, or 3 | + | |
- | * K cannot be 0, 1, 2, 3, or 4 | + | |
- | < | + | Also, K is not 2, 3, or 4, due to there being three values less than K- T, X, and Y. |
- | B = { 0, 1, 2, 3, 4, 5, 6, 7, 8 } | + | |
- | G = { 1, 2, 3, 4, 5, } | + | |
- | J = { 4, 5, 6, 7, 8, } | + | |
- | K = { 5, 6, 7, 8, 9 } | + | |
- | L = { 3, 4, 5, 6, 7, } | + | |
- | M = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } | + | |
- | O = { 2, 3, 4, 5, 6, } | + | |
- | P = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } | + | |
- | R = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } | + | |
- | V = { 0, 1, 2, 3, 4, } | + | |
- | </ | + | |
- | Already we can see that V and G are likely lower numbers, and O, L, J, and K are likely higher numbers. | + | Even though T is less than E, we do not know E's relationship to Y or K (it could be greater than K or it could be less than K), so we cannot act on that particular facet of the problem yet. |
- | What else do we have? Let's keep going: | + | The updated chart: |
- | + | ||
- | We cannot instantly proceed to the next subtraction in as obvious a progression, | + | |
- | + | ||
- | ===Finding K (and J and L and O as well)=== | + | |
- | + | ||
- | However, looking at the puzzle, I'm interested in seeing if we can find any obvious examples of 0. You know, letter minus same letter sort of things. Because they will typically end up equalling 0 (or 9). | + | |
- | + | ||
- | Why 9? Because of a borrow! | + | |
- | + | ||
- | ((5-1)+10)-5 = (4+10)-5 = 14 - 5 = 9 | + | |
- | + | ||
- | ... that can be quite revealing too! | + | |
- | + | ||
- | And it would appear we have one wonderful candidate in the bottom-most subtraction: | + | |
< | < | ||
- | KVRMR | + | B = { 1 } |
- | | + | E = { 4, 5, 6, 7 } |
- | | + | I = { 0 } |
- | VKMK | + | K = { 5, 6, 7 } |
+ | T = { 2, 3, 4 } | ||
+ | X = { 2, 3, 4, 5, 6 } | ||
+ | Y = { 4, 5, 6, 7 } | ||
+ | Z = { 2, 3, 4, 5, 6 } | ||
</ | </ | ||
- | Lookie there: R-R = K. | + | ===Narrowing down T and Y=== |
+ | At this point, we've largely exhausted our logical/ | ||
- | Usually, that would result in a 0. BUT, we also know that K can NOT be 0 (looking at our range table above). | + | Since B is 1, we'll skip to the Y multiplication: |
- | + | ||
- | So, that means it is being borrowed from, and it itself has to borrow, so we now also know that M is less than K (M << K). | + | |
- | + | ||
- | And, as indicated above: | + | |
- | + | ||
- | ((R-1)+10)-R = 9! | + | |
- | + | ||
- | We now know that K = 9! | + | |
- | + | ||
- | That suddenly reveals a whole lot to us, due to our relational chains | + | |
- | + | ||
- | | 0 | | | + | |
- | | 1 | | | + | |
- | | 2 | | | + | |
- | | 3 | | | + | |
- | | 4 | | | + | |
- | | 5 | | | + | |
- | | 6 | O | | + | |
- | | 7 | L | | + | |
- | | 8 | J | | + | |
- | | 9 | K | | + | |
- | + | ||
- | Also, with the new introduction of M being less than K: | + | |
< | < | ||
- | B = { 0, 1, 2, 3, 4, 5, } | + | T:2 3 4 |
- | G = { 1, 2, 3, 4, 5, } | + | xY:4 5 6 7 |
- | J = { | + | == ======== |
- | K = { 9 } | + | T:2 3 4 |
- | L = { 7 } | + | |
- | M = { 0, 1, 2, 3, 4, 5, } | + | |
- | O = { | + | |
- | P = { 0, 1, 2, 3, 4, 5, } | + | |
- | R = { 0, 1, 2, 3, 4, 5, } | + | |
- | V = { 0, 1, 2, 3, 4, } | + | |
</ | </ | ||
- | And, our relational chains: | + | Now, while this is multiplication, it is NOT decimal multiplication. We need to multiply in octal. Therefore it might help to have our multiplication tables handy for base 8 for values |
- | + | ||
- | * V < G << O < L < J < K | + | |
- | * M << O < L < J < K | + | |
- | + | ||
- | Because we don't yet know any relation of M compared to V or G, we have to keep them separate for now. | + | |
- | + | ||
- | We also have a second disqualifier for K being 0... the ones place subtraction in that bottom-most subtraction: | + | |
- | + | ||
- | R - B = K. | + | |
- | + | ||
- | There' | + | |
- | + | ||
- | * R is greater than B | + | |
- | * R is less than B | + | |
- | + | ||
- | Since we know that K is 9, there' | + | |
- | + | ||
- | * R is less than B (R << B) | + | |
- | + | ||
- | Currently both R and B can be 0-5 (although now, B is 1-5, and R is 0-4). We' | + | |
- | ^ R: 0 ^ R: 1 ^ R: 2 ^ R: 3 ^ R: 4 | | + | |
- | | (0+10) | + | |
- | | 10 | 11 | 12 | 13 | 14 | | + | |
- | + | ||
- | And from that, we're subtracting B, which is 1, 2, 3, 4, or 5. The answer has to be 9. | + | |
- | + | ||
- | So: | + | |
- | + | ||
- | 10-1=9, 11-2=9, 12-3=9, 13-4=9, and 14-5=9 | + | |
- | + | ||
- | Hey, look at that... B is one greater than R (not just R << B, BUT: R < B) | + | |
- | + | ||
- | Our relational chains: | + | |
- | + | ||
- | * V < G << O < L < J < K | + | |
- | * M << O < L < J < K | + | |
- | * R < B << O < L < J < K | + | |
- | + | ||
- | And our chart, of sorts: | + | |
< | < | ||
- | B = { 1, 2, 3, 4, 5, } | + | |
- | G = { 1, 2, 3, 4, 5, } | + | |
- | J = { | + | |
- | K = { 9 } | + | |
- | L = { 7 } | + | |
- | M = { 0, 1, 2, 3, 4, 5, } | + | 5 | 12 17 24 31 36 43 |
- | O = { 6 } | + | 6 | 14 22 30 36 44 52 |
- | P = { 0, 1, 2, 3, 4, 5, } | + | 7 | 16 25 34 43 52 61 |
- | R = { 0, 1, 2, 3, 4, } | + | |
- | V = { 0, 1, 2, 3, 4, } | + | |
</ | </ | ||
- | If you look, the only letter we've not yet directly interacted with yet is 'P', | + | Okay, checking each possibility for TxY=T (first value needs to equal one's place of result): |
+ | * 2x4 = 10 (one's place is not a 2, so this isn' | ||
+ | * 2x5 = 12 (a possibility!) | ||
+ | * 2x6 = 14 (nope) | ||
+ | * 2x7 = 16 (nope) | ||
+ | * 3x4 = 14 (nope) | ||
+ | * 3x5 = 17 (nope) | ||
+ | * 3x6 = 22 (a possibility!) | ||
+ | * 3x7 = 25 (nope) | ||
+ | * 4x4 = 20 (nope; also, not possible, since T and Y cannot be the same value) | ||
+ | * 4x5 = 24 (nope) | ||
+ | * 4x6 = 30 (nope) | ||
+ | * 4x7 = 34 (nope) | ||
- | Let's continue on: | + | Out of twelve possible multiplications, |
- | M-K=M, BECAUSE | + | That means we can eliminate some values: |
+ | * T can NOT be 4 | ||
+ | * Y can NOT be 4 or 7 | ||
- | Can't really do much more with it at this point, but it is important to know to help us identify the borrows needing to happen. | + | Updating |
- | + | ||
- | ===Finding | + | |
- | + | ||
- | Why don't we go ahead and find 0? If you look in the subtraction above the bottom one, we have another " | + | |
< | < | ||
- | JJGKL | + | B = { 1 } |
- | -LKBKV | + | E = { 4, 5, 6, 7 } |
- | ===== | + | I = { 0 } |
- | KVRM | + | K = { 5, 6, 7 } |
+ | T = { 2, 3 } | ||
+ | X = { 2, 3, 4, 5, 6 } | ||
+ | Y = { 5, 6 } | ||
+ | Z = { 2, 3, 4, 5, 6 } | ||
</ | </ | ||
- | We KNOW that V << L, so no borrow is happening there. | + | ===Finding K, T, and Y=== |
+ | With a reduced set of values, we can revisit one of our subtractions, | ||
- | Therefore, K-K, or 9-9, equals 0. So R is 0! | + | * K can be 5, 6, or 7 |
+ | * T can be 2 or 3 | ||
+ | * Y can be 5 or 6 | ||
- | ... and B is 1! Because of our identified relationship. | + | So let us try every possible subtraction combination: |
- | Updating things! | + | * 5-2=3 (nope; 3 is not a possible Y value) |
+ | * 5-3=2 (nope) | ||
+ | * 6-2=4 (nope) | ||
+ | * 6-3=3 (nope; also T and Y cannot be the same) | ||
+ | * 7-2=5 (possibility!) | ||
+ | * 7-3=4 (nope) | ||
- | | 0 | R | | + | And lookie here! The ONLY identified possibility occurs when K is 7, T is 2, and Y is 5! Let's update our chart accordingly: |
- | | 1 | B | | + | |
- | | 2 | | | + | |
- | | 3 | | | + | |
- | | 4 | | | + | |
- | | 5 | | | + | |
- | | 6 | O | | + | |
- | | 7 | L | | + | |
- | | 8 | J | | + | |
- | | 9 | | + | |
- | + | ||
- | Also, with the new introduction of M being less than K: | + | |
< | < | ||
- | B = { 1 | + | B = { 1 |
- | G = { | + | E = { |
- | J = { 8 | + | I = { 0 |
- | K = { 9 } | + | K = { 7 } |
- | L = { 7 | + | T = { |
- | M = { 2, 3, 4, 5, | + | X = { 3, 4, |
- | O = { 6 } | + | Y = { |
- | P = { | + | Z = { 3, 4, |
- | R = { 0 | + | |
- | V = { 2, 3, 4, | + | |
</ | </ | ||
- | *NOTE: G is NOT 2, because G is greater than V (one greater, in fact), so we can similarly whittle that off. | + | ===Finding E and Z=== |
+ | Further optimizations are possible: | ||
- | Relational chains | + | * because we know that Z << E, Z can NOT by 6. |
+ | * 4-3=1, 4-4=0, neither of which are 2 (T). | ||
+ | * 6-3=3 (no), 6-4=2 (yes) | ||
- | * R < B << V < G << O < L < J < K | + | So, we can identify E as 6, and Z as 4. The chart: |
- | * R < B << M << O < L < J < K | + | |
- | * R < B << P << O < L < J < K | + | |
- | + | ||
- | Basically just down to V, G, P, and M. | + | |
- | + | ||
- | ===Finding V and G=== | + | |
- | + | ||
- | And I think we have the means to find V: notice the second to last subtraction, the " | + | |
- | + | ||
- | We KNOW the numeric values of K and J, in fact we know the values of L, K, and B. The only thing we don't know is ' | + | |
- | + | ||
- | KJKK = 9899 | + | |
- | J = 8 | + | |
- | + | ||
- | So: 9899 x 8 = 79192 = LKBKV! | + | |
- | + | ||
- | V is 2! | + | |
- | + | ||
- | Which means, because V < G, that G is 3! | + | |
- | + | ||
- | Updating our records: | + | |
- | + | ||
- | | 0 | R | | + | |
- | | 1 | B | | + | |
- | | 2 | V | | + | |
- | | 3 | G | | + | |
- | | 4 | | | + | |
- | | 5 | | | + | |
- | | 6 | O | | + | |
- | | 7 | L | | + | |
- | | 8 | J | | + | |
- | | 9 | K | | + | |
- | + | ||
- | Also, with the new introduction of M being less than K: | + | |
< | < | ||
- | B = { 1 | + | B = { 1 |
- | G = { | + | E = { 6 |
- | J = { 8 | + | I = { 0 |
- | K = { | + | K = { |
- | L = { | + | T = { 2 |
- | M = { 4, 5, } | + | X = { 3, } |
- | O = { 6 | + | Y = { |
- | P = { 4, 5, } | + | Z = { |
- | R = { 0 } | + | |
- | V = { | + | |
</ | </ | ||
- | Relational chains can look as follows now: | + | ===Finding X (due to eliminating any other possibilities)=== |
- | * R < B < V < G << M << O < L < J < K | + | That leaves no other possibilities for X, placing it at 3. |
- | * R < B < V < G << P << O < L < J < K | + | |
- | ===Finding M and discovering P=== | + | Our key: |
- | And then there were 2. We really just need to find M, or P, and we're done. And since there are no ' | + | | 0 | |
- | + | ||
- | Hey, how about this: | + | |
- | + | ||
- | < | + | |
- | JJGKL | + | |
- | | + | |
- | ===== | + | |
- | | + | |
- | </ | + | |
- | + | ||
- | One's place subtraction: | + | |
- | + | ||
- | We KNOW L (7) is greater than V (2), so no borrow is happening. | + | |
- | + | ||
- | L-V=M | + | |
- | 7-2=5 | + | |
- | + | ||
- | M is 5. That means P is 4 by process of elimination. | + | |
- | + | ||
- | Puzzle completed: | + | |
- | + | ||
- | | 0 | | + | |
| 1 | B | | | 1 | B | | ||
- | | 2 | | + | | 2 | |
- | | 3 | | + | | 3 | |
- | | 4 | | + | | 4 | |
- | | 5 | | + | | 5 | |
- | | 6 | | + | | 6 | |
- | | 7 | + | | 7 | K | |
- | | 8 | J | | + | |
- | | 9 | + | |
- | + | ||
- | Also, with the new introduction of M being less than K: | + | |
- | + | ||
- | < | + | |
- | B = { 1 } | + | |
- | G = { 3 } | + | |
- | J = { | + | |
- | K = { 9 } | + | |
- | L = { 7 } | + | |
- | M = { 5 } | + | |
- | O = { | + | |
- | P = { | + | |
- | R = { 0 } | + | |
- | V = { | + | |
- | </ | + | |
- | + | ||
- | Relational chains can look as follows now: | + | |
- | + | ||
- | * R < B < V < G < P < M < O < L < J < K | + | |
- | + | ||
- | I wasn't able to show it as well in text on the wiki, but I also made a point to mark up each subtraction to show whether a borrow occurred or not: | + | |
- | + | ||
- | {{ : | + | |
To be sure, there are likely MANY, MANY ways to arrive at these conclusions. What is important is being observant, performing little experiments, | To be sure, there are likely MANY, MANY ways to arrive at these conclusions. What is important is being observant, performing little experiments, | ||
Your performance on this project will be directly tied to being able to document your process through the puzzle; I have provided this writeup in order to show you an example of what that process may look like. | Your performance on this project will be directly tied to being able to document your process through the puzzle; I have provided this writeup in order to show you an example of what that process may look like. | ||
+ | |||
=====Getting started===== | =====Getting started===== | ||
- | In the **pct0/** sub-directory of the UNIX Public Directory, under a directory by the name of your username, you will find the following files: | + | In the **pct1/** sub-directory of the UNIX Public Directory, under a directory by the name of your username, you will find the following files: |
* **bonus** | * **bonus** | ||
Line 650: | Line 454: | ||
If you have a match, congratulations, | If you have a match, congratulations, | ||
+ | |||
=====Submission===== | =====Submission===== | ||
By successfully performing this project, you should be submitting files that satisfy the following requirements: | By successfully performing this project, you should be submitting files that satisfy the following requirements: | ||
Line 663: | Line 468: | ||
<cli> | <cli> | ||
- | $ submit unix pct0 puzzle.key puzzle.solution | + | $ submit unix pct1 puzzle.key puzzle.solution |
- | Submitting unix project "pct0": | + | Submitting unix project "pct1": |
-> puzzle.key(OK) | -> puzzle.key(OK) | ||
-> puzzle.solution(OK) | -> puzzle.solution(OK) | ||
Line 674: | Line 479: | ||
<cli> | <cli> | ||
- | $ submit unix pct0 puzzle.key puzzle.solution bonus.key bonus.solution | + | $ submit unix pct1 puzzle.key puzzle.solution bonus.key bonus.solution |
- | Submitting unix project "pct0": | + | Submitting unix project "pct1": |
-> puzzle.key(OK) | -> puzzle.key(OK) | ||
-> puzzle.solution(OK) | -> puzzle.solution(OK) |