Featured Post

The Pin of Contents

OI! CLICK DIS TO HELP YA FIND YER WAY! Your hub for everything Gordo... if you happen to share my narrow view of what 'everything Gor...

Wednesday, April 6, 2016

Chapter 4: Ingredients

Two months since the last update? Disgusting! It's just monsters cannibalizing each other in complete darkness without dialogue, what's so hard about that?!

I've been all kinds of broken since autumn. Seasonal-onset broodiness eventually became scatterbrained and strangely-blissful disinterest. There were a lot of obligations that got in the way, too, but I gotta admit, there was PLENTY of time I could have been writing (or learning to code).

Oi. I'm hopeless! I'll try harder to try harder. In the meantime, try to forgive me for being me! Unlike my wintertime self, I'm having an incredibly easy time doing exactly that! So I imagine it'll be easy for you, too.

This episode starts here, and the latest chapter is below. If you bother reading this chapter, help me look for gender pronouns that don't apply to the Chef (she doesn't know or care about anyone else's genders, so all the other monsters should be 'it' or 'they!). Also, she's blind (in the present day), so please let me know if I accidentally wrote her seeing something. Bon appetit!

Chapter 4: Ingredients

Eight remained, if her count was right. Should she assume there were more? Of course I should! That was both the safer and more tantalizing option. Today had been so generous, why should she hope that would cease?
The rabble had only annoyed her, at first; that lesser fare had never factored into her count. Even now they continued their petty squabbling, punishing some starving specimen when it got too impatient or being slaughtered by their mature cousins when they ventured too close.
She’d lost herself to fury when one of the vermin dared nibble on her most recent prize. Eventually that rage gave way to gratitude when it lead her to this melee. The old corpse, which she still dragged by the leg, was a pittance compared to these riches.
Such splendor had to be treated with suspicion. Is the Curator trying to lure me into enslavement again? She would rather die than let that happen, yet this was the exact way she’d do that, were she him. Grand as she may be, she was only one among countless resources available to him. Was she worth such an elaborate ploy? Could she risk this?
As if I could resist.
If the Curator could conceive of such a trap, she would fall for it. This bait was too good. Luckily, this wasn’t a trick; too many mongrels were dying, the Curator would have assumed control before losing so many thralls.
So she scanned the crop to catalogue its cream. It would be easy to grab one of the countless weaklings, but she wasn’t here to just fill her stomach. As the Chef, she lived to collect the primest ingredients and combine them into something even greater. This could be her greatest entrĂ©e yet!
Her targets all hid their specialties; they didn’t need them to snuff the occasional invalid challenger. She'd need to bait them into revealing those traits - those who might spoil other ingredients would need to die before they could.
She counted eight, and that number wasn’t changing anymore. If there were any others, they were probably waiting for some of the eight to be vulnerable. The battle was stagnating, which meant it was time to intervene.
Give the fruit a squeeze.
She bounded toward the middlemost specimen. The dumbest of her targets were experienced enough to recognize this cue, and the smartest weren’t good enough to see through the feint. She was certain, because none of them were her.
The others didn’t make her wait. They leapt to intercept the Chef or flank her target. Two of them collided when she came to an abrupt stop, and her first victim succumbed to the others. The interceptor on her right was so focused on the Chef that it tried to disentangle itself to come after her, but its collider preempted this by breaking its spine.
The Chef watched her handiwork with satisfaction. Bruised, but ripe. Two were down, and they were killed by unspoiling means. A good start.
Five of them were now committed to a free-for-all, but the spinebreaker turned its attention to her. She didn’t consider it much of a threat, but it would complicate her observation. It was quite  a Brute, and therefore difficult to subdue without her ability. It was far too early to be cooking anyone, after all. She’d have to focus on this and hope the others didn’t use any tactics that would spoil their competitors.
This one shook the ground when it moved, and she felt vibrations on the air when it grabbed for her. She could even hear its blood rushing through that magnificent form. The Brute couldn’t hurt her this way; she let the blows flow all around her like a reed in a river. It might as well be trying to smash water.
This type had a natural disadvantage against hers, but its sturdiness was an obstacle in this situation. She didn’t want to kill by cooking, and that was the only way she could penetrate so many layers of armor and muscle. It wasn’t a threat, but as she dodged and probed for weakpoints, the Brute was becoming quite the chore.
As she pondered the nuisance, something acrid drifted her way. Panic rose as she ducked under her attacker’s swiping and ran towards the larger group. Someone was playing with chemicals, and that was the one way they could ruin her meal!
Which was the source? The chaos didn’t lend itself to that discovery. Fighters danced in and out of the fray, and blood was interfering with the scent. The Chef didn’t know how she might locate her target as she dove into the brawl, but she was determined to do something.
Bladed limbs sliced the air all around her, and not even her exceptional grace was enough to avoid all the damage. Occasional points would gash her armor, and while the underlying flesh was barely scraped, she soon discovered the center of this maelstrom was a poor place to find the information she needed.
The Brute bowled through a grappling pair as he chased her, trampling one as it did. Another specimen greeted it with a slash, but only managed to knock itself off-balance against its girth. She was still its focus, but at least it had the courtesy to make itself the others’ problem while it chased her.
The stench became stronger as the chaos intensified. The Chef’s agitation rose as her investigation wore on. Each combatant, one-by-one, demonstrated how they couldn’t be the source of the smell, which meant that entangling herself in the melee was a mistake. Someone escaped her count, and that someone now had the advantage.
She needed to disengage and find them, but her opponents kept her trapped in combat. At this rate, the acrid Stranger might kill and consume them all, and she panicked at the prospect. The only fate more humiliating than becoming one of the Curator’s thralls would be as an appetizer for some pedestrian.
She put her hands on the Brute’s shoulders to vault over it. Her hand slipped mid-maneuver, which allowed her attacker to knock her down. Rolling away from a couple of improvised stomps and stabs actually allowed her to escaped the battle.
It wasn’t planned, but the Chef was relieved by this clumsy outcome. She climbed to her feet and clacked her hands together to shake the dust off. The fine, acrid dust from the brute’s shoulder, the dust that caused her hand to slip…
In this moment of clarity, it seemed obvious the source would be hiding above them. The branches were exceptionally high here, and that would help this creature spread its powder over a larger area.
She rolled the powder between two fingers as she considered; she had no idea what it was doing to her. It hadn’t affected her yet, as far as she could tell. Nor were any of her targets reacting. The Stranger hadn’t won yet, and if they were still hiding, that victory wasn’t certain.
A crack and a cry brought her attention back to the fray. The brute tossed half of someone to either side as it broke free of the crowd. I’d resent that tenacity if it weren’t so appetizing.
The smell was still growing stronger, despite her distance from the crowd. Was the Stranger as obsessed as her bullish stalker? If so, perhaps the brute wasn’t the obstacle she’d thought he was.
The best chefs know: to get food, you give food.
Unfortunately, the familiar flurry of attacks was accompanied by labored breathing and pained grunts. The Brute was fast and strong, so much that its stamina was bound to suffer. She’d planned to fake distress, but was that still an option? If her ploy wasn’t convincing, then the target would know what she was trying to do. That might make them flee, and she might never have another chance to try that ingredient.
The Brute lost its balance trying to grab her and fell on its face. She had an epiphany as it struggled to rise. I could always fake the other kind of weakness.
She turned her head as though scanning the surroundings - an act, she had no eyes -  then slammed her heel into the back of the Brute’s head. Pinning it in its prostration, she leaned over and jabbed a claw into a gap in its armor. The beast snarled and bucked as well as it could, and the Chef pretended like she enjoyed its pain. She’d seen others do this; never understood it herself, but she only needed her target to believe she did.
A scraping sound came from high above her, and her mood soared. With this, her best dish ever would become even better.
She waited a full second before sliding out from under the Stranger’s pounce. It landed so lightly that the Brute didn’t even seem to notice a newcomer on its back. With a grunt of frustration, the Stranger leaped after her, but the Brute surprised them both by grabbing the Stranger mid-flight. It gripped its entire bottom half in one fist and tried to push itself up with the other arm.
The Stranger screeched its fury and dragged on hand across the top of the Brute’s skull. A flinty scrape prompted a sparking sound which culminated in a chronic hiss; the powder on the Brute’s head ignited and burned through armor and bone in seconds.
The Chef breathed a sigh of relief, then licked some of the dust off her hand. She’d feared this was a contaminant, but now she thought it might be a good spice. The Stranger deserved her gratitude for this introduction, and she intended to show it.
The Stranger squeezed out of the dead Brute’s fist and sprang after her, but she no longer had any reason to run. She met its charge by grabbing its neck and ducked under its arm when it reached to ignite the dust still clinging to her armor. Once behind her prey, she wrapped her arm across its chest to lock its movements.
It thrashed with all its might, but the Stranger was too small to compete with her strength. The Chef ignored the sparks it made when its flinty fingers rubbed each other and released her tendril from its aperture under her back shoulderplate.
The prehensile appendage snaked up and around to point at the Stranger’s nape. Just a spritz to the spine. It musn’t suffer; must know of the care with which I’ll prepare. It must understand my gratitude.
The squirt was inaudible under the Stranger’s struggling. Steam wisped then billowed from the point of impact as her sauce ate through the armor. If the Stranger ever realized it was dying, the Chef couldn’t tell from any change in its flailing. It came to the same abrupt stop as its breath when the marinade seeped into the spine, and the Stranger finally slumped into her embrace.
You’ll be savored, friend, you and your unique spice. I’ll cook you up right, serve you with dignity. They’ll praise us, acknowledge you as the best flavor they’ve ever had.
She paused at the thought. They? When had she planned on sharing? There was a time when she cooked for others, cooked for them more than herself. Before this moment, she couldn’t remember the last time she entertained these memories. What sparked them now?
Images of tables and patrons filled her head along with thoughts of schedules and menus. It had been a routine existence, scurrying about the kitchen collecting the same ingredients into the same cookware to hope the alchemy of fire would yield some new taste. The images conjured forgotten emotions of safety and belonging.
Things are so much better now. She wouldn’t have to share the Stranger with anyone. These memories were as vivid as if she’d just experienced them, but she couldn’t comprehend going back to that life. She could treat her palate to an endless variety out here, and that was worth far more than her sense of sight or safety or whatever other comfort she’d forgotten along the way.
Focused on her thoughts, the Chef was slow to heed the rush of feet behind her. She dropped the Stranger and wheeled around, but her attacker was already cleaving at her midsection. At least she was experienced enough to not fight against the force of the blow; she let the arm-mounted sickle lift her off the ground instead of forcing it to plunge deeper into her abdomen.
She landed on her feet several steps away and audited the damage. She was bleeding, but the cut was shallow. Her instincts and armor had saved her from evisceration. Between her ecstasy over the Stranger and the confusion from those ancient memories, she’d forgotten all about the other ingredients.
She might have been grateful to the victor of that brawl if she weren’t so furious. She leveled her fist at the weary champion and squeezed the appropriate bladder. A blob of sauce blasted out of the hose running along her underarm and splashed into her attacker’s chest. It looked down in confusion, then panicked as the fluid ate through its armor and into the nerved tissue underneath. It fell on its back and tried to wipe the gravy off, but this only allowed the melting to spread to its hands.
The Chef cursed herself and strode back to the Stranger as its death wail diminished into silence. She tossed the Stranger onto the smoking corpse and moved to collect the Brute’s body. There was still time to cook everything properly, but she would have preferred to be more methodical about it.
Whosoever brings me the most from this collection of heads will become my newest Curator. She’d been so focused on her task that she didn’t notice the rodent skitter up her back and onto her shoulder. This one is worth three of the others.
The human faces meant little when she didn’t have eyes, but luckily the memories included enough sounds and smells for her to identify them. Processing this mission wasn’t her first priority, but she took enough interest to ponder it as she piled the rest of her ingredients together. So this fight was engineered? It wasn’t a trap, it was a test!
It meant the old Curator was dead. This was excellent news! The Chef pointed her fists at the food pile and briefly considered the various sauces stored in her body. So the Miracle wants a replacement. It would bless me as it blessed the old one, wouldn’t it?
The Chef remembered what it was like to be under the Curator’s control, to hear his thoughts in her head and live with the constant threat of having her consciousness switched off. She knew she didn’t have the affinity for that specific ability, but she also knew there would be an equivalent that suited her. How frequent would meals be with such power?
She mused over the possibilities as she meticulously basted her prize.


