and has 0 comments

  I consider Peter F. Hamilton to be one of the great science fiction writers. Yes, he has a formula, yes he messes up the endings, but the ideas and worlds that he puts on paper have rarely disappointed me. I can't say that of Salvation, either, but I didn't especially like it, as it gives away too much too soon, then proceeds on boring or enraging the reader with police procedural vignettes that we already know will have no impact on future events.

  Hamilton has this method of combining at least two threads, usually one is hard science fiction and the other is fantasy or police procedural or something different, only to bind them together at some point in time. In this book, we see a group of people running away from an enemy species bent on exterminating humanity and also a peaceful future in which humanity has discovered how to create instantaneous transport portals to other places and was contacted by two different alien species. Somehow, how we get from one point to the other is the topic of the book, but the vast majority of it is about corporate security people that abuse their power to "get things done" or toxic cleanup people or other kinds of short stories that only bring some new information to light while eating up reading time. Then the book ends!

  And it's a bit annoying that even the technical aspects don't add up, like how you can know how to make portals, but you still rely on nuclear weapons or rockets to do war, or that people fear sabotage and terrorism, but don't see the possible threat posed by personal portals to other worlds. Gravity alterations, atmosphere loss or pollution, a portal from a star to an inhabited area would have been much more dangerous. Also some of the ways characters act are completely unnatural and it feels jarring to see them do things in a sequence (heh!) only to further the story and not consistent to their character and expertise.

  Anyway, I am reading Salvation Lost now, but in my view the first book in this series could have been a lot more, especially from a brilliant writer such as Hamilton.

and has 0 comments

  This is How You Lose the Time War came highly recommended by a Goodreads buddy of mine as the way to write sci-fi. I don't know what to say about that. He was so ebullient about how great the book was that there was bound to be some disappointment. It is nicely written and touches, under the guise of science fiction, the intricacies of human relationships and feelings. But other than that it was just one idea, stretched over 200 pages, in something that was both short and felt unreasonably long. Perhaps some time issues need arise when time travel is involved.

  What I found interesting is that it is a double author book. Amal El-Mohtar and Max Gladstone worked on it together although I suspect it was mostly El-Mohtar with the story and Gladstone with the tech stuff, although I could be just stereotyping. To me, it felt like the story has a distinctly female vibe.

  Bottom line: it's a very humanist type of story: the time war, the tech, they are all props. One could have written the same kind of stuff about African tribes or corporate lawyers. After a while everything started to feel repetitive and stale only to reach the all too predictable ending. Nice book, but not great.

  I was looking into the concept of partial sorting, something that would help in a scenario where you want the k smaller or bigger items from an array of n items and k is significantly smaller than n. Since I am tinkering with LInQer, my implementation for LINQ methods in Javascript, I wanted to tackle the OrderBy(...).Take(k) situation. Anyway, doing that I found out some interesting things.

  First, the default Javascript array .sort function has different implementations depending on browser and by that I mean different sort algorithms. Chrome uses insertion sort and Firefox uses merge sort. None of them is Quicksort, the one that would function best when the number of items is large, but that has worst case complexity O(n^2) when the array is already sorted (or filled with the same value).

I've implemented a custom function to do Quicksort and after about 30000 items it becomes faster than the default one.  For a million items the default sort was almost three times slower than the Quicksort implementation. To be fair, I only tested this on Chrome. I have suspicions that the merge sort implementation might be better.

  I was reporting in a previous version of this post that QuickSort, implemented in Javascript, was faster than the default .sort function, but it seems this was only an artifact of the unit tests I was using. Afterwards, I've found an optimized version of quicksort and it performed three times faster on ten million integers. I therefore conclude that the default sort implementation leaves a lot to be desired.

  Second, the .sort function is by default alphanumeric. Try it: [1,2,10].sort() will return [1,10,2]. In order to do it numerically you need to hack away at it with [1,2,10].sort((i1,i2)=>i1-i2). In order to sort the array based on the type of item, you need to do something like: [1,2,10].sort((i1,i2)=>i1>i2?1:(i1<i2?-1:0)).

  Javascript has two useful functions defined on the prototype of Object: toString and valueOf. They can also be overwritten, resulting in interesting hacks. For some reason, the default .sort function is calling toString on the objects in the array before sorting and not valueOf. Using the custom comparers functions above we force using valueOf. I can't test this on primitive types though (number, string, boolean) because for them valueOf cannot be overridden.

  And coming back to the partial sorting, you can't do that with the default implementation, but you can with Quicksort. Simply do not sort any partition that is above and below the indexes you need to get the items from. The increases in time are amazing!

  There is a difference between the browser implemented sort algorithms and QuickSort: they are stable. QuickSort does not guarantee the order of items with equal sort keys. Here is an example: [1,3,2,4,5,0].sort(i=>i%2) results in [2,4,0,1,3,5] (first even numbers, then odd, but in the same order as the original array). The QuickSort order depends on the choice of the pivot in the partition function, but assuming a clean down the middle index, the result is [4,2,0,5,1,3]. Note that in both cases the requirement has been met and the even numbers come first.

