r/PowerShell • u/mdowst • Sep 18 '19
Parenting Through PowerShell
My 8 year old decided to pretend to be sick so he would get sent home from school the other day. So after we finished all the work the teach gave us, I decided to make him some extra work. Since they are learning double digit addition I wrote a quick script that will generate a page with 25 problems on it. I kept printing him off new sheets until the end of the regular school day.
I thought I'd share it in case anyone else has a 2nd grader who likes to play hooky. https://www.dowst.dev/homework-double-digit-addition-without-carrying/
Does anyone else have any examples of parenting through PowerShell?
229
Upvotes
2
u/ka-splam Sep 19 '19 edited Sep 19 '19
Lol, I think I'm going mad spending so long trying to get this version working!
It's fun though, in a way, like Regex is fun!
If this is the first nine numbers:
Then this is the addition table of each one, with each one:
And this is a bitmap on that table, of all the places where 10> value shown by a 1 (true), and 0 (false):
And this is the coordinates (x, y) indexes into the matrix, where the 1 values are:
So those are all the pairs where the single digit addition would still be a single digit answer, no carrying. Smaller, simpler version.
Putting the same thing on both sides of a function can use
⍨to echo it to both sides so(⍳9) ∘.+ (⍳9)->∘.+⍨ (⍳9)and the parens don't do anything there, so they can go..Isn't there a certain regex-style novelty there?