Eat your heart out, Emeril. BAM!

Friday, February 12, 2016

L2Code! MIT 6.00 Problem Set 1 pt. 2

Now that we're the gods of... um, very limited credit card debt calculation... Okay, let's dial it back.

Today we're gonna refine the debt calculator. Problem 2 and 3 are "Paying Off Debt In a Year" and "Using Bisection Search to Make the Program Faster."

I'm gonna approach this believing that 2 and 3 are easier than 1 because I'm a masochist.


Goin' off da rails
All aboard the crazy train!

Okeydoke. Here're the instructions for Problem 2:

Paying Debt Off In a Year

*******Problem 2

Now write a program that calculates the minimum fixed monthly payment needed in order pay off a credit card balance within 12 months. We will not be dealing with a minimum monthly payment rate.

Take as raw_input() the following floating point numbers:

1. the outstanding balance on the credit card

2. annual interest rate as a decimal Print out the fixed minimum monthly payment, number of months (at most 12 and possibly less than 12) it takes to pay off the debt, and the balance (likely to be a negative number).

Assume that the interest is compounded monthly according to the balance at the start of the month (before the payment for that month is made). The monthly payment must be a multiple of $10 and is the same for all months. Notice that it is possible for the balance to become negative using this payment scheme. In short:

Monthly interest rate = Annual interest rate / 12.0
Updated balance each month = Previous balance * (1 + Monthly interest rate) – Minimum monthly payment.******

This time, I'll actually post the Jeopardy! portion. If anybody besides me ever gives a damn, maybe I'll update the other post with that, too.

 ******Test Case 1