and has 0 comments

  A Short History of Nearly Everything is very well researched, subtly written and does pretty much what it says: explain the history of science up to the present as humanity is trying to figure out where it came from, how long ago it happened and how things actually work. It's a dense work, which makes it a long read. You either go through it and not retain much or you have to read bit by bit and think on each for a while. I read it bit by bit and retained little.

  Anyway, as I was reading The Invention of Nature, another great popular science book, I've stumbled upon this quote "There are three stages of scientific discovery: first people deny it is true; then they deny it is important; finally they credit the wrong person." and never have I thought about it so much as when reading A Short History of Nearly Everything. In fact, the same quote appears in the book near the end. As Bill Bryson describes it, most of science is accidental and has to fight a plethora of egos that believe they are better than you just in order to surface. Many times the work is lost, misattributed, stolen or sabotaged into oblivion by personal opponents. As such, the book has a wonderful freshness from the tired history of science that we are so often presented where very smart people think of something and then everybody applauds and accepts another idea that will further human knowledge. The book is also about how little we know about many things that usually are presented as completely clear, fully researched and completely understood. All in all, it's a book that needs reading.

  "So", you will say, "isn't this another Sapiens?". No. I liked Sapiens and its funny and accessible style made it an instant hit worldwide. A Short History of Nearly Everything is way better. It focuses more on sciences like geology and anthropology and abstract physics and on the personal histories of the people involved in the discoveries rather than on humanity as a whole, so it's a bit harder. When it does look at humanity it sees it as small, petty and destructive. Sapiens makes you feel good, this makes you feel ashamed and happy you are still alive.

  I have to say that I almost abandoned reading it; it is that dense and full of information. If I was reading a novel in three days, spending weeks trudging through knowledge made me feel both too stupid and getting smarter at the same time. Surely I could find a better way to entertain myself, I thought. This book is entertaining, but it requires focus to read and understand. In the end, I am very glad I've read it.

The code for this series of posts can be found at https://github.com/Siderite/Complementary

  I was helping a friend with basic programming and I realized that I've been so caught up with the newest fads and development techniques that I've forgotten about simple programming, for fun, with just the base principles and tools provided "out of the box". This post will demonstrate me messing up writing a game using HTML and Javascript only.

Mise en place

This French phrase is used in professional cooking to represent the preparation of ingredients and utensils before starting the actual cooking. We will need this before starting developing our game:

  • description: the game will show a color and the player must choose from a selection of other colors the one that is complementary
    • two colors are complementary if when they are mixed, they cancel each other out, resulting in a grayscale "color" like white, black or some shade of gray. Wait! Was that the metaphor in Fifty Shades of Grey?
  • technological stack: HTML, Javascript, CSS
    • flavor of Javascript: ECMAScript 2015 (also known as ES6)
    • using modules: no - this would be nice, but modules obey CORS, so you won't be able to run it with the browser from the local file system.
    • unit testing: yes, but we have to do it as simply as possible (no external libraries)
  • development IDE: Visual Studio Code
    • it's free and if you don't like it, you can just use Notepad to the same result
  • source control: Git (on GitHub)

Installing Visual Studio Code

Installing VS Code is just as simple as downloading the installer and running it.

