Elemental Evil: Sessions 5 and 6

It appears I forgot to chronicle the previous session of my D&D home campaign. The last report was from early July, after which we had a summer break, and then resumed mid-August, and then continued yesterday. Both of these sessions were action-centric, with the group clearing out first the abandoned village of Thundertree and then the goblin stronghold of Cragmaw Castle from monsters. A “door-monster-treasure” type of gameplay can be a lot of fun, but the details aren’t always all that interesting in a journal of events. So I will summarize and concentrate on the highlights in this post.

Thundertree is an abandoned village a day’s travel from Neverwinter. The eruption of Mount Hotenow, which caused quite a catastrophe for Neverwinter half a century ago, destroyed the village of Thundertree. Erdan, the druid of the group who is prone to visions and nightmares, dreamed that the eruption of Hotenow was caused by a group of chanting fire cultists, but probably didn’t go as planned, as the cultists were killed in the event. What remained in Thundertree was mostly abandoned houses, with a population of ash zombies and twig blights. The group had gone to Thundertree to meet the druid Reidoth, who was supposed to know the location of Cragmaw Castle. Their “pet goblin” Droop also claimed to be able to find the way from Thundertree to Cragmaw Castle. They met Reidoth, who was able to provide a safe haven in the village, as well as the directions needed.

After clearing out most of the village from monsters, the group came across another group which likewise was engaged in fighting twig blights. That group was wearing blue armor and white robes, beset with feathers. They explained that they were from a club of aerial enthusiasts, and were in Thundertree to try to tame a griffon nesting here, or get eggs from his nest to raise as aerial mounts. The heroes agreed to accompany them to the griffon’s lair in the highest tower of Thundertree. But once there the air cultists tried to becalm the griffon by offering the adventurers up as sacrifice, so the group ended up killing both the cultists and the griffon. They were able to make the link between a symbol the cultists carried and the same symbol they had seen on a letter to Glasstaff in Phandalin.

On the way to Cragmaw Castle the group tried to question Droop for information about the castle. That was somewhat complicated by the fact that Droop could only count to 3, and used “3” as an answer to any question about numbers in which the answer exceeded 2. Not trusting the goblin’s offer to negotiate safe entry into the castle, they knocked him out and attached him to a tree, guarded by the paladin (the player was absent that session). Instead they built a camouflage out of branches and approached the less guarded south side of the castle at night. From there they could see into the banquet hall, but the goblins there didn’t look out the arrow slits. So they managed after a few attempts to unlock the side door. But they didn’t like the idea of advancing with the goblins in the hall behind them, so they decided to attack there.

From there they moved clockwise room by room. That enabled them to eliminate most guards in small groups. However it did move them more towards the entrance of the castle, instead towards the throne room. The toughest fight was against a group of hobgoblins. Popée the sorceress used a web spell on them, but between succeeded saving throws initially and later the web wasn’t all that effective. Then they tried to burn the web, but in 5E that deals only 2d4 damage, and the player rolled double 1s, so the spell wasn’t really a big success. The hobgoblins however had an ability with which they dealt an extra 2d6 damage if next to an ally. And two of them rolled critical hits, which doubles the number of dice on all damage, knocking the druid out of his bear form. After another fight in the central chapel of the castle the group had enough and decided to go back into the woods to take a long rest.

Returning to the castle they found that the bugbear King Grol had obviously noticed that the group had raided his castle and killed most of the goblinoids in there. So King Grol has gathered all the remaining defenders in the chapel, including a priest from the air cult. That ended up being a tough fight, with Theren being knocked down to zero health, but then rescued. The air cultist priest was a real menace, with a dust devil spell that prevented the archers and casters from sniping from the back. But Popée used a scroll of lightning bolt on King Grol and his pet wolf, killing the wolf and seriously damaging the bugbear. Soon after all the bugbears were dead. The priest tried to transform into gaseous form and flee, but didn’t make it out of the arrow slit in one round and concentrated fire killed him before his next round. At this point it had gotten rather late, and we ended the session.

The return of third class travel

When railway travel was new in the 19th century, carriages came in three claases, 1st for the rich, 2nd for the middle class, and 3rd for the working class. That sort of class system went out of fashion in the 1950’s, and since then most railways only have 2 classes. So do many airplanes, having business and economy as choices, with “1st class” only available on a few long-haul flights.