>>> Enter the outstanding balance on your credit card: 1200
Enter the annual credit card interest rate as a decimal: .18
RESULT
Monthly payment to pay off debt in 1 year: 120
Number of months needed: 11
Balance: -10.05 >>>

Test Case 2
>>> Enter the outstanding balance on your credit card: 32000
Enter the annual credit card interest rate as a decimal: .2
RESULT
Monthly payment to pay off debt in 1 year: 2970
Number of months needed: 12
Balance: -74.98 >>>

Hints Start at $10 payments per month and calculate whether the balance will be paid off (taking into account the interest accrued each month). If $10 monthly payments are insufficient to pay off the debt within a year, increase the monthly payment by $10 and repeat.******

I'm confused about one thing: why's the first one only require 11 months to pay off? The whole point is to balance it over a year! If we don't, why not just pay off all the balance at once? I mean, he didn't give me any budget limitations =P

Alright, I'll quit judging. We'll get started! He's requested we use a brute force approach (or, rather, 'hinted' that we should) so that's what we'll do. Some similarities to problem 1: while there is no 'minimum payment,' there is a static payment each month; a number that increases after each 12-month cycle. Ah, it occurs to me: we need a loop within a loop for this, because we have a 12-month cycle we need to repeat an undefined amount of times until the optimal rate is calculated.

Anyway, similarities: statpay will be sorta like minpay in the last problem. We need the yearlytotal variable again, in a nearly identical role. The change there is that it will serve the additional purpose of telling the undefined 'meta'loop whether or not the yearly cycle needs to repeat with a bigger statpay. outsbal, oribal, annint, and deadline all make comebacks, too. I kinda feel ready to start with that. So: first off. Tell me what ya done, indebted.

outsbal = float(raw_input('Enter your debt, dummy: '))
annint = float(raw_input('Enter their skim rate in decimal form, dummy: '))
oribal = outsbal
statpay = float(0)

Easy peasy. What's a peasy? Stupid brit commercials. Anyhooooo. Are we equipped to set up the metaloop or the innerloop first? Inner's prolly easier, yes? It's a lot like the last one. Ok then:

deadline = 12
yearlytotal = float(0)
statpay +=10
outsbal = oribal
while deadline > 0 and outsbal >= 0.00:
    principle = round(statpay-((annint*outsbal)/12),2)
    outsbal -= principle
    yearlytotal += statpay
    deadline -= 1

First glance: outside this loop, we set the deadline to 12. reset the yearlytotal to 0, increase statpay by 10, and reset the outsbal back to the original debt. These are all things that need to happen in the metaloop but can't happen in the yearly loop.

In the loop, we have principle calculating, and we're also calculating how much the statpay will chip off the outsbal each month. yearlytotal is keeping track of how much gets paid in total... come to think of it, the assignment doesn't strictly state we need to track it. Ah well, won't hurt. Finally, deadline is subtracting 1 from itself each time to make sure we only repeat this cycle 12 times.

As written, this loop will stay stuck on $10 for eternity, so next we need to determine how to fit all this into the metaloop. So: what's the criteria for the metaloop? Well, as long as outsbal isn't reduced to 0 or less in the inner loop, then we need to keep repeating. Are there any other criteria? I don't think so... let's give it a look.

while outsbal > 0.00:

Wait... we really just need to add that before deadline? Wow, how did I not foresee that? Whatever, don't dwell. Okay. To test what we have, we need some print. So: what do we need to know when it terminates? Mostly just statpay and the negative balance. Okeydoke then:

print 'With a monthly payment of $', statpay, ', your remaining balance will be $,' outsbal, 'at the end of ' 12-deadline, 'months.'

I think that does it. This is all supposing that the variables in the inner loop don't get reset somehow. But why would they? Hm. If this breaks, somebody put that quote on my grave. (Looks like I get a better epitaph! Maybe)

Success! We did end up having to refine it a bit (forgot some commas, a colon, and we were being silly with deadline at 11 instead of 12) So here's what the final code looks like:

outsbal = float(raw_input('Enter your debt, dummy: '))
annint = float(raw_input('Enter their skim rate, dummy: '))
statpay = float(0)
oribal = outsbal

while outsbal > 0.00:
    deadline = 12
    yearlytotal = float(0)
    statpay +=10
    outsbal = oribal
    while deadline > 0 and outsbal >= 0.00:
        principle = round(statpay-((annint*outsbal)/12),2)
        outsbal -= principle
        yearlytotal += statpay
        deadline -= 1
print 'With a monthly payment of $', statpay, ', your remaining balance will be $,', outsbal, 'at the end of ', 12-deadline, 'months.'

This completes the problem... for the most part. I wanna add a feature or 2. First, we were tracking our yearlytotal, may as well print it. Then we want it to tell us how many times the metaloop ran. SO! We add a variable called 'cycles' and then this to the metaloop:

cycles += 1

Then we have the printscript go as follows:

print 'With a monthly payment of $', statpay, ', your remaining balance will be $,', outsbal, 'at the end of ', 12-deadline, 'months. Why did you pay them a total of $', yearlytotal, ', dummy?!'

print 'By the by, it took me ', cycles, 'to figure this out.'

Hm. Do we wanna correct it so it always calculates for a year? Nah, it's probably just a matter of decreasing the increment of statpay. Speaking of which, time for problem 3~!

******Using Bisection Search to Make the Program Faster

You’ll notice that in problem 2, your monthly payment had to be a multiple of $10. Why did we make it that way? In a separate file, you can try changing the code so that the payment can be any dollar and cent amount (in other words, the monthly payment is a multiple of $0.01). Does your code still work? It should, but you may notice that your code runs more slowly, especially in cases with very large balances and interest rates.

How can we make this program faster? We can use bisection search (to be covered in lecture 3)!

We are searching for the smallest monthly payment such that we can pay off the debt within a year. What is a reasonable lower bound for this value? We can say $0, but you can do better than that. If there was no interest, the debt can be paid off by monthly payments of one-twelfth of the original balance, so we must pay at least this much. One-twelfth of the original balance is a good lower bound.

What is a good upper bound? Imagine that instead of paying monthly, we paid off the entire balance at the end of the year. What we ultimately pay must be greater than what we would’ve paid in monthly installments, because the interest was compounded on the balance we didn’t pay off each month. So a good upper bound would be one-twelfth of the balance, after having its interest compounded monthly for an entire year.

In short:

Monthly payment lower bound = Balance / 12.0
Monthly payment upper bound = (Balance * (1 + (Annual interest rate / 12.0)) ** 12.0) / 12.0

Problem 3

Write a program that uses these bounds and bisection search (for more info check out the Wikipedia page here) to find the smallest monthly payment to the cent (no more multiples of $10) such that we can pay off the debt within a year. Try it out with large inputs, and notice how fast it is. Produce the output in the same format as you did in problem 2. ******

Then, Jeopardy!

******Test Case 1

 >>> Enter the outstanding balance on your credit card: 320000
Enter the annual credit card interest rate as a decimal: .2
RESULT
Monthly payment to pay off debt in 1 year: 29643.05
Number of months needed: 12
Balance: -0.1