Then, select the Open Folder option, create a project folder (let's call it Complementary), then click on Select Folder.

The vanilla installation will help you with syntax highlighting, code completion, code formatting.

Project structure

For starters we will need the following files:

  • complementary.html - the actual page that will be open by the browser
  • complementary.js - the Javascript code
  • complementary.css - the CSS stylesheet

Other files will be added afterwards, but this is the most basic separation of concerns: code and data in the .js file, structure in .html and presentation in .css.

Starting to code

First, let's link the three files together by writing the simplest HTML structure:

<html>
    <head>
        <link rel="stylesheet" href="complementary.css"/>
        <script src="complementary.js"></script>
    </head>
    <body>
        
    </body>
</html>

This instructs the browser to load the CSS and JS files. 

In the Javascript file we encapsulate out logic into a Game class:

"use strict";
class Game {
  init(doc) {
    this._document = doc;
    this._document.addEventListener('DOMContentLoaded',this.onLoad.bind(this),false);
  }
  onLoad() {

  }
}

const game=new Game();
game.init(document);

We declared a class (a new concept in Javascript ES6) and a method called init that receives a doc. The idea here is that when the script is loaded, a new Game will be created and the initialization function will receive the current document so it can interact with the user interface. We used the DOMContentLoaded event to call onLoad only when the page document object model (DOM) has been completely loaded, otherwise the script would run before the elements have been loaded.

Also, not the use of the bind method on a function. addEventListener expects a function as the event handler. If we only specify this.onLoad, it will run the function, but with the this context of the event, which would be window, not our game object. this.onLoad.bind(this), on the other hand, is a function that will be executed in the context of our game.

Now, let's consider how we want to game to play out:

  • a guide color must be shown
    • this means the color needs to be generated
  • a list of colors to choose from must be displayed
    • colors need to be generated
    • one color needs to be complementary to the guide color
    • color elements need to respond to mouse clicks
  • a result must be computed from the chosen color
    • the outcome of the user choice must be displayed
    • the score will need to be calculated

This gives us the structure of the game user interface. Let's add:

  • a guide element
  • a choice list element
  • a score element
<html>
    <head>
        <link rel="stylesheet" href="complementary.css"/>
        <script type="module" src="complementary.js"></script>
    </head>
    <body>
        <div id="guideColor"></div>
        <div id="choiceColors"></div>
        <div id="score"></div>
    </body>
</html>

Note that we don't need to choose how they look (that's the CSS) or what they do (that's the JS).

This is a top-down approach, starting from user expectations and then filling in more and more details until it all works out.

Let's write the logic of the game. I won't discuss that too much, because it's pretty obvious and this post is about structure and development, not the game itself.

"use strict";
class Game {
    constructor() {
        // how many color choices to have
        this._numberOfChoices = 5;
        // the list of user scores
        this._log = [];
    }
    init(doc) {
        this._document = doc;
        this._document.addEventListener('DOMContentLoaded', this.onLoad.bind(this), false);
    }
    onLoad() {
        this._guide = this._document.getElementById('guideColor');
        this._choices = this._document.getElementById('choiceColors');
        // one click event on the parent, but event.target contains the exact element that was clicked
        this._choices.addEventListener('click', this.onChoiceClick.bind(this), false);
        this._score = this._document.getElementById('score');
        this.startRound();
    }
    startRound() {
        // all game logic works with numeric data
        const guideColor = this.randomColor();
        this._roundData = {
            guideColor: guideColor,
            choiceColors: this.generateChoices(guideColor),
            tries: new Set()
        };
        // only this method transforms the data into visuals
        this.refreshUI();
    }
    randomColor() {
        return Math.round(Math.random() * 0xFFFFFF);
    }
    generateChoices(guideColor) {
        const complementaryColor = 0xFFFFFF - guideColor;
        const index = Math.floor(Math.random() * this._numberOfChoices);
        const choices = [];
        for (let i = 0; i < this._numberOfChoices; i++) {
            choices.push(i == index
                ? complementaryColor
                : this.randomColor());
        }
        return choices;
    }
    refreshUI() {
        this._guide.style.backgroundColor = '#' + this._roundData.guideColor.toString(16).padStart(6, '0');
        while (this._choices.firstChild) {
            this._choices.removeChild(this._choices.firstChild);
        }
        for (let i = 0; i < this._roundData.choiceColors.length; i++) {
            const color = this._roundData.choiceColors[i];
            const elem = this._document.createElement('span');
            elem.style.backgroundColor = '#' + color.toString(16).padStart(6, '0');
            elem.setAttribute('data-index', i);
            this._choices.appendChild(elem);
        }
        while (this._score.firstChild) {
            this._score.removeChild(this._score.firstChild);
        }
        const threshold = 50;
        for (let i = this._log.length - 1; i >= 0; i--) {
            const value = this._log[i];
            const elem = this._document.createElement('span');

            elem.className = value >= threshold
                ? 'good'
                : 'bad';
            elem.innerText = value;
            this._score.appendChild(elem);
        }
    }
    onChoiceClick(ev) {
        const elem = ev.target;
        const index = elem.getAttribute('data-index');
        // just a regular expression test that the attribute value is actually a number
        if (!/^\d+$/.test(index)) {
            return;
        }
        const result = this.score(+index);
        elem.setAttribute('data-result', result);
    }
    score(index) {
        const expectedColor = 0xFFFFFF - this._roundData.guideColor;
        const isCorrect = this._roundData.choiceColors[index] == expectedColor;
        if (!isCorrect) {
            this._roundData.tries.add(index);
        }
        if (isCorrect || this._roundData.tries.size >= this._numberOfChoices - 1) {
            const score = 1 / Math.pow(2, this._roundData.tries.size);
            this._log.push(Math.round(100 * score));
            this.startRound();
        }
        return isCorrect;
    }
}

const game = new Game();
game.init(document);

This works, but it has several problems, including having too many responsibilities (display, logic, handling clicks, generating color strings from numbers, etc).

And while we have the logic and the structure, the display leaves a lot to be desired. Let's fix this first (I am terrible with design, so I will just dump the result here and it will be a homework for the reader to improve on the visuals).

First, I will add a new div to contain the three others. I could work directly with body, but it would be ugly:

<html>

<head>
    <link rel="stylesheet" href="complementary.css" />
    <script src="complementary.js"></script>
</head>

<body>
    <div class="board">
        <div id="guideColor"></div>
        <div id="choiceColors"></div>
        <div id="score"></div>
    </div>
</body>

</html>

Then, let's fill in the CSS:

body {
    width: 100vw;
    height: 100vh;
    margin: 0;
}
.board {
    width:100%;
    height:100%;
    display: grid;
    grid-template-columns: 50% 50%;
    grid-template-rows: min-content auto;
}
#score {
    grid-column-start: 1;
    grid-column-end: 3;
    grid-row: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
}
#score span {
    display: inline-block;
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: darkgray;
    margin-left: 2px;
}
#score span.good {
    background-color: darkgreen;
}
#score span.bad {
    background-color: red;
}
#guideColor {
    grid-column: 1;
    grid-row: 2;
}
#choiceColors {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
}
#choiceColors span {
    flex-grow: 1;
    cursor: pointer;
}
#choiceColors span[data-result=false] {
    opacity: 0.3;
}