I am currently sitting in a train, 1st class carriage, from Brussels to Paris. And I’m reading an announcement that from December on this high-speed railway will have economy, comfort, and prestige instead of 1st and 2nd class. Which of course means that if you travel economy, you are effectively travelling in 3rd class, there being two better options on offer. That isn’t an outlier, airlines have started to introduce “economy plus” between economy and business, also turning economy into 3rd class. We aren’t quite back to wooden benches yet, but everybody knows how comfort has diminished in economy class over the last decade. Frequent travellers have many a horror story to tell.

Somehow I feel there is a vicious circle involved here. As the name “business” suggests, the target customer for a business seat is a traveller whose ticket has been bought by his company. But many companies have become less generous over the years, forcing their employees to travel economy, at least on shorter voyages. So the idea of railroads and airlines is to get companies to at least pay for an intermediate option. But of course the response of companies is going to be to never pay for business class again, the economy plus option being deemed sufficient.

Of course a 3 class system is also a symptom of a less egalitarian, more unequal society. And as a student of history and economy I know that unequal societies have a strong tendency to go horribly wrong. So 3rd class isn’t something I think is a good idea.

Now is the Time to Learn Functional Programming !


What is Functional Programming?

Functional programming (often abbreviated FP) is the process of building software by composing pure functions, avoiding shared state, mutable data, and side-effects. Functional programming is declarative rather than imperative, and application state flows through pure functions. Contrast with object oriented programming, where application state is usually shared and collocated with methods in objects. It is a declarative programming paradigm, which means programming is done with expressions. In functional code, the output value of a function depends only on the arguments that are input to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) each time.
Functional code tends to be more concise, more predictable, and easier to test than imperative or object oriented code but if you’re unfamiliar with it and the common patterns associated with it, functional code can also seem a lot more dense, and the related literature can be impenetrable to newcomers. Some of the popular functional programming languages include: Lisp, Python, Erlang, Haskell, Clojure, Java etc.

Functional programming languages are categorized into two groups, i.e. 
Pure Functional Languages:- These types of functional languages support only the functional paradigms. For example − Haskell.
Impure Functional Languages:-  These types of functional languages support the functional paradigms and imperative style programming. For example − LISP.

Functional Programming Characteristics:

  • Function Closure Support
  • Higher-order functions
  • Use of recursion as a mechanism for flow control
  • No side-effects
  • A focus on what is to be computed rather then how to compute it
  • Referential transparency

Functional Programming Features:

First-Class Functions:- It means that you can store functions into a variable. i.e.

var add = function(a, b){
return a + b
}

High-Order Functions:- It means that functions can return functions or receive other functions as parameters. i.e.

var add = function(a){
return function(b){
return a + b
}
}

var add2 = add(2)
add2(3) // => 5

Pure Functions:- Pure Functions mean that the function doesn’t change any value, it just receives data and output data, just like our beloved functions from Mathematics. That also means that if you’d pass 2 for a function f and it returns 10, it’ll always return 10. Doesn’t it matter the environment, threads, or any evaluation order. They don’t cause any side-effects in other parts of the program and it’s a really powerful concept.

Closures:- Closures mean that you can save some data inside a function that’s only accessible to a specific returning function, i.e the returning function keeps its execution environment.

var add = function(a){
return function(b){
return a + b
}
}

var add2 = add(2)
add2(3) // => 5

Immutable State:- Immutable State means that you can’t change any state at all (even though you can get a new state).

Advantage of Functional Programming

  • Easier to write parallel code. The reason is immutable data structures.
  • More powerful expressions making the code more terse. Monoids, functors, lambdas to name a few.
  • Extensive type checking and a very powerful type system (in typed ones).
  • Homoiconicity in languages like LISP, which makes writing DSLs extremely easy.

Functional Programming v/s Object Oriented Programming

Functional Programming OOP
Uses Immutable data. Uses Mutable data.
Follows Declarative Programming Model. Follows Imperative Programming Model.
Supports Parallel Programming Not suitable for Parallel Programming
Its functions have no-side effects Its methods can produce serious side effects.
Flow Control is done using function calls & function calls with recursion Flow control is done using loops and conditional statements.
Execution order of statements is not so important. Execution order of statements is very important.

Functional Programming in Python

Python is not a functional programming language, but it is a multi-paradigm language that makes functional programming easy to perform, and easy to mix with other programming styles. Lets see the example of calculating total sum of values in a list. In this example we are using an imperative style function.
Calculating total sum of values using normal method

