#Switching Name Order Using Capturing Groups in Regular Expressions
Explore tagged Tumblr posts
Text
Switching Name Order Using Capturing Groups in Regular Expressions
In this article, we are going to see how we to do Switching Name Order Using Capturing Groups in Regular Expressions. So we will have an array of name where we have some values, and we will use a regular expression to exchange their positions. There are multiple possibilities to make this thing happen, but we are going to see a very good method to get optimal solution. Solution: Okay now lets…
View On WordPress
0 notes
Text
Maria Black - Harry Potter OC
Introduction:
This is my HP OC that I created a long time ago, when I was around 12-13 y.o. (so, you know... it’s been a while!)
Over the years I’ve developed her story more and more, changed it as I got older and basically kept the headcanon alive for years - but I never wrote about her. Everything I had I kept inside my head, and all the potential stories remained as nothing but a day-dream.
Until today! (or a few days ago, when I came up with the idea.)
It’s time to document this headcanon, even if it’s not going anywhere serious other than some stories and drawings.
I can’t emphasize it enough - I made most of it during the mid/late 2000′s, waaaay before the Cursed Child. So please don’t associate any part of my HC with this terrible excuse of a canon. JKR already proved that her judgement is questionable, so for me the only thing that is canon are the books and my headcanon relates to them and nothing else!
Anyway, let’s dive in!
-------------------------------------------------------
-------------------------------------------------------
Bonus drawing from baby-OP:
-------------------------------------------------------
General plot:
Maria is the daughter of the Bellatrix and Rodolphus Lestrange and was born a few months before they were sent to Azkaban. Her aunt Narcissa took her in and she was raised by the Malfoy family.
When she was about 5/6 y.o., she went to Azkaban to see her mother. (in the headcanon, her father died in Azkaban). She got scared by the Dementors and when she tried to find the exit, she came upon Sirius’ cell. This encounter changed her life and made her realize that her family is one of the “bad guys”, and she’s decided to leave the first chance she gets.
The day she left to Hogwarts was the last day she spent with her family.
Since it’s a HP OC-insert kind of headcanon, she befriended Harry, Ron and Hermione and was practically the 4th member of this friend group. So most of the plot of the headcanon correlates with the plots of the books, so I’m going to focus more on the individual parts that doesn’t relate the regular plot.
Before she got to Hogwarts she asked to be referred to as Maria Black and not Maria Lestrange. In the future she’d also legally change her name.
Because she’s decided to never go back to the Malfoys ever again, she was basically homeless for the first two summers away from Hogwarts. She mostly relied on magic (around other wizards, so no one will know she’s a minor using magic) and some friends that let her stay with them every once in a while.
(The is a LOT more, so if you’re interested, keep reading ^^ )
After the 3rd year was over, one of her friends that was an exchange student from Beauxbatons, invited her to spend the summer at his house in France. The reason he wanted her to come over was because his father was a coach for the French junior-league Quidditch team and wanted him to let her into the team, so in the future she’d be able to become a professional player. He knew that she plans on filing for Emancipation of minors, that will strip all the legal rights from her family and free her from them - but for that she needed a sufficient income. Her friend’s father was glad to help and after she showed him her skills, he let her into the team. When she was 15, she got into the professional league. (I based this part of the HC on the fact that Viktor Krum was also a student, when he became a Quidditch star.)
Sirius was the most important figure in her life and became like a father figure to her. Through him, she also felt that Harry and her (although not by blood) were related.
For a long time, the ending of the headcanon was that Maria killed herself after Sirius was murdered, but in recent years I’ve reversed this decision and kept her alive for the duration of the book and beyond that.
During her 6th year, after her mother already escaped Azkaban, she was forced to hide in Hogwarts (she wasn’t allowed to keep her role in the Quidditch team anymore), because Bellatrix made it clear that she’s going to kidnap Maria and force her to join Voldemort’s side.
She was able to avoid this fate only up to the plot of the 7th book, that’s when she was finally captured and held hostage in an attempt to force Harry’s hands and save her. However, before she was kidnapped, Maria asked from the Order and Hermione that if she’s ever to fall captive, to prevent Harry from saving her at all cost, since it’s an obvious trap.
Frustrated by the fact that the trap hasn’t worked combined with Maria’s general resistance, Bellatrix tortured her daughter for the entire duration of her incarceration, mostly by using the Cruciatus curse on her over and over again. At a near-dead state, Bellatrix used the Imperius curse on her to try and make her fight on Voldemort’s side at the Battle of Hogwarts, but Maria was too weak and wasn’t much of use to her in the end.
After the fight, Maria was in a coma for a few months and even after she woke up, she had a very long recovery period. The worst expression of it manifested in her PTSD from the Cruciatus curse that caused her to scream in agony almost every time she went to sleep. At some cases she was in such bad shape that no one was able to wake her up.
After a partial recovery, she returned to her pending career as a Quiddich player.
Her relationship with Fred Weasley:
Maria was fairly popular and had dated a few people (in a non-serious way, due to her age), but her first love was Fred Weasley. They’ve started dating in secret when she was in her 5th year.
During the 6th year, she has prepared him for the possibility of the kidnapping and asked him not to come rescue her if it ever happened.
In the summer after her 6th year, to reassure her that they will both survive the war, Fred gave her a ring and told her that after it’s all over, they’ll get married. (It wasn’t a proposal per se, but an attempt to give her hope when she was sure she’s going to die.)
Maria wasn’t aware that Fred died since she almost met the same fate herself at the Battle of Hogwarts, and found out about it from George after she woke up from the coma.
Her relationship with Neville Longbottom:
At the beginning, no one knew she’s Bellatrix’s daughter. People were suspicious of her during year 3 (after all, she is Maria Black) because they thought she was assisting Sirius (and at some point there were rumors that she was his secret child), but it wasn’t until year 5 that the news about her being Bellatrix’s daughter has spread out by Malfoy.
Maria considered Neville a close friend and was afraid of his reaction once he finds out, but even though he had to get over the initial shock, he told her that he knows that she’s nothing like her mother, that she has proven she’s on their side and that he’s not going to judge her over something that is out of her control.
After the Battle of Hogwarts, during her recovery, she’s met Neville’s parents and also spent time with them while she was admitted. The fact that she was tortured by Bellatrix too was a bonding factor and made her and Neville even closer.
After a few years, Neville and Maria have started dating, but their future together in unknown.
PTSD and irreversible damage:
I mentioned that due to the torture she experienced, Maria suffered from PTSD, caused primarily by the Cruciatus curse. She would have recurrent nightmares that caused her to scream and cry in agony, as her body turned and twitched, as if she was under the curse.
In most cases people were able to wake her up, but in more severe cases, she was able to stay in that state for hours. The worst case was a day and a half without a break. She was taken to the hospital by apparition, but the snap switch in location has severely worsen the situation and she was taken to the ER (or a magical equivalent of an ER), where she was under treatment for days until the outburst finally got under control. She was in a coma for two months after that and had to go through the long recovery once more.
In addition to that, Maria also suffered an irreversible damage in her reproduction system. Bellatrix knew she doesn’t share her purist views, so to make sure she doesn’t “taint” the family legacy with a mixed-blood offspring, she completely destroyed the system, to a point that it was almost impossible to reconstruct, even with magic. Maria went through many treatments, but was eventually considered infertile.
Her relationship with the Weasley family:
Maria was accepted as one of the family back when she was still in Hogwarts.
Even though her relationship with Fred was a secret - Molly, George and Ginny knew about it. After Fred’s death, Molly has told Maria that she still views her as a daughter and said she’s always welcome at their house.
She usually spent the holidays with them and came to visit Molly and Arthur almost every weekend. She usually brought game-tickets to anyone that was interested, especially when she’s started playing for the biggest teams. (Nothing will make me do the proper research of all the Quidditch teams, so let’s just suspend our disbelief just a bit more, because I don’t have a specific name.)
Her relationship with the Malfoy family:
During the year she was Bellatrix’s prisoner, she was held captive at the Malfoys’ mansion. Even though Bellatrix showed nothing but cruelty to her, Narcissa secretly tried to help her, mostly by giving her food during starvation punishments, clean her room and at extreme circumstances - heal her wounds.
Even though she hasn’t set her free, Maria appreciated the fact that Narcissa risked herself by helping her, so after she heard about Lucius’s death, she agreed for a reconciliation.
Although there were some push-backs (especially from Ron), she accepted an invitation for dinner at the Malfoys’ mansion, where she reconnected with both Narcissa and Draco.
After that she came to visit every now and then, although not as frequently as she visited the Weasleys.
Maria and Harry:
As I mentioned before, Maria is basically an OC inserted into the main plot, so she’s best friends with Harry, Ron and Hermione.
Harry and Maria always had a sort of sibling connection, that was reinforced by their connection with Sirius. After his death, they referred to each other as the only family they’ve got left. (Even though Maria technically had Tonks, but that’s a story for another time.)
Maria and Ron:
Their friendship was a bit more complicated. Although not romantic in nature, they had a mutual crush on each other at a certain point (but nothing came out of it), and they always had a certain tension afterwards.
They also have very different personalities and got into many conflicts. Ron usually accused Maria of being a fake friend, because she was very friendly in nature and had many friend-groups other than the main three characters. Maria in return accused him of being too judgemental and had a hard time taking him seriously.
However, with all the flaws, they also had many things in common - their love of Quidditch, their disregard to the rules and in general they had a lot of fun hanging out with each other.
Maria and Hermione:
Probably have the rockiest friendship out of the three main characters. They are almost opposites, aside for their academic approach. Maria is more reckless and easy going, and she usually can’t handle Hermione’s stiffness.
Maria was especially sensitive to any criticism of Sirius, and they had many fights over it during their 5th year.
But even though their friendship wasn’t ideal, when it came to real struggles, they were there to support each other, especially emotionally.
Her special connection to Sirius:
Sirius was the catalyst that made her realize that she was born to a dark wizards family. She’s met him only once (before the events of the 3rd book), but it was a strong enough impact that affected her entire world view.
She put Sirius on a high pedestal and saw him as a parental figure. He was the first in the family to openly rebel and she followed his footsteps when she left the Malfoys’ household. This is also the reason why it meant so much to her that she was sorted into Gryffindor and not Slytherin.
During the 3rd year, everyone suspected that she helped sneak Sirius into the castle and was covering for him, since she refused to accept the accusations against him. She didn’t have any proof that he’s innocent and Sirius never told her that he is, but she was determined that he’s a good guy.
After Sirius escaped, he hasn’t kept in touch with her as much as with Harry, but it didn’t discourage her. She had a feeling that he’s hesitant to accept her because she’s still Bellatrix’s daughter and never resented him for it. However, after his death, Lupin told her that Sirius was very proud of her and had greats hopes for her - he just didn’t know how to show it.
Dobby:
Since she grew up with the Malfoys, she has known Dobby her entire life. They were pretty friendly toward each other, but they were instructed not to talk with each other.
Once, she tried to give Dobby clothes to set him free, but because she wasn’t technically a Malfoy, it didn’t work. After that, Lucius forbid Dobby from ever interacting with her again.
AUs:
Did you really think I don’t have like 200 different AUs for this headcanon? Of course I have! I’ve been building this headcanon since I was a literal child!
My favorite AU is the one where Fred didn’t die in the Battle of Hogwarts, and he and Maria got to be together after all. They usually get married (although there is a variation where she broke up with him instead), and in one AU in particular, healers are able to restore her fertility and they have a child together.
Maybe in the future I will make more posts about these AUs.
HPHM
Since Luna is very close with the Weasleys too, in most AUs Maria gets to meet Luna and the two become friends. Luna is also Maria’s private healer, since Maria gets injured a lot during Quidditch games.
---------------------------------------
There is so much more!!
But I will leave something for future posts :)
#my art#drawing#my headcanon#hp headcanon#harry potter#harry potter hc#harry potter oc#oc#original character#hp oc#maria black
34 notes
·
View notes
Text
Reacting To: Kipo and the Age of Wonderbeasts (Season 3 Episode 4)
Ughhhhh :’(
Episode Title: Don’t You Forget a Meow Me
Spoiler Warning: Kindly proceed if you’ve already seen the episode or are able to handle spoilers
1. First of all, what a cute episode title! LOL. The episode opens with Yumyan, Asher and Dahlia trying to catch a butterfly mute from the tree tops but the butterfly has a brain and is able to flee lol. And he has such a bro voice. Cool! We get to see a close-up of Asher; They look so good with short hair.
2. Dahlia spots Zane, who is about to fire his crossbow at someone but Yumyan and the others took care of him:
3. Back inside, everybody is having pancakes for dinner but they’re interrupted by Zane’s presence. He has a message for Kipo from Emilia and she wants Kipo to meet her at the water treatment facility in 3 hours to get cured. Kipo doesn’t seem to have a choice but to follow her instruction because Wolf, Benson and Dave have been captured by Emilia all thanks to that spineless backstabber, Margot. But I’m so pumped now because I feel like things are gonna get epic and serious from this point onwards.
4. Kipo immediately runs off to get to Emilia but is thankfully stopped by Song before she makes another bad decision. Kipo is frustrated that Emilia still has power even though she thinks she has already completely destroyed the research journal, which we know it wasn’t completely disintegrated.
5. They head back to the village to discuss a new game plan. Song tries to give her input and it sounds pretty legit but it’s a shame nobody is understanding her. I have a feeling this is where Mulholland is gonna come in.
I actually think Zane’s lowkey fine....don’t judge lol
6. But what’s even better is that they know Zane is aware of Emilia’s secret plan and Kipo brilliantly comes up with the idea to trick him into drinking water with Mulholland in it in order to get inside his thoughts. Mulholland is such a useful ally to have.
Poor Scarlemagne is getting tossed around in that glass cell, ouch!
7. We switch things over to Scarlemagne, who is having a conversation with Song! Song looks like she’s expressing her worries to him but Scarlemagne, too, doesn’t get what she’s trying to say. Sometimes I find myself forgetting that these two had somewhat of a mother-son relationship.
8. Mulholland manages to retrieve the info from Zane’s brain and he tells the others that Emilia only has 2 doses of the cure, thanks to the fur Kipo left back in episode 2. Also, he reveals (or mentally shows) to them that Wolf, Benson and Dave are tied up with a bomb nearby so that in case anyone tries to rescue them, Emilia and her crew will cause the bomb to explode. Yikes!
9. Kipo wonders if Mulholland could get into Emilia’s head to turn her good but he says it’s too risky because if he gets mixed in with the cure, there is a possibility he would de-mute everyone. Double yikes! But I think it’s a plan worth considering if none of their other plans work because at least Dr. Emilia hasn’t been introduced to Mulholland, I think.
Mandu is literally me if I were watching over a bad guy
10. Side note: Where is Troy throughout all of this? His boyfriend is captured and threatened by the bad guys. I want to know his reaction. Anyways, with the help of Mulholland, Kipo, Lio and Yumyan then go through an imaginary test-run of their rescue mission but they quickly fail because Kipo is too fearful. Why though? Is it because her friends are in danger? But that didn’t stop her in episode 2 when Jamack was captured. Weird, right?
11. Yumyan and Lio try to advise Kipo on how to stay calm and not be too afraid when facing Emilia. Yumyan definitely got through to Kipo a little more because he reminds her of the time in Season 1 when she pushed him to take charge. Afterwards, Kipo seems to feel a lot better and she then tries another simulation....and another...and I guess another but she’s always failing. Really, Kipo?
12. Awww, the way those Timberkittens call Scarlemagne’s name was so adorable! Also, are their names really Scrumples and Snugglemuffin? Or are those nicknames given to them by Scarlemagne. If so, omg that’s so precious! So now, Scarlemagne is trying to teach Song to speak using alphabet blocks just like how she taught him when he was just a child and when she was still a human.
13. Back to Kipo’s test-runs; She’s still failing miserably in them. She can’t seem to avoid Emilia’s darts for some reason, specifically the second dart she shoots at her. Well, she better figure out a strategy quick because the deadline to respond to Emilia is almost here.
14. Next, we see Song and Scarlemagne playing charades with the latter trying to guess what’s she’s gesturing. It’s funny that Song doesn’t know how to read or write but she sure does know how to listen to the others almost perfectly lol. Eventually, he manages to guess a word that is similar to “feeling” so far. Hmm...
15. It’s times up and Mulholland decides to bid his farewell for the good of the mutes. He feels like him being around them would be dangerous in the event Emilia got to him. Ugh, I don’t want him too leave. He’s too much of a valuable asset to the group. Not to mention, he’s hilarious.
I love soft Scarlemagne. I have a feeling that he still has that family bond with the Oaks.
16. Kipo feels like she has no choice now but to give in to Emilia’s demands but before they could leave, Scarlemagne and Song stop them because Song has a message she wants to give to Kipo through Scarlemagne. She basically wants Kipo to know that she shouldn’t let Emilia use her feelings against her and instead, she should dish it back to Emilia. Scarlemagne further explains that she should let Emilia think she won this round so that she would put her guard down. Great thinking!
17. We fast forward to Kipo barging into Emilia’s hideout without hesitation. Emilia shoots a cure dart and it apparently gets her but she probably didn’t. I predict Kipo has some protective covering for her chest. Emilia goes back on her deal and now wants to take all of them back to her ship. And she wants Kipo to tell the rest of the humans that she didn’t want to be a mute anymore.
18. It turns out that she’s just distracting her so that Lio and Yumyan could go forward with their rescue plan with Lio stealing Emilia’s second and only other dart left and Yumyan stopping Greta from triggering the nectar bomb. And as predicted, Kipo had that piece of wood Scarlemagne used to write on to protect her. And the battle begins with Yumyan taking on Greta and Kipo taking on Emilia.
19. But why are they struggling against the humans? Kipo should’ve transformed into her full Mega Jaguar form. Because of that, both Emilia and Greta manage to best them and escape. What the!? This fight should’ve been one-sided with the odds favoring the mutes.
20. And look what happened! OMG! I think Yumyan got hit by the dart that was meant for Kipo. Again, why was Kipo so slow at avoiding those darts all of a sudden?! Ughh, she’s so frustrating. Technically, Wolf made the dart go to Yumyan but this wouldn’t happen if Kipo had reacted faster. Kipo and the rest think that they escaped without any harm...we’ll see about that...
21. Yeap, my fears came true because Yumyan did get hit by the cure dart and he has turned into regular cat. Nooooo!!!! And it’s kinda low key Kipo’s fault. She went through like 10 test runs, so she should’ve learned to avoid them but no, she didn’t! *sniffs. Kipo better find a way to turn him back into a mute pronto. And I’m pretty sure Lio would be able to help. Damn...and the episode has to end with his last words being ���Yumyan owns you...meow”...CRIESSSS
22. Well, that’s the end of my review of episode 4. Stay tuned tomorrow for my review of episode 5. Thanks for reading everybody!
#kipo#kipo and the age of wonderbeasts#kipo season 3#dreamworks#dreamworks animation#kipo dreamworks#kipo netflix#netflix cartoons#netflix animation#benson and troy#troy x benson#benson x troy#troyson#lgbt cartoons#lgbt representation#lgbtq#gay couples#boy love#gay#karen fukuhara#sterling k brown#episode recap#episode review
34 notes
·
View notes
Text
Advent of Code
As a child, advent calendars always added to the sense of anticipation in the lead up to Christmas. In my day you would be lucky to get a small picture behind each of the doors. These days, children expect chocolates or sweets. My wife has once even had a "Ginvent Calendar", with gin behind each door.
This year I marked Advent by having a go at the "Advent of Code" which has Christmas-themed programming puzzles posted each day. Most days are in two parts, with an easier puzzle followed by a harder one. Traditionally, I've posted a (mostly ignored) programming puzzle to our development team each Christmas. Last year I just recycled one of the Advent of Code puzzles, but this year I suggested we attempt the whole thing. The puzzles are so well thought out, in comparison to my efforts, that it seemed pointless to compete.
In the end, several of the team had a go. Some of the puzzles were harder than others, but I managed to solve them all by Boxing Day. What follows are some personal anecdotes from the various days with some general thoughts at the end. Note that there are some spoilers and the notes won't mean much if you've not done the puzzles. So in this case just skip to the end.
a sum-finder. I implemented the search tree via recursive calls. I drifted into using Python right from the start. It just felt like the easiest way to hack the puzzles quickly. In the past I had thought about using the puzzles to learn a new language. A colleague had done that with Rust in a previous year. Despite these good intentions, expediency took a firm hold. That said, in several puzzles I would have liked immutable collections or at least Lisp-style lists.
a pattern counter. Not that interesting except patterns were emerging in the programs themselves. Regular expressions got used a lot to read in the puzzle data. I learnt about things like match.group(1,2,3) which returns a tuple of the first three match groups, so you don't have to write (m.group(1), m.group(2), m.group(3)).
a grid tracer. The first interesting one because it was unfamiliar. Some other patterns started emerging: problem parameters got promoted to command line arguments, and data structure printers got hacked to help debugging. These two were often added between part 1 and part 2 of each problem.
a data validator. This felt like a bit of a slog. It was mostly about capturing the validation rules as code. Even though I made a point of reminding myself at the start that re.search doesn't match the whole string I still forgot it later. Duh.
an indexing problem. I patted myself on the back for realizing that the index was a binary number (or pair of binary numbers as I did it). At this point the solutions were still neat and I would do a little code golfing after the solution to tidy them up a bit and make them more concise.
another pattern counter. Pre-calculating some things during data reading kept the later code simple.
a recursive calculator. This was one of those puzzles where I had to reread the description several times to try and understand what it was asking for. It entailed a slightly tricky recursive sum and product, which was again made easier by creating more supporting data structures while reading the input data.
an interpreter. Probably my favourite individual puzzle because it was so sweet, especially after a bit of refactoring to make the language more data-driven.
another sum-finder. I found I didn't particularly like these.
an order-finder. This was the first one that made me pause for thought. An overly naive search algorithm from part 1 hit a computational complexity wall in part 2. I beat the problem by realizing that the search only had to be done on small islands of the data, but a colleague pointed out there was a better linear solution. The code was starting to get a bit ragged, with commented out debugging statements.
the game of life. The classic simulation but with some out-of-bounds spaces and some line-of-sight rules. It helped to print the board.
a map navigator. I liked this one even though I forgot to convert degrees to radians and that rotation matrices go anti-clockwise. I even introduced an abstract data type (ADT) to see if it would simplify the code (I'm not sure it ever did - I mostly used lists, tuples, strings, and numbers). The second parts of the puzzles were starting to get their own files now (usually bootstrapped by copying and pasting the first part's file).
a prime number theorem. I actually got stalled on this one for a bit. It eventually turned out I had a bug in the code and was missing a modulus. In effect I wasn't accounting for small primes far to the right. I left the puzzle and went on to complete a couple of others before coming back to this one. I checked what I was doing by Googling for hints, but in the end I had to take a long hard look at the data and find my own bug.
some bit twiddling. Part 1 felt like I found the expected bitwise operations, but part 2 felt like I was bashing square pegs into round holes.
a number sequence problem. Another pat on the back, this time for keeping a dictionary of recent occurrences and not searching back down the list of numbers each time. Another recurring pattern is evident: running a sequence of steps over the data. I liked to code the step as its own function.
a constraint solver. A nice one about labelling fields that satisfy the known constraints. Half the code was parsing the textual rules into data.
another game of life simulation. This time it was in more dimensions. I generalized from 3 dimensions to N instead of just doing 4. This made it more of a drag. I started naming auxiliary functions with placeholder names (social services should have been called). Also, I tacked on extra space along each dimension to make room at each step. This felt very ugly. I should have used a sparser representation like I did for day 24.
an expression evaluator. I used another actual ADT and wrote a simple but horrible tokenizer. The evaluator was okay but I hacked the precedence by inserting parentheses into the token stream. Don't try this at home kids.
another pattern matcher. Probably my biggest hack. My code compiled the pattern rules into a single regular expression. This was cute but meant the recursive rules in part 2 needed special treatment. One rule just compiled into a repeated pattern with +. Unfortunately, the other rule entailed matching balanced sub-patterns, which every schoolchild knows regular languages can't do. Perhaps some recursive pattern extensions might have worked, but I assumed there would be no more than 10 elements of the sub-patterns and compiled the rule into a large alternative of the possible symmetrical matchers. Yuck.
a map assembler. I did this one the most methodically. It had proper comments and unit tests. Overall it took the most code but perhaps it was just dealing with all the edge cases (ba dum tss). But seriously, it seemed to take a lot of code for rotating and flipping the tiles even after knowing how they must be connected. So probably there was a better approach. It was still satisfying the see the answer come out after all that work. Curiously, this one involved little debugging. I wonder if perhaps there is some connection between preparation and outcome?
a constraint solver. I tried a dumb approach first based on searching all the possible bindings. That didn't look like it was terminating any time soon. So I reverted to a previously successful technique of intersecting the associations and then then refining them based on the already unique ones.
a recursive card game. This card game playing puzzle seemed to be going okay, but the real data didn't converge for part 2. Had a quick Google for a hint after battling with it for a while, and the first hit was from someone who said they'd misread the question. Sure enough I had too. My recursive games were on the whole deck instead of the part dictated by the cards played. Duh. The description was clear enough and included a whole worked game. I just hadn't read it properly. It still seemed to need some game state memoization to run tolerably fast.
a circular sequence. Took three attempts. A brute force approach using an array was good enough for part 1, but no way was it going to work on part 2. Even optimizing it to use ranges was still 'non-terminating' for the array-based solution. So I Googled for a little inspiration and found the phrase "linked lists" and slapped my forehead hard. I switched to a dictionary of labels to labels and the solution popped out very easily, without any further optimization. Embarrassing. Was it time to ceremonially hand in my Lisp symbol and fall on a sharpened parenthesis?
another game of life. This one sounded neat because it was about a hex grid, but I didn't know how hex grids are usually indexed. So for the first time I did a little bit of general research at the start. Turns out there are a bunch of ways to index a hex grid. I opted for using 3-axes as that seemed natural despite the redundancy. The map itself was just a dictionary of locations. I should have looked up how to have structured dictionary keys in Python (implement __hash__) but I couldn't be bothered so I (look away now) serialized and deserialized the locations to and from strings. I still had a bug which I couldn't find until I hacked a crude hex board printer and realized I wasn't carrying the unchanged cells over from one iteration to the next.
a cryptographic puzzle. Came out quite short but only after some faffing around. Main trick seemed to be to keep the transformation ticking along instead of recalculating it from scratch each time. There was slight disappointment (tinged with relief) that there was no part 2.
Some general lessons I felt I (re)learned:
Read the questions very carefully, then reread them.
Try and use terms from the questions. Don't invent your own terminology and then have to map back and forth.
Make the trace output exactly like the examples to help comparison.
Next time I'd consider using BDD to turn their examples directly into tests. Next time.
Try the problem for a while by yourself, then think about it offline, and only then Google for hints.
Next time I'd consider using some form of source control from the start, or just a better set of file naming conventions.
Regular expressions go a long way, but can then they can get in the way.
Next time I'll consider doing it using a language I'm learning.
Sometimes when you get stuck you have to start again.
During some low moments it all felt like make-work that I'd inflicted on myself, but in the end it was a nice set of training exercises. I'd encourage others to have a go at their leisure.
"Practice is the best of all instructors." -- Publilius Syrus
2 notes
·
View notes
Text
10 Skills to Empower Yourself With During This Lockdown
These are troubling times, and this serious global health threat has disrupted millions of lives. However, that doesn’t mean you can’t divert your energy towards more productive outlets. Here is the time for you to finally do those things you’ve always wanted to but never got around to.
Surely a couple of things come to mind, skills you said you’d learn but never did, hobbies you wanted to try your hand at.
The lockdown doesn’t have to be entirely boring and you can actually emerge out of this as a highly-skilled individual. Even top companies are suggesting that their employees take up a new hobby or learn a new skill. This not only helps build your skillset but also keeps your mind busy and productive. You may wonder, “How do I learn a new skill at home?”. With so much available on the internet, the answer is simple: online classes! You can find several free beginner classes, and there are always Youtube tutorials available as well.
A little note here: if the skill of your choice involved outdoor activity, then it’s best that you don’t take it up at the moment.
However, there are myriads of other skills you can still learn or get better at during the lockdown. Here’s a whole list of them to help you find the one you like.
1. Learn a Language
Do you remember all the times you said you’d learn a language, if only you had the time? Well now’s your chance! Learning a new language is not only fun but is also beneficial in many ways. For example, multilingual people are more adept at multitasking. Since such people are used to switching between two systems of speech, this improves their ability to switch seamlessly between tasks as well.
Another advantage is that your memory improves. Think of the brain as a muscle – if you don’t exercise it, it will weaken. Learning a new language is the perfect exercise to strengthen your mental “muscle”. More advantages include becoming more perceptive, making greater rational decisions, and actually helping you improve your first language.
The next part is figuring out which language to learn. There are obvious options: French, Italian, Spanish, and the like. However, there are some others you may want to consider as well, such as Mandarin Chinese. Currently, China’s GDP is set to overtake America’s by 2030. So if you’re a businessman, learning Mandarin is one of the smartest moves you can make.
2. Take a Programming Course
Programming is a great skill to have on your CV always. Even if it doesn’t have anything in common with your current job, learning how to code can also serve as a creative hobby. Once you get the hang of it, you can learn to write programs for yourself, create entire websites, build your own tools, and more.
Coding is so instrumental to today’s world that schools are now adding programming classes to their curriculums.
Based on what your end goal is, you can decide between different types of programming languages. Generally, an excellent language to start off with is Python. Python is a high-level language, meaning you can do a lot with it. It’s also an increasingly popular one among data scientists, engineers, and developers.
The internet is swamped with online programming courses. You can find some on Coursera, Udemy, Class Central, etc.
3. Try Your Hand at Cooking
Many people have taken up cooking during this lockdown, and there are several reasons for that. For starters, since you can’t go out to have your favorite meal, you might as well try making it at home. Secondly, right now is the perfect opportunity to learn a valuable life skill that every person should have.
And lastly, cooking and baking are very therapeutic for most. It encourages creativity and is known to have a calming and meditative effect. That is why you may have noticed everyone you follow on social media is suddenly a culinary maestro.
For everyone who’s working from home, cooking also helps cater to all the midday cravings you get where you’d normally head to the vending machine. You can now make healthier choices and create your own quick and easy snacks for a midday office boost.
You can find simple recipes online for whatever you want. Chefs are also creating easy recipes for beginners who are trying their hand at cooking during the lockdown. There are also videos on Youtube where you can follow along with the chef in real-time.
4. Do Some Gardening
If you’re really interested in keeping an eye on what goes into your cooking, then you can take this a step further by planting your own vegetables too. Even if you don’t intend on using your plants in your cooking, there are still plenty of reasons why you should take up gardening.
Gardening has been known to have a positive impact on your mood and brain chemistry. Certain rhythmic and repetitive movements have a calming effect on the nervous system. This is why movements in gardening, whether it’s mowing the lawn or pulling up weeds, leave you peaceful and calm.
You can find several resources online, and free of cost, on how to sow seeds during the lockdown and how to tend to your garden. You can easily order seeds and pots of your choice online, so what are you waiting for?
5. Play an Instrument
Of course, this one isn’t for everyone, because not all of us have a musical instrument lying around conveniently. If, however, you do have a guitar or ukulele with you, now is a good time to dust it off and get playing.
While there are many online classes available, there’s one designed particularly for the lockdown that you may want to check out. The guitar manufacturing company Fender is offering three months of free online lessons to see you through the lockdown.
The lessons include learning the guitar, bass, and ukulele. Musicians teach the lessons and you can download the videos to go over, again and again, and practice as you wish.
Music has always been known to help reduce stress and put you in an uplifting mood, leaving you happier than before. Since we’re all stuck at home, you might as well make some noise!
6. Get Creative With Photoshop
Graphic design is always an in-demand skill to have. You can easily turn this hobby into a valuable skill as well by freelancing on the side to earn some extra income. Once you learn how to use Photoshop, your creativity will know no bounds.
There are courses you can take to learn everything, from the basics to a more advanced level. However, if you don’t want to enroll in a course, you can easily find online tutorials on Youtube. If you want to create a logo or a business card, or simply edit pictures with different effects, there are tutorials for everything.
Adobe itself also offers tutorials, so you can learn right from the creators themselves. Another benefit of taking up Photoshop is that it doesn’t limit you to your laptop. You can also download the app on your phone or tablet and continue from there, on the go.
Once you’re adept at it, you can start creating your own art and eventually even sell it.
7. Work on Your Soft Skills
Since you’re in isolation, now is a great time to work on yourself and your soft skills. There are courses such as “Creative thinking: Tools for success” and “Improving communication skills” that all of us can benefit from.
Employees who undertake such courses are certainly going to benefit at their jobs as well. Businesses always recognize and value individuals who proactively seek to diversify their skill sets during downtime.
With such skills, you can improve your confidence, learn how to command a room, and dazzle the audience. Your CV isn’t the only thing employers focus on in an interview. They’re also looking at you as a person; how you talk and formulate your thoughts. If you improve such soft skills right now, your chances of employment are bound to improve.
8. Try Creative Writing
Have you always wanted to start your own blog? Now’s your chance to! You can find great resources online about how to do just that. And with all the ample time on your hands, you can put your creative juices to good use. Writing helps you express yourself and it’s a great way to unburden yourself by leaving it all on the paper.
Some of the best writers in the world only produced their best works when they were left in isolation. As you find yourself in a similar situation, there’s nothing stopping you from writing now and joining their ranks!
Even if you don’t intend on starting a blog or writing a book, you can still benefit from writing. It will eliminate stress and help you communicate with greater clarity.
Many successful writers offer online courses to help you find your writing style. You can learn all sorts of techniques about how to develop a plot and create suspense. There are also countless interesting writing prompts available online.
9. Start Doing Yoga
In such times of turmoil, all of us need a combination of physical and mental exercises – yoga is just the answer. Yoga is for everyone, irrespective of what age group you’re in. It helps keep your body flexible and active while calming your brain as well, detoxing all the negativity of the day.
Don’t let all the yoga terminology and fancy named poses intimidate you. You will easily get a hang of everything once you start watching some tutorial videos on Youtube.
The important thing is to focus on your posture and breathing techniques. If your posture isn’t correct, then the yoga exercises may do you more harm than good. For this reason, it is important that you stick to watching videos instead of reading blogs.
The benefits of regular yoga are wide-ranging. It helps keep your back and joints healthy, improves your posture and balance, and strengthens your muscles. Relaxation is built into every yoga session, so you will find yourself much more peaceful by the end of it.
10. Video Editing
I’m sure everyone has always wanted to capture a beautiful video to remember important memories, complete with the perfect soundtrack and seamless transitions. However, video editing just wasn’t as easy as it sounded so you never got around to pursuing it.
Now is your chance to learn how to create beautiful, quirky, funny videos. Learning how to shoot and edit videos requires time and patience. Luckily, you have ample time on your hands in this lockdown! You can watch online videos on how to edit videos, which software to use, and tips on what to do and not do.
Video creation is relatively easier than video editing. Video editing requires you to have an eye for detail. This means you have to notice and fix the smallest of things such as the alignment of elements, etc.
Once you get the hang of it, you can also start taking on freelance projects. Companies are always looking for freelancers who can edit video content for various platforms. If you want, you can even narrow yourself down to either an online video editor or specifically as a social media video editor.
Time to Pick a Skill!
While a certain situation of uncertainty prevails, we can still focus on the few positives of the situation. We now have time than ever before to focus on developing ourselves and our skills. If we don’t make efficient use of this time, we’re going to regret it later on.
Picking up a new skill is bound to help you set a routine during this new reality everyone is trying to venture through. With something to divert your attention, you won’t constantly be anxious and stressed out about the pandemic. It’s best to reinvest the time into something productive instead of binge-watching shows. Any kind of knowledge is only helpful and will serve you well.
Remember, stay safe and stay at home!
The post 10 Skills to Empower Yourself With During This Lockdown appeared first on CareerMetis.com.
10 Skills to Empower Yourself With During This Lockdown published first on https://skillsireweb.tumblr.com/
0 notes