I used a lot of flex and grid to display things.

The game should now do the following:

  • displays a left side color
  • displays five rows of different colors in the right side
  • clicking on any of them modifies the score (each wrong choice halves the maximum score of 100)
  • when there are no more moves left or the correct choice is clicked, the score is added to a list at the top of the board
  • the score tiles are either green (score>=50) or red

However, I am dissatisfied with the Javascript code. If Game has too many responsibilities it is a sign that new classes need to be created.

Refactoring the code

First, I will encapsulate all color logic into a Color class.

class Color {
    constructor(value = 0  /* black */) {
        this._value = value;
    }
    toString() {
        return '#' + this._value.toString(16).padStart(6, '0');
    }
    complement() {
        return new Color(0xFFFFFF - this._value);
    }
    equals(anotherColor) {
        return this._value === anotherColor._value;
    }
    static random() {
        return new Color(Math.round(Math.random() * 0xFFFFFF));
    }
}

This simplifies the Game class like this:

class Game {
    constructor() {
        // how many color choices to have
        this._numberOfChoices = 5;
        // the list of user scores
        this._log = [];
    }
    init(doc) {
        this._document = doc;
        this._document.addEventListener('DOMContentLoaded', this.onLoad.bind(this), false);
    }
    onLoad() {
        this._guide = this._document.getElementById('guideColor');
        this._choices = this._document.getElementById('choiceColors');
        // one click event on the parent, but event.target contains the exact element that was clicked
        this._choices.addEventListener('click', this.onChoiceClick.bind(this), false);
        this._score = this._document.getElementById('score');
        this.startRound();
    }
    startRound() {
        // all game logic works with numeric data
        const guideColor = Color.random();
        this._roundData = {
            guideColor: guideColor,
            choiceColors: this.generateChoices(guideColor),
            tries: new Set()
        };
        // only this method transforms the data into visuals
        this.refreshUI();
    }
    generateChoices(guideColor) {
        const complementaryColor = guideColor.complement();
        const index = Math.floor(Math.random() * this._numberOfChoices);
        const choices = [];
        for (let i = 0; i < this._numberOfChoices; i++) {
            choices.push(i == index
                ? complementaryColor
                : Color.random());
        }
        return choices;
    }
    refreshUI() {
        this._guide.style.backgroundColor = this._roundData.guideColor.toString();
        while (this._choices.firstChild) {
            this._choices.removeChild(this._choices.firstChild);
        }
        for (let i = 0; i < this._roundData.choiceColors.length; i++) {
            const color = this._roundData.choiceColors[i];
            const elem = this._document.createElement('span');
            elem.style.backgroundColor = color.toString();
            elem.setAttribute('data-index', i);
            this._choices.appendChild(elem);
        }
        while (this._score.firstChild) {
            this._score.removeChild(this._score.firstChild);
        }
        const threshold = 50;
        for (let i = this._log.length - 1; i >= 0; i--) {
            const value = this._log[i];
            const elem = this._document.createElement('span');

            elem.className = value >= threshold
                ? 'good'
                : 'bad';
            elem.innerText = value;
            this._score.appendChild(elem);
        }
    }
    onChoiceClick(ev) {
        const elem = ev.target;
        const index = elem.getAttribute('data-index');
        // just a regular expression test that the attribute value is actually a number
        if (!/^\d+$/.test(index)) {
            return;
        }
        const result = this.score(+index);
        elem.setAttribute('data-result', result);
    }
    score(index) {
        const expectedColor = this._roundData.guideColor.complement();
        const isCorrect = this._roundData.choiceColors[index].equals(expectedColor);
        if (!isCorrect) {
            this._roundData.tries.add(index);
        }
        if (isCorrect || this._roundData.tries.size >= this._numberOfChoices - 1) {
            const score = 1 / Math.pow(2, this._roundData.tries.size);
            this._log.push(Math.round(100 * score));
            this.startRound();
        }
        return isCorrect;
    }
}