def sum_lst(lst):
total = 0
for number in lst:
total += number
return total

As we can see, our function has only one variable called total that is updated on every iteration. This is clearly a case of a mutable variable.

Now lets try a functional approach:

def sum_lst(lst):
if not lst:
return 0
else:
return lst[0] + sum_lst(lst[1:]) # values are returned but no variable is changed

This time we are not updating any variables and are using recursion, which is the functional programming way of doing loops.

Want to learn Python & Django

Merry Christmas!

Merry Christmas to you and your family!

I’d write my thoughts about my Switch, but frankly I’m still too busy having fun with Mario + Rabbids Kingdom Battles. And I haven’t even started Zelda or Super Mario Odyssey yet!

Amazon readying huge Digital Day 2017 discounts on Wonder Woman, WWE 2K18, and more

Amazon has announced that Digital Day will once again threaten our wallets in a final end of year sale chock full of huge savings. The second annual Digital Day is scheduled for December 29th and Amazon says it will be offering over 5,000 deals on movies, TV shows, apps, eBooks, and mobile games.

If you missed out on the first Digital Day sale last year, think of it like Prime Day but exclusively for digital items. As the name suggests, the biggest deals will last for just 24 hours, although some will go live as early as December 26th. You can sign up here to stay up to date with all of the offers, or you can follow #DigitalDay on social media.

Amazon has provided a sneak peek at some of the headline deals which include 60% off the fantastic live-action Wonder Woman movie on Amazon Video, 33% off video games like Sonic Forces, Civilization VI, NBA 2K18, and WWE 2K18, and up to 75% off on Kindle best-selling books like The Girl Who Takes an Eye for an Eye, The Silent Corner, and Modern Romance.

Here are some of the rest of the Digital Day deals set to drop in just over a week, plucked straight from an Amazon press release:

  • $10 Amazon.com credit when you subscribe to HBO NOW on Amazon
  • Save 25% off $49.99 Lapis bundle for Final Fantasy Brave Exvius
  • Save 50% off all in-game items for Marvel Puzzle Quest
  • Save up to 80% off in-game items for Playrix games
  • Save up to 75% off ROBLOX New Year’s Eve themed wearables
  • Save up to 80% off best-selling Marvel graphic novels like Civil War II, House of M, World War Hulk, and Star Wars
  • Three free audiobooks when you sign up for an Audible trial
  • 25% or more off PC software like Rosetta Stone and Adobe Creative Cloud Photography
    First 3 months free in Daily Burn streaming workouts

Digital Day bargains can be purchased via Amazon’s online store, the Amazon App and the Amazon Appstore (exclusively on Android). We’ll be keeping an eye out for any other great Digital Day deals, so be sure to watch this space for updates.

JavaScript Interview Questions for Freshers


What is JavaScript, really ?

JavaScript (“JS” for short) is a full-fledged dynamic programming language that, when applied to an HTML document, can provide dynamic interactivity on websites. It was invented by Brendan Eich, co-founder of the Mozilla project, the Mozilla Foundation, and the Mozilla Corporation.

JavaScript is incredibly versatile. You can start small, with carousels, image galleries, fluctuating layouts, and responses to button clicks. With more experience, you’ll be able to create games, animated 2D and 3D graphics, comprehensive database-driven apps, and much more!

*For online documentation on JavaScript , refer the doc of creators – mdn

**For the best class-room training on JavaScript at Mumbai connect with Rocky Sir

Leaving out the very simple and basic Interview Questions, at what questions do the fresh web developers get stuck ?  Here is a list :

1. Before-the-first-Round-of-JavaScript-Interview-Questions

      download a short and sweet PDF


2. 10-common-JavaScript-interview-questions (Click on the Question for viewing the answer)


3. Step-by-step solution for step counting using recursion

step counting _sctpl

For example, if you wanted to climb 4 steps, you can take the following distinct number of steps:

1) 1, 1, 1, 1
2) 1, 1, 2
3) 1, 2, 1
4) 2, 1, 1
5) 2, 2
So there are 5 distinct ways to climb 4 steps. We want to write a function, using recursion, that will produce the answer for any number of steps
answer-to-step-counting-using-recursion

4. Determine overlapping numbers in ranges

You will be given an array with 5 numbers. The first 2 numbers represent a range, and the next two numbers represent another range. The final number in the array is X. The goal of your program is to determine if both ranges overlap by at least X numbers. For example, in the array [4, 10, 2, 6, 3] the ranges 4 to 10 and 2 to 6 overlap by at least 3 numbers (4, 5, 6), so your program should return true.
answer-to-determine-overlapping-numbers-in-ranges 