>>> Test Case 2 >>> Enter the outstanding balance on your credit card: 999999
Enter the annual credit card interest rate as a decimal: .18
RESULT
 Monthly payment to pay off debt in 1 year: 91679.91
Number of months needed: 12
Balance: -0.12 >>> ******

Now I look like an idiot for whining about 11 months earlier, because this totally fixes that. Okay! Let's code it out. All we really gotta do is add the bisection equation to this. So! ...um...

Variables: upbound, lowbound, calculated off the raw input as such:

lowbound = oribal/12.0
upbound = (oribal * (1 + (annint/12.0))**12.0)/12.0

Then the bisection function is easy: c = (a+b)/2. But since the solution to this equation might need to become the new upbound or lowbound depending on the answer. This one's makin' me head a little fuzzy! Bit harder than problem 2 just because of the math. Anyway, power through:

We need to make the metaloop more precise. outsbal >0 no longer works because the upper bound will force the result to go super negative and fail us in the task of finding the minimum amount to pay it off in a year. This means the balance needs to be negative, but not TOO negative; since we're determining to the nearest penny, that means the balance shouldn't be smaller than -11 cents or bigger than 0, no?

on that line of logic: if the balance is negative, our upper bound was too high. If the balance is positive, the lower bound was too low. Therefore: if outsbal >0 at the end of the loop, lowbound = statpay.

That can be accomplished with an 'if, else' clause. It's down there in the metaloop and does exactly what the paragraph above describes. What's important about its placement: this needs to happen in the metaloop, can't interfere with the initial definition of statpay, and must alter low or upbound before outsbal or statpay change.

outsbal = float(raw_input('Enter your debt, dummy: '))
annint = float(raw_input('Enter their skim rate, dummy: '))
oribal = outsbal
lowbound = round(oribal/12.0,2)
upbound = round((oribal * (1 + (annint/12.0))**12.0)/12.0,2)
statpay = lowbound
cycles = 0

while outsbal > 0 or outsbal < -0.11:
    yearlytotal = float(0)
    if outsbal > 0:
            lowbound = statpay
    else:
            upbound = statpay
    statpay = round((lowbound + upbound)/2,2)
    outsbal = oribal
    cycles += 1
    for month in range (1,13):
        principle = round(statpay-((annint*outsbal)/12),2)
        outsbal -= round(principle,2)
        yearlytotal += round(statpay,2)
             
print 'With a monthly payment of $', statpay, ', your remaining balance will be $,', round(outsbal,2), 'at the end of ', month, 'months. Why did you pay them a total of $', round(yearlytotal,2), ', dummy?!'

print 'By the by, it took me ', cycles, ' cycles to figure this out.'

This code almost works - it works for the first value, 320000, but not 999999. It enters an infinite loop on the 2nd value. Looking at Jeopardy!, the balance is exactly -0.12. Could it be that we can't have -.11 as our limit in the metaloop?! Let's try it: failure, still loops. We're check out some recitations...

One thing we learned is that a 'for' loop with a range of 1,13 might be more appropriate for our inner loop. The reason the 13 is there is because it doesn't actually calculate with the upper bound of the range. Also, our problem seems to come from the upbound portion of our if-else loop, particularly the 'else' portion. What happens if we throw an 'elif' for the 'success' range? Nothing, still breaks.

Perhaps the program doesn't know how to settle for 'good enough.' The solution includes a clause that breaks the metaloop when the upper bound and lower bound are within .005 of each other. What if we change our while loop to an if loop, like that one?

This is where we land:

#The following initial variables seem to be good:
oribal = float(raw_input('Enter your debt, dummy: '))
annint = float(raw_input('Enter their skim rate, dummy: '))
#These variables also seem to be good
outsbal = oribal
lowbound = outsbal/12
upbound = (outsbal*(1+(annint/12))**12)/12
cycles = 0
#The solution does things our code doesn't: first, it bothers to calculate the interest
#each month and adds it to the balance. Is this wrong? It seems like it would be
#good enough to simply calculate what amount of principle gets paid each month.
#It returned a good result, but could it contribute to the infinite loop? Perhaps.
#Let's modify our code to do what theirs does.
#This is where our program diverges from the solution. They start a boolean here.
while True:
   outsbal = oribal
   statpay = (lowbound + upbound)/2
   cycles+=1
   ##This portion simulates the passage of time. It'll run 12 times or until
   ##outsbal hits 0 or lower.
   for month in range(1,13):
      interest = round(outsbal*annint/12,2)
      outsbal += interest - statpay
      if outsbal <= 0:
         break
   ##Once the above loop is broken, this segment has 3 branches depending
   ##on the outcome. Once the difference between the upper and lower bound is
   ##less than half a penny, the program has determined the monthly payment to
   ##the nearest penny, rounds to it, and calculates the minimum monthly payment
   ##to pay it off in one year. If the balance dips below 0 but the difference
   ##between upper and lower bound is not less than half a penny, the program
   ##believes you have paid too much and begins anew with that monthly payment
   ## as the new upper limit. If neither of these conditions is met it's because
   ## you failed to pay off the loan with that monthly payment, so the program
   ## begins to promise anew with that payment as the new lower limit. I believe
   ## my version of the program, commented out below, could fail because it could
   ## infinitely find upper and lower bounds that never satisfied the criteria to
   ## break the while loop.
   if (upbound - lowbound < 0.005):
      statpay = round(statpay+0.004999,2)
      outsbal = oribal
      for month in range(1,13):
         interest = round(outsbal*annint/12,2)
         outsbal += interest - statpay
         if outsbal <= 0:
            break
      print 'With a monthly payment of $', statpay, ', your remaining balance will be $,', +round(outsbal,2), 'at the end of ', month, 'months. Why did you pay them a total of $', ##+round(yearlytotal,2), ', dummy?!'
      print 'By the by, it took me ', cycles, ' cycles to figure this out.',
      break
   elif outsbal <0:
      upbound = statpay
   else:
      lowbound = statpay
   

#rough time wrapping my head around this order of operations, but let's see.
#The while True: conditionals are outsbal = oribal and statpay = lowbound+ubpound/2.
#When one of those becomes false, then it terminates the loop? Of note here is
#the fact that statpay is altered


##Failed Code
##while outsbal > 0 or outsbal < -0.11:
##    yearlytotal = float(0)
##    if outsbal > 0:
##            lowbound = statpay
##    else:
##            upbound = statpay
##    statpay = round((lowbound + upbound)/2.0,2)
##    outsbal = oribal
##    cycles += 1
##    for month in range (1,13):
##        principle = round(statpay-((annint*outsbal)/12.0),2)
##        outsbal -= round(principle,2)
##        yearlytotal += round(statpay,2)
##              
##print 'With a monthly payment of $', statpay, ', your remaining balance will be $,', +round(outsbal,2), 'at the end of ', month, 'months. Why did you pay them a total of $', +round(yearlytotal,2), ', dummy?!'
##
##print 'By the by, it took me ', cycles, ' cycles to figure this out.'

We're calling this an almost-success and signing off because we're tiiiiiiiiiired.

Last stop, everybody off!

Thursday, February 11, 2016