But it's still not enough. Game is still doing a lot of UI stuff. Can we fix that? Yes, with custom HTML elements!

Here is the code. It looks verbose, but what it does is completely encapsulate UI logic into UI elements:

class GuideColor extends HTMLElement {
    set color(value) {
        this.style.backgroundColor = value.toString();
    }
}

class ChoiceColors extends HTMLElement {
    connectedCallback() {
        this._clickHandler = this.onChoiceClick.bind(this);
        this.addEventListener('click', this._clickHandler, false);
    }
    disconnectedCallback() {
        this.removeEventListener('click', this._clickHandler, false);
    }
    onChoiceClick(ev) {
        const elem = ev.target;
        if (!(elem instanceof ChoiceColor)) {
            return;
        }
        const result = this._choiceHandler(elem.choiceIndex);
        elem.choiceResult = result;
    }
    setChoiceHandler(handler) {
        this._choiceHandler = handler;
    }
    set colors(value) {
        while (this.firstChild) {
            this.removeChild(this.firstChild);
        }
        for (let i = 0; i < value.length; i++) {
            const color = value[i];
            const elem = new ChoiceColor(color, i);
            this.appendChild(elem);
        }
    }
}

class ChoiceColor extends HTMLElement {
    constructor(color, index) {
        super();
        this.color = color;
        this.choiceIndex = index;
    }
    get choiceIndex() {
        return +this.getAttribute('data-index');
    }
    set choiceIndex(value) {
        this.setAttribute('data-index', value);
    }
    set choiceResult(value) {
        this.setAttribute('data-result', value);
    }
    set color(value) {
        this.style.backgroundColor = value.toString();
    }
}

class Scores extends HTMLElement {
    set scores(log) {
        while (this.firstChild) {
            this.removeChild(this.firstChild);
        }
        for (let i = log.length - 1; i >= 0; i--) {
            const value = log[i];
            const elem = new Score(value);
            this.appendChild(elem);
        }
    }
}

class Score extends HTMLElement {
    constructor(value) {
        super();
        this.innerText = value;
        this.className = value > 50
            ? 'good'
            : 'bad';
    }
}

class Board extends HTMLElement {
    constructor() {
        super();
        this._guide = new GuideColor();
        this._choices = new ChoiceColors();
        this._score = new Scores();
    }
    connectedCallback() {
        this.appendChild(this._guide);
        this.appendChild(this._choices);
        this.appendChild(this._score);
    }
    setChoiceHandler(handler) {
        this._choices.setChoiceHandler(handler);
    }
    set guideColor(value) {
        this._guide.color = value;
    }
    set choiceColors(value) {
        this._choices.colors = value;
    }
    set scores(value) {
        this._score.scores = value;
    }
}