5. Find all duplicates in an array



This is a common interview question where you need to write a program to find all duplicates in an array. The elements in the array have no restrictions, but in this algorithm we’ll work specifically with integers. Finding duplicates in an array can be solved in linear time by using a hash table to store each element as we pass through the array. The general algorithm is: 


(1) Loop through the array
(2) At each element check if it exists in the hash table, which has a lookup of O(1) time
(3) If the element exists in the hash table then it is a duplicate, if it doesn’t exist, insert it into the hash table, also O(1)

for-complete-solution-to-finding-all-duplicates-in-an-array


6Two sum problem


The two sum problem is a common interview question, and it is a variation of the subset sum problem. There is a popular dynamic programming solution for the subset sum problem, but for the two sum problem we can actually write an algorithm that runs in O(n) time.

The challenge is to find all the pairs of two integers in an unsorted array that sum up to a given S. For example, if the array is [3, 5, 2, -4, 8, 11] and the sum is 7, your program should return [[11, -4], [2, 5]] because 11 + -4 = 7 and 2 + 5 = 7.

for-complete-solution-to-Two-sum-problem

7. Stock maximum profit

You will be given a list of stock prices for a given day and your goal is to return the maximum profit that could have been made by buying a stock at the given price and then selling the stock later on. For example if the input is: [45, 24, 35, 31, 40, 38, 11] then your program should return 16 because if you bought the stock at $24 and sold it at $40, a profit of $16 was made and this is the largest profit that could be made. If no profit could have been made, return -1.


for-complete-solution-to-Stock-maximum-profit


Land of Livia

For the last two weeks I have been playing Land of Livia. Overall that took me maybe an hour, which pretty much tells you the most important thing you need to know about the game: It uses real time as a game element. And no, you can’t speed that up with microtransactions, there aren’t any. The prelude chapter is free, and then the first chapter costs just €4.49. But you need to be at ease with the slow flow to enjoy it.

Land of Livia is a role-playing game with not much in the way of graphics. Your main activity is going on quests, which nets you gold and equipment, which increases your three main stats. Your level depends on your highest stat. Each quest has a success chance based on the corresponding stat, and just requires you to wait up to 1 hour in real time. If you choose a quest that is comparatively difficult, your chance to succeed is low, but if you should succeed the reward is comparatively more valuable to you. Apart from going on quests, you can move, spend money listening in taverns to find new locations, or play mini-games to improve gems or discover lore. Overall you follow a main story, but there are side-stories as well, so it isn’t completely linear.

I tried to play this on my iPad, but somehow my typical tablet use wasn’t a good fit with the pace of the game. Then I started playing on my iPhone instead, with a silent notification every time a quest finished, and that worked much better. But of course sometimes I don’t notice, or I am in a situation where I can’t pull out my phone to make a move. So progress is rather slow. Might not be for everybody. However, as the game is free to try, I can only recommend you check it out for yourself.

AIrrowy takes your mind off signals while keeping roads safe

Don’t you hate it when people don’t use their turn signals? I have to say most of my close calls have been due to drivers failing to use these handy lights. And it seems my experience is backed by a study from the Society of Automotive Engineers, which claims about 2 million accidents a year are caused by drivers not signaling a change of lane or turn. 

Other featured campaigns:

  • Elf Smart Plug makes your home intelligent for cheap
  • PLY is a motorcycle smart helmet that won’t break the bank
  • NOCABLE battery pack charges your smartphone wirelessly

Why is it such a hassle to simply move a lever. Not to defend those who don’t follow the rules, but driving is an attention hog. You have to look for cars, motorcycles, bicycles, lanes, signs, people, animals, debris, speed limits and more. There are plenty of distractions that could endanger your life, so maybe drivers just forget to reach for that lever in the middle of chaos. We are all human, after all, so a little help couldn’t hurt. 

We have come across a very neat tool being featured on Kickstarter. It goes by the name of AIrrowy and automates turn signal actions. The process is simple. Once installed on your vehicle (cars, motorcycles, etc.), it connects to your smartphone via Bluetooth and uses an app to predict your driving route. In essence, it is a simplified navigator that knows when and where you are turning. Signals will be activated accordingly.