I'm learning to code! Wanna learn with me?


I'm motivated to educate myself in a more practical way! Must be some kind of miracle. Let's see how long it lasts, shall we?

I've never been a big note-taker. It's probably time to change that, particularly because I'm going to be learning from a 'custom curriculum' compiled by agupieware.com. As such, I won't have classmates, in a traditional sense, won't be able to ask questions, and only have myself to account to. As such, maybe making notes in a public place can help provide the illusion of social interactivity.

Who knows, maybe I'll even snag some tips from the occasional eccentric who stumbles across a hashtag =P.

Thus far, I'm very early into the introductory phase: Lecture 3 in 'introduction to computer science and programming' from MIT. Remedial, even to me, who hasn't had any experience coding since High School and the occasional HTML. Still, I expect it's gonna ramp up pretty quick.

Anyhoo. Let's work on the assignments.

Crazy thinks. Gord's notes!

Let's learn by riding the stream of thought!

The assignment is themed; essentially one big story problem. Here's the premise:

------ Paying Off Credit Card Debt

Each month, a credit card statement will come with the option for you to pay a minimum amount of your charge, usually 2% of the balance due. However, the credit card company earns money by charging interest on the balance that you don’t pay. So even if you pay credit card payments on time, interest is still accruing on the outstanding balance.

Say you’ve made a $5,000 purchase on a credit card with 18% annual interest rate and 2% minimum monthly payment rate. After a year, how much is the remaining balance? Use the following equations.

Minimum monthly payment = Minimum monthly payment rate x Balance (Minimum monthly payment gets split into interest paid and principal paid)
Interest Paid = Annual interest rate / 12 months x Balance
Principal paid = Minimum monthly payment – Interest paid
Remaining balance = Balance – Principal paid

For month 1, we can compute the minimum monthly payment by taking 2% of the balance:

Minimum monthly payment = .02 x $5000.0 = $100.0

We can’t simply deduct this from the balance because there is compounding interest. Of this $100 monthly payment, compute how much will go to paying off interest and how much will go to paying off the principal. Remember that it’s the annual interest rate that is given, so we need to divide it by 12 to get the monthly interest rate.

Interest paid = .18/12.0 x $5000.0 = $75.0
Principal paid = $100.0 – $75.0 = $25

The remaining balance at the end of the first month will be the principal paid this month subtracted from the balance at the start of the month.

Remaining balance = $5000.0 – $25.0 = $4975.0

 For month 2, we repeat the same steps:

Minimum monthly payment = .02 x $4975.0 = $99.50
Interest Paid = .18/12.0 x $4975.0 = $74.63
Principal Paid = $99.50 – $74.63 = $24.87
Remaining Balance = $4975.0 – $24.87 = $4950.13

After 12 months, the total amount paid is $1167.55, leaving an outstanding balance of $4708.10. Pretty depressing! -------

Credit is such a racket. Anyhoo! Apparently there's 3 bits of code to write for this assignment. Let's check the instructions for this first one:

------Paying the Minimum

Problem 1

Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each month.

Use raw_input() to ask for the following three floating point numbers:

1. the outstanding balance on the credit card
2. annual interest rate
3. minimum monthly payment rate

For each month, print the minimum monthly payment, remaining balance, principle paid in the format shown in the test cases below. All numbers should be rounded to the nearest penny. Finally, print the result, which should include the total amount paid that year and the remaining balance. ------

Man. For being such a rudimentary program, it sure could help a lot of people. You know... the hypothetical final product, at least. Alright, I remember raw_input from last time. Somewhat. You write code that looks something like x = raw_input(Command the user to tell us what the hell he wants in these parenthesis)

The = and raw_input() are the key syntax here. = by itself transforms whatever precedes it into a variable - in this case, the familiar x. Even though x is first in the line, it's meaningless until = defines it - or tries to, with what follows.

Which is, of course, raw_input(). I think the lecturer said more recent versions of python cut the raw_ part of the syntax? Whatevs, we can roll with that punch when it's thrown. Back to the subject: raw_input instructs python to prompt the user to provide it with information.

So together, = raw_input() assigns the user's input to the variable preceding =. Fun refresher. SO! Apply it to the instructions, Gordo.

Ah, one last thing. We need to use the 'float' type so it only accepts numbers as input. We use 'float' instead of 'int' because 'int' won't accept decimals... I think.

outsbal = float(raw_input('Enter the amount you owe your idiot butthole creditors (to the nearest penny): '))
annint = float(raw_input('Enter the percent theyre going to skim off each year (the annual interest rate, and use a decimal to represent the percent. Dummy.): '))
minpay = float(raw_input('Enter the minimum you gotta fork over before they break your kneecap (as a decimal representing the percent): '))


I think that'll properly record all the input. We can make sure by commanding python to print these values, so let's do just that:

print 'You owe 'outsbal
print 'They skim 'annint 'converted to a percent annually.'
print 'You gotta fork over 'minpay 'times the current balance each month to stay afloat.'

Gonna test all this out. Ten bucks says I broke something...

Ha! You owe me Ten bucks. We forgot about using commas to separate print command components. It needs to look like this:

print 'You owe $', outsbal
print 'They skim ', annint, 'converted to a percent annually.'
print 'You gotta fork over ', minpay, 'times the current balance each month to stay afloat.'

Ironically, we succeeded in the essential part of the code and broke it in the part that tests the input. So, tiny success; we've defined 3 variables and asked for the user to define them. Moving on.

Now comes a hard part. We need to print a whole bunch of calculations based on this information, and we want to do it efficiently. 1 option is to use the same variables and transform them as we go; outsbal transforms with each month after the monthly payment is subtracted. The weakness here is the idea that the program will 'forget' what the original outstanding balance was.

The other option is to create a new variable for each month. I hate this idea and my initial reflex is we don't need to really consider this idea.

Of course, the option we'll choose is between: we'll create 1 new variable to remember the original balance, then let the program transform outsbal as it goes. So we'll add the following line of code to remember the original balance:

oribal = outsbal

Ran a quick test, and yes, this works: variables can be commanded to copy the value of another variable. Neat! Now we can move on again.

Next comes figuring out the calculation we'll make the computer do. Wait a second, math? Dammit, what am I, an accountant? Why're you assuming I know anything about compound interest? Ugh, whatever. I'll figure it out, but I'll resent you while I do it.

So. This sadist has provided us with the 'Jeopardy' answers to the questions our program will ask. We know what the data should look like if our program calculates the input correctly. In this case, the minimum monthly payment should be $96 dollars (2% of $4800 outstanding balance) Yep, easy enough. Alright, now for the most powerful force in the universe: interest. Annual interest rate is 20%. ...what exactly does that mean? That, assuming we pay the loan off in a year, the total amount paid should be 4800 * 1.2, yes? Okay. So that would be...5760. The interest would be $960. 10 times the minimum monthly payment. Ohmygaaaaawd this is dumb; alright, rally Gordo.