window.customElements.define('complementary-board', Board);
window.customElements.define('complementary-guide-color', GuideColor);
window.customElements.define('complementary-choice-colors', ChoiceColors);
window.customElements.define('complementary-choice-color', ChoiceColor);
window.customElements.define('complementary-scores', Scores);
window.customElements.define('complementary-score', Score);

With this, the HTML becomes:

<html>

<head>
    <link rel="stylesheet" href="complementary.css" />
    <script src="complementary.js"></script>
</head>

<body>
    <complementary-board>
    </complementary-board>
</html>

and the CSS:

body {
    width: 100vw;
    height: 100vh;
    margin: 0;
}
complementary-board {
    width:100%;
    height:100%;
    display: grid;
    grid-template-columns: 50% 50%;
    grid-template-rows: min-content auto;
}
complementary-scores {
    grid-column-start: 1;
    grid-column-end: 3;
    grid-row: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
}
complementary-score {
    display: inline-block;
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: darkgray;
    margin-left: 2px;
}
complementary-score.good {
    background-color: darkgreen;
}
complementary-score.bad {
    background-color: red;
}
complementary-guide-color {
    grid-column: 1;
    grid-row: 2;
}
complementary-choice-colors {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
}
complementary-choice-color {
    flex-grow: 1;
    cursor: pointer;
}
complementary-choice-color[data-result=false] {
    opacity: 0.3;
}

Next

In the next blog posts we will see how we can test our code (we have to make it more testable first!) and how we can use Git as source control. Finally we should have a working game that can be easily modified independently: the visual design, the working code, the structural elements.

and has 0 comments

  This is a very short story that is barely science fiction. It describes a place of lowlifes, living on despair, terror and violence. Among them, a bland guy that seems to be unaffected by anything, but that can explode into violence in a second. If you just thought this character has similarities with Amos Burton, you thought right and the surprise is that he was not born with that name. This is kind of his origin story.

  I felt that The Churn was a bit lazy. A criminal boss character that calls his large underdog "little man" was also used in Gods of Risk, for example. Then there is nothing that binds the plot to space and time. It can be any place of ill repute, whether on Mars, Earth or anywhere else, in the future, the present or the past. Indeed, if you ignore the last pages, it's not even about Amos, but about other characters that have incidental contact with him.

  Bottom line: it brings nothing new to any table and it is barely an Amos story, clearly not an Expanse one.

and has 0 comments

  The story is of little girl Cara, daughter of colonists on Laconia, discovering dog-like creatures in the forest, apparently able to fix anything. When her brother is killed in an accident, she takes his body to her friends, to get him fixed. Adults, though, feel differently about the whole thing.

  Strange Dogs is one of the more sci-fi shorts in The Expanse universe, though still focusing on very relatable characters and very well written. The events here foreshadow some things in Tiamat's Wrath, which makes me believe the dogs' influence on the whole Expanse plot will be important. Now I can only hope that the ninth novel in the book series won't be the last.

and has 0 comments

  I just finished watching the fourth season of The Expanse TV series and, in strong withdrawal, I started reading the Expanse shorts written by James S.A. Corey. Serendipity has it that Gods of Risk is covering most of the Bobbie Draper subplot in the TV season I just watched and that the story happens during Christmas (although what Christmas means on Mars is a bit vague).

  The story is less detailed and with characters pretty different from the TV series, after all it's a short novella, but the basic plot is that same: nephew gets in trouble with the local underworld, aunt Bobbie kicks ass and saves him. It's well written and contains that element of world lesson that I felt was in Auberon. In this case, the only reason the good Martian nephew gets in trouble is his affection for a girl and his desire to protect her after she begs for help. Help provided, despite warnings from both his aunt and her pimp, she spurns him. A good lesson for adolescents everywhere.