Interested? The Kickstarter campaign only has a bit over 2 days to go, so you best make your move soon. You can get an AIrrowy for as low as €68. Shipments are estimated to start on April 2018, though, so you will have to wait a few months to stop worrying so much about signals. 

What do you guys think of these automated driving technologies? Will they spoil drivers? Should users still keep an eye on signals to make sure everything is functioning properly? After all, even big names like Tesla have had failures. 

Check out AIrowwy

Uses and abuses of challenge

Once upon a time, in a past so long a go that few people remember it, computer games came with an options menu in which you could choose the difficulty and challenge of the game yourself. The idea was that all of us would like games to be both winnable and not a pushover, but because preferences on how easily winnable a game should be, as well as experience and skill in a game, vary from user to user, it would be best to have several options in order to please everybody. Now that was way back when games still came in a box. With games increasingly switching to a “game as a service” online experience, difficulty settings fell out of favor. Somehow it appeared to make more sense if the same orc in World of Warcraft held the same challenge for each player, with the only variable being the power level of the player himself. With less and less single-player games around, and PvE games being more and more replaced by PvP, difficulty setting have become increasingly rare.

I’ve been playing a bunch of pseudo-PvP games on my iPad lately. Pseudo because I don’t necessarily fight another player online at the same time, but my army fights his computer-controlled army. That usually was nice enough at the start of the game. But then with each win I gained some sort of trophies or ranking, so that later I was matched against more and more powerful players. Ultimately it was obvious that this was a no-win proposition: The better I did, the more likely it became that I would lose the next game. The only strategy that worked was to deliberately lose games, to drop down in rankings, to then win the now easier PvP games in order to achieve the quests and goals the game set me. But that sort of cheesy strategy isn’t exactly fun.

The other type of game I played recently is the one in which your performance doesn’t actually matter at all any more. I played Total War: Arena, but many team vs. team multiplayer games fall into the same category: The contribution of any single player to the outcome of a 10 vs. 10 battle is only 5%. That gets quite annoying if you come up with a brilliant move and outmaneuver another player and crush him, only to find that the 9 other players on the enemy team obliterated your 9 team mates, and you lost the battle. Especially since in Total War: Arena you end up with more rewards having done nothing much in a won battle than for a great performance in a lost battle.

Finally my wife was complaining about a problem with challenge levels in her iPad puzzle games: The games are free to play, they get harder and harder with each level until you can’t beat it any more, and then the game offers you a way out: Use some sort of booster, which of course you need to pay real money for, to make the too hard levels easy enough to win again.

Somehow I get the feeling we lost something important when difficulty sliders went out of fashion. However the discussion of difficulty and challenge is complicated by the fact that this is one of the issues where gamers are the most dishonest about. Gamers tend to say they want more challenge, but when you observe what they are doing, e.g. attacking the enemy castle in a PvP MMORPG at 3 am in the morning, it is clearly that they are mostly occupied with avoiding or circumventing any actual challenge. Pay2Win and loot boxes wouldn’t be such an issue if gamers weren’t actually spending their money on improving their chances to win. If most gamers were so interested in challenge, then why is there so much cheating and botting going on? People want to win, by any means, and by talking up the challenge they want to make their win look more impressive. Which is kind of sad, if you think about it, that their positive self-image depends on being a winner in a video game. Many a fragile gamer-ego can’t admit that they’d quite like a relaxing game that doesn’t constantly challenge them to the max. I do.

D&D Reader

Another app for players of Dungeons & Dragons has been announced, called D&D Reader. Basically it is a kind of e-book reader only for D&D rulebooks and adventures. Instead of bringing a backpack full of books to your game, you bring a single tablet with all the information on it. And to some extent it is searchable, which isn’t the case for paper books.

Now a few years ago I would have said that this is a brilliant idea, exactly what I needed. But since then I spent $280 to get access to all D&D books in digital form on D&D Beyond. As long as I have internet access, that gives me the same functionality: Able to read any D&D book on my tablet and search it. But the new D&D reader app is from a different company. So, you guessed it, if I wanted to use that app as well, I would need to pay *again* for all those books. Which would be the third time, since I already own the books in paper format and on D&D Beyond. Just to have offline access. No thanks!

Wizards of the Coast really need to rethink their strategy on this one. In this time and age it is a great idea to have content available in different ways, paper, online, and offline digital. But a full collection of D&D books is already expensive to buy once. The paper books should include a coupon for all digital versions. I was already exaggerating by buying the books twice, but who on earth is going to go for a third version at full price?