What are we trying to determine again? Well, we're trying to figure out how much a minimum monthly payment subtracts from the outstanding balance. We know the minimum monthly payment is $96. Because we know the Jeopardy! answers, we know that the first monthly payment is supposed to subtract $16 from the outstanding  balance for a remaining balance of $4784. Which means we pay $80 in interest for the month. Well, 960/80 = 12, because of course it does, because that's the number of months in a year. This wasn't nearly as hard as I made it out to be, was it?

The first step in the equation is to determine the minimum payment for the month. 4800 (outstanding balance) divided by minimum payment rate (2%). That equals 96. Next we determine the interest that needs to be paid that month. To do that, you apply the interest rate to the outstanding balance - 20% of $4800 is 960. 'Annual' means that's how much interest accrues over a full year, and since we're only paying for 1/12th of a year, we divide that annual interest by 12. We owe $80 in interest this month.

Finally, we subtract the interest from the minimum, then subtract that difference from the outstanding balance. At this stage, it means 4800-(96-80=4784. Let's bring that back to variables:

outsbal-((minpay*outsbal)-((annint*outsbal)/12))

Whew. Can we test that as the code? Let's have this equation transform outsbal and then print the result.

outsbal = (outsbal-((minpay*outsbal)-((annint*outsbal)/12)))
print outsbal

Holy butt, it exactly worked. I'm such a genius! What time did I start doing this? Let's just say it was an hour and a half ago. I'm a slow genius.

Alright, time to apply it harder. Let's print out everything we need for the month. This is gonna mean more variables. We need to display the monthly payment due: paydue. We need to display how much of that payment goes towards the principle: principle. The final bit of data for the month is just transformed outsbal, so no new variable needed there. Apply!

paydue = minpay*outsbal
print 'The minimum payment is $', paydue, 'this month.'
principle = paydue-((annint*outsbal)/12)
print 'Interest means you only paid $', principle, 'towards the outstanding balance.'
outsbal = outsbal-principle
print 'This means your new balance is $', outsbal

Success!

The next step is to repeat this step 12 times. We could write a linear program, but that's super inefficient. We want a loop - we want the computer to repeat this step 12 times with as little codes as possible, so we use a loop to make this code (or something like it) to repeat 12 times. Also, we need to keep track of how much we paid over the year - including interest! - so we can print it out once the loop concludes. That means a new variable: yearlytotal

That sounds easy, let's do the variable first:

paydue = minpay*outsbal
print 'The minimum payment is $', paydue, 'this month.'
principle = paydue-((annint*outsbal)/12)
print 'Interest means you only paid $', principle, 'towards the outstanding balance.'
outsbal = outsbal-principle

print 'This means your new balance is $', outsbal
yearlytotal = yearlytotal + paydue

Now we need to put that in a loop. Like, the whole damn thing. What's that look like? Lemme find the syntax real quick: the lecture is using a 'while' loop for its example cube root calculation, so let's see if we can for this, too.

while abs(ans**2-x) >= epsilon and ans <= x:
       ans += 0.00001
       numGuesses += 1

What this says in english is: while the absolute value of this function () is greater than or equal to the epsilon variable and the ans variable is less than or equal to x, repeat the loop. Looks like this += is a shortcut for my 'yearlytotal = yearlytotal + paydue' line, lemme integrate that rq...

paydue = minpay*outsbal
print 'The minimum payment is $', paydue, 'this month.'
principle = paydue-((annint*outsbal)/12)
print 'Interest means you only paid $', principle, 'towards the outstanding balance.'
outsbal -= principle

print 'This means your new balance is $', outsbal
yearlytotal += paydue

Hallelujah. Okay! Now, let's make a loop that terminates after 12 rounds. While we're at it, let's display each month in succession. This will require more variables. deadline to count down to the first anniversary and... do we need a variable to separate the months? I think we can get away with print 'Month ', 12-deadline, can't we?

deadline = 11
yearlytotal = 0
while deadline >= 0 and outsbal >= 0.00:
    print 'Month ', 12-deadline
    paydue = minpay*outsbal
    print 'The minimum payment is $', paydue, 'this month.'
    principle = paydue-((annint*outsbal)/12)
    print 'Interest means you only paid $', principle, 'towards the outstanding balance.'
    outsbal -= principle
    print 'This means your new balance is $',outsbal
    yearlytotal += paydue
    deadline -= 1

Works perfectly. Oo, I got chills! Okay, not really. There is a flaw! we need to keep it rounded to the penny. Python has a round function, let's find the syntax. It is...round(). Around the variable? No the lecture was coy, so let's just test it... no. Put round() around the function that defines the variable. This works perfectly:

outsbal = float(raw_input('Enter the amount you owe your idiot butthole creditors (to the nearest penny): '))
annint = float(raw_input('Enter the percent theyre going to skim off each year (the annual interest rate, and use a decimal to represent the percent. Dummy.): '))
minpay = float(raw_input('Enter the minimum you gotta fork over before they break your kneecap (as a decimal representing the percent): '))

oribal = outsbal

print 'You owe $', outsbal
print 'They skim ', annint, 'converted to a percent annually.'
print 'You gotta fork over ', minpay, 'times the current balance each month to stay afloat.'

deadline = 11
yearlytotal = 0
while deadline >= 0 and outsbal >= 0.00:
    print 'Month ', 12-deadline
    paydue = minpay*outsbal
    print 'The minimum payment is $', paydue, 'this month.'
    principle = paydue-((annint*outsbal)/12)
    print 'Interest means you only paid $', principle, 'towards the outstanding balance.'
    outsbal -= principle
    print 'This means your new balance is $',outsbal
    yearlytotal += paydue
    deadline -= 1

print 'Remember, you originally owed $', oribal

Okay, this exactly matches the Jeopardy! results! There's a 2nd set to test, though; we need to test this with 4% minimum payment. Does it match? ... yes it does. BOOM! This completed the problem! There are 2 more, but before we get to them, let's satisfy our curiosity and compute how much we wasted on interest this year, just to insult ourselves. Turns out, it looks like this:

##
outsbal = float(raw_input('Enter the amount you owe your idiot butthole creditors (to the nearest penny): '))
annint = float(raw_input('Enter the percent theyre going to skim off each year (the annual interest rate, and use a decimal to represent the percent. Dummy.): '))
minpay = float(raw_input('Enter the minimum you gotta fork over before they break your kneecap (as a decimal representing the percent): '))

oribal = outsbal

print 'You owe $', outsbal
print 'They skim ', annint, 'converted to a percent annually.'
print 'You gotta fork over ', minpay, 'times the current balance each month to stay afloat.'

deadline = 11
yearlytotal = float(0)
while deadline >= 0 and outsbal >= 0.00:
    print 'Month ', 12-deadline
    paydue = round(minpay*outsbal,2)
    print 'The minimum payment is $', paydue, 'this month.'
    principle = round(paydue-((annint*outsbal)/12),2)
    print 'Interest means you only paid $', principle, 'towards the outstanding balance.'
    outsbal -= principle
    print 'This means your new balance is $',outsbal
    yearlytotal += paydue
    deadline -= 1

print 'You paid $', yearlytotal, 'this year, you tool! And yet, your outstanding balance is still $', outsbal
print 'Remember, you originally owed $', oribal, '. That means your lenders got $', yearlytotal-(oribal-outsbal), 'in pure interest. Damn you, capitalism!'

##

That's the entire program. You can take my word for it, it works to the specifications of the assignment! Problem 1/3 down, ~3 hours later. Huh, wonder how that compares to the average student at MIT in 2011 taking 6.00SC Introduction to Computer Science and Programming. Eh, who cares? This feels like an achievement for me.

I did this after working all night! I'ma call it a success. We'll get back to it soon, or if not, we'll lose at life some more. We'll see what happens.

With that, the stream of thought ends.

Whew. Alright. This post contains curriculum from MIT OpenCourseWare http://ocw.mit.edu. This was my solution to problem 1 in problem set 1 of 6.00 SC Introduction to Computer Science and Programming ('due' for lecture 4, link here)

Thanks Boston, and agupieware.com. I'm a little more enriched today.

Monday, February 8, 2016

Chapter 3: Compromise

That's a nice wagon you have there, mister. Would be a shame if somethin' happened to it.

This episode starts here. Why not just dive in? If you have a good answer, then previous episodes start here. This chapter is down thar.

Chapter 3: Compromise

Jedrek felt a rising dread from the moment he saw the stranger’s wagon. Even from a distance, he could tell things weren’t as Maita left them. Cargo was scattered everywhere, and the feathered lizard was unhitched. Jedrek doubted any of this was part of the merchant’s agenda.


“Hey, Dahlia!” he shouted when he recognized her as the one rummaging through the wagon. Jaquan, Trent, and Idris were lounging on the driver’s bench, and Lyn was trying to get Bo and Maita’s lizard to care about each other’s sleepy existence. “Tell me you got permission before you did this!”


“O’ course,” she called back without bothering to look.


“Did she?!” Jedrek demanded of the others. Idris and Jaquan shrugged, and Trent ignored him. Jedrek sighed. “What could you possibly be looking for?”


“We’ll know when I find it!” Dahlia chuckled.


Jedrek sighed. “Look, everything goes back where you found it! That includes you, Trent and Idris!”


“Hush,” Trent said, focusing on whatever object he held.


“And this is Trent’s,” Idris replied. He opened his fist to show Jedrek the spongy organ, then went back to rhythmically squeezing it.  “It came out of the Curator.”


“Hey, yeah!” Dahlia crawled out of the wagon. “Let Jedrek try.”


“Try what?” he asked, still sullen with her.


“Here,” Idris offered the organ to him. “Squeeze it.”


“Ew,” Jedrek wrinkled his face, but accepted it. At least it was dry. He was aware that everyone was watching him, even Trent and Lyn. What’s that about?


He gave it a squeeze. His right arm spasmed, and pain shot up into his core. He yelped and dropped the offending object. The pain disappeared; the organ barely hit the ground before he was wondering if he’d just imagined it.


Jedrek’s siblings laughed as he flushed. “What was that for? You shouldn’t humiliate me for no reason!”


“Relax,” Dahlia retrieved the fallen sponge. “We all done it, we ain’t makin’ fun o’ ya. We just wanted to see if you’re one o’ the ones it can’t hurt.”


“Why did it hurt?” Jedrek asked, relieved he wasn’t being pranked. “What is it?”


“It generates sparks,” Trent replied. “Drops of lightning.” Dahlia squeezed the sponge, yelping and dropping it. Trent rolled his eyes. “It’s not something that’s going to get easier with practice, Dahlia.”


“You don’t know,” Dahlia grinned back at him.


“Electricity,” Jedrek knew a little about it. “So that’s what it feels like…”


“Electri-wha?” Dahlia asked.


“Drops of lightning,” Jedrek repeated. “It doesn’t affect all of us this way? Who doesn’t it hurt?”


“Trent!” Dahlia called. “Do it again!”
“Hush.” Trent ignored her.


“C’mon! Please?”


He sighed and held his hand toward her. She dropped the organ into his palm, and he obediently squoze. Beginning with the little strands on his arm, his hair began to stand on end, getting more extreme with each squeeze.


“Fascinating.” Jedrek’s hand found its way to his mouth. “That doesn’t hurt?”


“It’s my affinity.” Trent replied. “It’s expected. ‘Fascinating’ is the term I’d apply to Idris.”


“He’s immune too?” Jedrek pondered. He had been working the sponge when Jedrek arrived, back when he assumed it belonged to Maita. “Why doesn’t it make your hair stand?”


“Dunno,” Idris shrugged and accepted the organ back, immediately squeezing it again. “Feels kinda nice to me.”


“It’s probably how he resisted the attack that hurt Matron Cascata,” Jaquan added.


Trent groaned and looked exasperated. “Don’t ruin the experiment, Jaq! The subject should remain oblivious.”


“Like I couldn’t think about that myself?” Idris asked. “Wait, I’m an experiment?”

“If you come up with the theory yourself, there’s no helping it. I just hope it doesn’t influence the results.” Trent turned back to his object. “And of course you’re an experiment. You all are, when circumstances align.”


“Trent, you shouldn’t regard your siblings that way!” Jedrek lectured.


“Shouldn’t regard them ‘solely’ that way, Jed. And I don’t. They are my siblings first and experiments only when the scientific process will not harm them. Leave ethics to the elder, she’s much less screechy about it.”


Jedrek sighed, and let his attention shift away. He noticed Lyn between Bo and Maita’s lizard of the same species, both of whom seemed to be napping. Still, they were predators, and while Bo was famously well-behaved, he didn’t know if that translated to other members of the species.


“You okay over there, Lyn? What are you doing?”


“I’ve never seen another Bo,” she called back, sounding disappointed. “I thought he’d be happy to make a new friend, but neither of them seem to care.”


“It’s pretty clear he doesn’t dislike her, isn’t it? Or him, whatever. That aside, are you sure Maita’s Bo is not dangerous?”


“Don’t be dumb, Jed,” Lyn gave a dismissive wave of her hand. “She gets easy food from Maita. I’m too much work.”


“Ya gonna make sure all th’ field mice’re behavin’ too, Jed?” Dahlia wrapped her arm around his shoulders and leaned on him. “Is that fun ‘er somethin’? If so, tha’s the angriest sorta fun I ever seen!”


Jedrek sighed, “It’s not about fun, Dahl, but your observation is noted. It’s just… we have a guest, and it’s important we treat him well.”


“Ya do got a point there. Believe it ‘r not, I was thinkin’ o’ volunteering ta help ‘im with somethin’.”


“Oh?” This made Jedrek suspicious. “You sure he needs your brand of help?”


“Nah, but we’ll find out when he gets back.”


“Or maybe before.” Svara’s voice startled Jedrek, but he tried not to show it. When had she arrived? “Only a little before, though. They’re done, he’ll be here soon.”


“Yeah? How’d it go?” Dahlia asked.


“How’d what go?” Jedrek was even more suspicious.


“He wouldn’t wait and they wouldn’t rush. Looks like he’s on his own.” Svara reported.


“Perfect.” Dahlia grinned.
“What’s perfect?” Jedrek demanded. “Who’s on his own, Maita?”


“Yeah.” Dahlia nodded. “Or so he thinks.”


“What mischief are you planning, Dahlia?!”


“None!” Dahlia grinned and pat him on the head. “Stick around an’ see.”


The response disarmed him a little. “Good. And I think I will.”


They didn’t have to wait long. Maita soon trudged towards them, though he didn’t seem to notice their presence - or their mess - until Dahlia greeted him. “Oi. What’s gotcha daydreamin’ there, stranger?”


“Mm?” He snapped back to reality. “Ah, hey lass. Whatcha doin’?” He narrowed his eyes at the disarray. “Lose somethin’ in my stuff, did we?”


“Dahlia!” Jedrek shouted. “You said you had permission!”


“I dunno what tha’ word means, Jed.”


He was too furious to verify her claim.


“It’s fine, just help me clean it up so I can be on my way, okay?” Maita began to gather his scattered wares.


“Sure, but we ‘ave a condition.” Dahlia replied.


“Oh, so you know what that word means!” Jedrek set to helping Maita. “You’re in so much trouble, Dahlia!”


Dahlia rolled her eyes. “Trouble, ya say? Wha’s that mean?”


“Betcha she doesn’t have trouble with ‘extortion,’” Maita laughed. This plight actually seemed to brighten his mood. “Ya want a souvenir or something? I’m sure we can make something work.”


“Nah,” Dahlia said. “We wantcha to take us with ya.”
“You want to come to the south?” Maita asked.


“She means she wants to be one of the four warriors you requested,” Svara clarified.


Everyone was silent as they processed the revelation. Jedrek wasn’t sure what Svara meant. What had Maita requested warriors for?


“Someone’s got sharp ears,” he chuckled. “That how ya found me ‘fore I noticed you?”


“I used the same method, yes,” Svara admitted.


“I did ask for warriors,” Maita said. “Warriors. Not children. Sorry, but I’m not gonna risk your life just because you want to play grown-up.”


“Who’s playin’?” Dahlia was indignant. “I ain’t a child. Neither’s Svara!  Her’n me have been kickin’ ass around here, I’ll ‘ave ya know.”


“I hate to boast, but we were the ones to kill the thing from the silence,” Svara added. “Dahlia and I have seen many battles in the last few weeks.”


“Truth told, we kinda run things ‘round here,” Dahlia boasted.


Maita gave Svara a long look. “Your matron did say it was her new daughter from the north. I suppose you’re not lying, but it changes little. I’m not going there. It’s not worth the risk.”


“You are so,” Svara accused. “Because it’s very much worth the risk.”


“What are we even talking about?” Jedrek asked. “Where are you going that you would need warriors?”


“Nowhere,” Maita claimed. “Because I don’t have them.”


“War,” Dahlia dissented with a grin. “Tha’s where warriors go, dummy.”


“Then he’s right, Dahlia,” Jedrek said. “Your matron said ‘no.’ If Cascata denied him, then you should too!”


“She didn’t say ‘no,’ Jedrek,” Svara corrected. “She said ‘not now.’”


“That’s not much of a distinction,” Jedrek respected Svara than Dahlia, so it was harder to argue with her. How did Dahlia talk her into this, anyway? “The way I see it, you’re defying your matron.”


“She never told us not ta do this,” Dahlia pointed out.


“Only ‘cause she doesn’t know you plan to!”


“What she doesn’t know won’t hurt her,” Svara said.


“That’s not true in any way!” Jedrek cried. “She’s crippled right now because of things she didn’t know!”


Svara winced and her face reddened a little. “I spoke poorly. Still-”


“-we’re here ta fill the matron’s space while she’s down,” Dahlia finished. “We’re short on warriors right now, tha’s why she asked Maita ta wait. We’ll make up fer her an’ Kadmus an’ all them who fell these last weeks.”


“All the bravado in the world can’t make up for experience,” Maita said. “You’re just too young. You can’t be older than, what, seventeen? Even five more years and I might consider it. As it stands…”


“You hush up,” Dahlia ordered with a smirk. “We ain’t givin’ ya a choice.”


Maita laughed loud enough to startle the jumpier witnesses. “What, ya think this mess’ll keep me long? Correct me if I’m wrong, boy, but ya seem to think I can just enlighten your elder and my path will clear up real quick.”


“You’re not wrong, Mr. Maita,” Jedrek confirmed. “Not in the slightest.”


“Clear path don’t make a broke wagon move,” Dahlia said. “Trent gave me a few tips on how I might break it if ya tried somethin’ like that.”


“Trent?!” Jedrek turned on his smaller brother. “Why would you do something like that?”


“Because this is the correct strategy, Jedrek.” Trent was unfazed. “It’s a worthy gamble. We should risk it.”


“You protect your wagon, Maita,” Jedrek whispered to him. “I’ll tell the elder…”


“Not yet, you won’t.” Two big arms slid under his own and locked across his chest. “You can tell her once we’re on our way.”


“Idris!” Jedrek struggled, but his lazy brother was stronger than he looked. When did he get behind me?! “Is Dahlia’s crazy contagious or something?! Are you all in on this?”


“Lyn is,” Idris said. “She’s made friends with his beast. If he decides he can just leave his stuff and try to go without us, she might be able to keep it from obeying him. Honestly, that’s the least certain part of the plan. We’re hoping it doesn’t come to that.”


“And you, Jaquan?” Jedrek demanded. “Where do you stand?”


“I don’t, Jed.” Jaquan had tears in his eyes. “I don’t stand. I’m scared. They’re not wrong, I don’t think, but I don’t think I’m brave enough to help them. Yet I’m also afraid that if they go in there, they won’t come back. I’m even afraid if they stay, the monsters will come back and finish us off. Nothing’s safe anymore, Jed. What else we do?”


“Jaq…” Jedrek didn’t know what to say. If even Jaquan saw merit to this madness, maybe it wasn’t mad.


“There’s some trouble we can’t act our way out of,” Svara said. “You told the matron you’d go, even alone. Knowing the guards are gone and then discovering why; this opportunity is too good to pass up. We all agree, Maita. This window won’t open again. Let’s not miss our chance.”


The treasure hunter sighed and rubbed his head. “Never been cornered by kids before. Tell me, why are you so eager? What makes you so sure this is right?”


“It’s worked before,” Trent replied. “You’ve been told of the last battle, yes? Of the Curator? When he died, the horde was routed, the battle was won. If the Curator’s leader is defeated, then the war should be won. Going on the offensive has made him vulnerable. We should strike that vulnerability.”


“And if I’m wrong, and he’s not in there?” Maita asked.


“He was guarding something,” Svara replied. “He’s leaving something valuable unguarded. Even if it’s not a direct hit, it’s an opportunity to harm him. That can only help our cause.”

Maita was silent for several seconds, then chuckled. “We Bolons have been in the same business since Midway went dark. You guys know the key to runnin’ a family business?” When none of them answered, he laughed again. “It’s about swallowing your pride when the kids know better about something than you do. My pa almost ruined us when he couldn’t do it, I’ll have ya know. I’ll be damned if I make the same mistake.”

Know any teenagers? Watch your kneecaps and lunch money, then.