and has 0 comments

  Want to feel old? Flea (born Michael Peter Balzary) writes this memoir at 57. In Acid for the Children, he covers his life from childhood in Australia up to, but not including, the Red Hot Chili Peppers era. And it's a nice book, one of those autobiographies that are written with honesty and nostalgia and that shares the lessons the author learned during his life.

  Michael was a scrawny kid, with either physically abusive, alcoholic or indifferent parent figures, born in a poor family. Yet his spirit was that of an artist, so he did what kids like that do: lots of risk taking, misdemeanors just for the sake of it, lots and lots of drugs of all kinds. In the book he thanks his guardian angels for not getting HIV or other life ending diseases or addictions. By the time he got noticed as a base player, he had escaped most of the mentality and came to grips with his parents. He even leans towards snowflake territory at the end there. The book is loosely chronological in order, made of various anecdotes. How he remembers stuff from his childhood with so much detail when I don't remember what happened ten years ago is a mystery, but that's how some people are.

  It's always good to read books like these. Makes you see the world with different eyes. In Flea's case, he made me realize that people do drugs from different reasons: some want to reach a potential they feel is right under their skin, they use them as tools to uncover themselves and when they do, they reach a place of bliss and pure joy. Others want to get to the bliss and joy directly, with no talent or drive to talk of, so they become addicts and "losers". Perhaps that's a kind of uncovering themselves, too. He also made me realize that you need some life experience to be able to access the emotions that are required to do art. It may seem obvious, but when our highest drama is who said what on Twitter or how beautiful is the scenery in a tour guided vacation, we don't have that experience. Lost to this illusion of safety in efficiency as cogs in the machine we lose not only our individuality, but our chances to even become people.

  Bottom line: Flea is a really nice guy, if he can say so himself, and it becomes clear as the book progresses that he had that from the very start, he just had to jump through some hoops to make that work for him. I am glad he made it. I liked the book.

and has 0 comments

  What I like about Brandon Sanderson is his optimism. In the Skyward universe people are quarantined on a planet while regular alien incursions must be repelled by younger and younger pilots flying crappier and crappier fighters. Anyone else would have made this a bleak post-apocalyptic story. Not Sanderson. He somehow makes it feel cheery!

  In Starsight we learn more about the aliens and the thing that made them all hate humans so. Spensa has to navigate (pun intended) another flight training school, but in a totally different context and the things she learns are even more valuable for the survival of the human race.

  This is a simple linear book with few but relatable characters and a fast pace. I finished it in a day. Skyward is not the best series of Sanderson's, being of a sub-genre that I disconsider, the one of the smart savage that learns the secrets of the world and advances in it with no particular problems and often with the help of overpowered "ancient" artifacts. It's not really that bad here, but I have to compare it with The Reckoners, which has a similar cheery vibe, but also terrible loss and realistic pain. Skyward is just too soft.

  Bottom line: almost pulp, I enjoyed reading the book, but I also felt that it didn't bring too much at the table.

and has 0 comments

  What is it with Brent Weeks and story endings? He himself says at the end of this final book from the Night Angel trilogy that the biggest challenge is the middle of the story. I don't see it that way. His stories have deep and rich middle parts, with new threads constantly being created, new characters and revelations added. It's the ending where, so far, I've felt disappointed.

  Don't get me wrong, this trilogy was great and Beyond the Shadows was a very well written book. It's just that with every chapter in the Night Angel story, the magical world and the characters get wider and the expectations grow with them. The finale, regardless of how epic, should feel like it closes all avenues, it resolves all conflict and explains everything and it just can't! Worse, by using unexpected external forces, abilities, premonitions, prophecies, characters, nations, unknown historical facts - and Weeks uses them all in his endings - everything you've read so far gets invalidated. Glaring examples in Beyond the Shadows are Jenine Gyre and Elene, both some of the most prominent female characters in the story, which fulfil their prophesied purpose almost like tools. And when you look behind, at their personal storyline, you realize that most of it was superfluous, pointless and nonsensical. The character in the end has almost no resemblance to the one at the beginning (or middle) and some of the decisions taken contradict some of the previous ones.

  And then there are all the nations and magic flavors and the geopolitical and historical context. What happens to those?! At the end, every character is awesome, fully grown and with amazing abilities. At the end! When they can't do anything anymore. All their strength and experience is used for a quick bow and a speedy exit stage left.

  Bottom line: Brent Weeks writes epic fantasy stories like Brandon Sanderson and ends them like Peter F. Hamilton, in a rushed mess. Night Angel is no exception. Considering both people I compared him with are in my list of favorite authors, he will probably be on it, too.

and has 0 comments

  Shadow's Edge continues the Night Angel story started in The Way of the Shadows. Kylar has to choose between his desire for a peaceful life and his responsibility. Characters die, but not really, then they die for real, but not really, while new characters and previously unheard of cultures all converge on Cenaria. Why? No one knows. It's all the fashion now.

  In this book, though, characters are much more relatable and the narrative flow feels more natural. You root for them to succeed. I liked it more than the first book in the trilogy, but now I dread the last book, Beyond the Shadows, will have Brent Weeks finish the saga like he did Lightbringer, with characters randomly brought down or up in an epic finale that lacks real meaning. But it could also be great! The suspense is killing me.

and has 0 comments

  Brent Weeks is a great writer, but all his stories so far seem to suffer from the same flaw: nothing of importance that happens in them does so in any relation to what had happened before. If someone is desperate and without choices, they become rich people with connections to nobility. If they plan things in great detail, some new character of great power comes and changes everything. Everyone in indeed connected to everybody else, but not in the way you thought. And if you thought something was in a certain way, don't fret, new information will appear that changes everything. Yes, the characters are captivating, the world building amazing, but the flow of the stories is more suited to movie than book as it's either a thoroughly passive experience or a very frustrating one. It was true for Lightbringer and so far it seems true for the Night Angel trilogy.

  In The Way of Shadows, the lead character is a street urchin that becomes a magical assassin's apprentice, finds noble friends, influences the fates of kingdoms, loves and is loved, loses his soul then finds it again and so on. A lot of people die, but not really by his hand. I mean, he becomes a lean mean killing machine, but we don't learn about his 10 year career, only about his skills. Thus he has the opportunity to make all kinds of moral judgements in the end. He has immense power, but he can't reach it unless he finds a special artefact that allows him to draw on it. Of course he finds one, but only when it's too late to properly train with it, so whenever he does things they are very random and somehow further the plot along. And, as if this weren't enough, there are prophecies and people that can see possible futures and influence it, so that the fates of the characters are even more unpredictable.

  As you have guessed, for me the experience has been as much a positive one as well as a really really frustrating one. How can I possibly invest in a story that changes radically like maddenning rat mazes in science experiments?! I really hope against hope that the ending of the trilogy is going to be satisfactory, but considering Night Angel comes before Lightbringer and that ended as randomly as possible, too, what are really the odds?

  Bottom line: Weeks is a sadist who writes beautiful stories, but forbids you any investment in the fate of his characters. There is only one god and his name is Brent.

and has 0 comments

  A while ago I had this story idea about a certain population that has something special that all others want and that they desperately need to consume. It's the exact premise of The Marrow Thieves, and the population in question is native Americans.

  Now, Cherie Dimaline is Métis herself, so I must trust that she knows what she is talking about, but from my standpoint, all the clichés I thought were stupid about American Indians are right there. It's like people have heard them so many times they started believing them. I am talking about calling themselves Indians, I am talking about the wise old man and wise old woman that guide (through restrictions of both knowledge and permission) young energetic youths, also the non violent Indian that knows responding to violence with violence makes him like the White man, the bow and arrow Indians - although they live in Canada, so who knows, the native people that are in harmony with nature, the betraying Indian - but only because of substance abuse, something the West has brought on them, and so on.

  In short, the book says "please take whatever you want from us, because we are nice, non violent and in harmony with everything. Even if we will eventually fight back, it will be only after we've been thoroughly defeated, humiliated and destroyed as a people". It's hard to empathise with such a moral for the story. I understand it was all mostly metaphor, but still.

  Bottom line: it was OK, but wouldn't recommend it.

and has 0 comments

  The reviews for this book are great and most of them say three things: it was inspired by the 1987 movie Near Dark, it has a different - realistic - take on werewolves and it's a coming of age story. As such, the main character in Mongrels is a boy that lives in a family of werewolves: people that occasionally turn into wolf like creatures, but that brings few advantages and a lot of trouble. Not only are their instincts frustrating in a human society, but turning takes a lot of energy and turning back pulls anything in the fur inside the skin of the human shape: ticks, elastic materials and as wolves they age with the speed of dogs. Since they can't adapt to the normal human way of life, they live on its fringes, as a family of white trash Americans. They steal, they scavenge, they kill animals whenever it doesn't get too suspicious, they move a lot and they are always poor.

  I can't say the book is badly written, but it's the equivalent of, I don't know, werewolf Kenny from Southpark. It's depressing, it's gray, it tries too much to make a social commentary by using the werewolf thing as a gimmick. Yes, it's a fresh take on the mythos, but it's a boring one. It certainly is not a horror book and too little of it is fantastic in nature. Instead it's the story of this boy trying to make up his mind if he is a wolf or a man. It could have just as well been a story about homeless gypsies, without any of the wolf thing, and it would have been the same.

  Bottom line: Stephen Graham Jones is clearly a good writer, but in this case he just wrote a smart book... about werewolves. And Near Dark was way better!