Book Review: White Cat

Title: White Cat

Author: Holly Black

Genre: Paranormal YA

Length: 76,000 words, 310 pages

Read: March 12, 2011

Summary: Well written, fun, but a little contrived.

 

This is yet another foray into the world of paranormal YA (I am, after all, doing research for my own writing). Holly Black is a but best selling YA and MG author. This book, unusually, has a male protagonist, and he’s part of a family of “curse workers,” although he himself doesn’t do any magic. He lives in an alternative reality where a small minority of people are able to “lay on hands” in a bad way and curse people. They are known to society, it’s even illegal, and formed into criminal gangs in the 1930s just like the Mafia.

The premise is decent, although I’m not a fan versions of our reality with outed paranormal groups. I didn’t really buy the changes at a social level. The whole existance of this kind of power in volume would throw everything off, and here the only real social change is that everyone wears gloves (because it’s through bare skin that the magic works). We are reminded often of the glove factor.

The writing is very solid and straightforward, in first person present. So straightforward it took me awhile to even notice the tense. Or maybe writing it myself is acclimating me to it. The protagonist is likable and felt fairly real, although maybe not all of his decisions did. And I didn’t really feel the proper weight of his emotions. Big things happen, but without big feelings. By page three or thereabouts we discover he murdered his girlfriend. We’re supposed to still like him. And we do, but mostly because it’s totally obvious that he didn’t REALLY murder her, he only thinks he did. Oh and we quickly hear about the one flavor of curse worker that’s REALLY rare. And guess who’s from a magical family and doesn’t have any power…

But I enjoyed the book — quite a bit — I read it in half a day after all. Another book I attempted to read that same morning was so execrable that I only made it to fifty pages, so this was a vast improvement.

A couple other beefs. At times the writing was so lean that I felt like I missed something in the action and had to page back to find it — but it wasn’t even there. Now, it was then obvious moving forward what had happened, it just seemed that the attempt at leanness and/or agressive editing had taken the edge off the clarity. Then as we moved into the second half we hit the “after the big reveal” syndrome which many books with reveals often suffer from. I’ve mentioned this before (like HERE or HERE), but basically this is where after the big shocker no one really seems to act with appropriate emotional gravitas. I’m used to it, and it’s a tough problem to solve, so I moved on to the ending.

Which was the weakest part. Everything juggled into place such that the people were served the plot rather than their character. The plot wasn’t bad, it’s just that I didn’t really see some of the characters acting like they did.

Overall, the story was fast and fun. As I said Ms Black is a skilled writer, and the prose zipped along, with nice quick descriptions, and she isn’t afraid to be a bit dark or sexy (considering it’s YA). The gratuitous twist on the last two pages bugged me, but I ordered the sequel (which the Twitter/FB buzz says is very good) and another of the author’s books.

How different these neat little package YA books are from a meaty tome like The Wise Man’s Fear (which I finished the same day). There are subplots in that book about the size of this entire story.

For a review of Holly Black’s first novel, Tithe: A Modern Faerie Tale, click here.

Game of Thrones – The Houses

With the premier of Game of Thrones, the HBO series based on what is perhaps my all time favorite Fantasy series, fast approaching, the network has been releasing all sorts of goodies. Now I’ve posted about this before, but these books, and it looks like the show, are so darkly delicious that I fell I must share.

Power (above) is new trailer.

Fear and Blood (above) is another new trailer for the show in general.

Then we have a whole series of videos on some of the most important Great Houses. Like Dune before it, Game of Thrones is a story about the interplay of politics and loyalty among a number of great factions. This was frequently true during the late middle ages, and to some extent the series is based a bit on the War of the Roses.

The Starks (above) are the moral center of the story.

House Baratheon holds the throne… for now.

The Lannister’s you love to hate — except for Tyrion who rules.

House Targaryen knows all about dragons.

Above is a more detailed video on Jaime Lannister.

and above Robb Stark.

Above is Littlefinger.

and above about the world in general.

For a review of episode 1, click here.

Dinner Party – It all starts with Cheese

Last Friday we hosted a little dinner party. I can’t say it was purely an excuse for more cooking and food photos, but well, here they are. Everything in this meal is made from scratch.

The first course in summary.

Cheese is always a good start. This time I tried a new cheese shop, Andrew’s Cheese Shop. This is closer than my usual haunt, the The Cheese Store of Beverly Hills. Andrew’s isn’t as big, but they had plenty of choices, and they were extremely friendly.

I put together a little foursome. Epoisses on the left (gooey washed rind fun), a fantastic goat, Monte Enebro, a nice rich nutty dutch cheese on the left (tasted halfway between a Gouda and Parmesan) and on the bottom, Stichelton, a beautiful rich English blue cheese.

Condiments. Marcona almonds, quince paste (the orange jelly stuff), Spanish olives, and accacia honey from Abruzzo.

The carbohydrates. Traditional french baguette, cranberry nut crisps, and olive oil cracker sticks. All from Andrew’s, and all excellent.

We also made these puff pastries from scratch. Stuffed with egg, cheese, and spinach. Basically little puff-Spanakopita.

What would all that cheese and bread be without some wine?

On the left a fantastic Burgundy, Parker gives it 92, but I’d give it more like a 94. “The 2003 Clos Vougeot explodes from the glass with licorice, dark cherries, and a myriad of spices. A wine of considerable depth, it is packed with suave black fruits immersed in chocolate. Well-structured, ripe, and exceptionally long, it will merit a higher score if its alcoholic warmth is absorbed into the wine with time (something that sometimes occurs with Pinot Noirs). Projected maturity: 2008-2017.”

On the right, earning 90 points (and again I’d give it more), “The 2006 Fonsalette Cotes du Rhone exhibits meaty, herbal, tapenade, pepper, animal fur, and damp earth-like notes. It is soft, round, lush, and best consumed over the next 10+ years.”

For the main course, we went with Salmon en Papillote, adapted from a recipe by non other than Julia Child. All done from scratch.

Sealed in with the juices are julianned vegetables, parsley, basil, garlic. We’ve done this before but tis batch turned out absolutely perfect.

And as the starch, couscous adapted from Houstons (see it HERE). I found a recipe on the web approximating what they do at the restaurant (HERE).

And then salad.

And this delicious but rather un-homogenized walnut vinaigrette (from scratch of course).

Then for dessert, our friend Geo’s Chocolate Ganache tart. He very graciously gave us this recipe after some prying, and it’s a terribly excellent and decadent dessert. Mostly it’s butter, sugar, and 70% cacao chocolate. Oh yes!

Then homemade whipped cream. None of those emulsifying agents. And homemade raspberry sauce (rasberries and sugar thrown in the blender).

And fruit to finish.

Fast Food Sushi?

Restaurant: Sushi-Don

Location: 970 Monument St #118, Pacific Palisades, CA 90272. (310) 454-6710

Date: March 9, 2011

Cuisine: Japanese / Sushi

Rating: Not bad for a $20 lunch.

 

There seems to be a strange trend going on right now where top sushi bars are opening fast food or light branches. Sushi-Don is in my hood, and it’s owned by, or in some way executive chefed by, Sasabune (see my first and second reviews of that here). Sushi-Don is a kind of fast food version of it’s big brother Sasabune, where you have a simplified menu and reduced prices.

The menu is on the wall.

I went for “Combo B” the soup, cut roll, and 5 pieces of standard sushi.

The miso soup is exactly as you’d expect.

You can chose any cut roll, I went for blue crab. Left to right we have Maguro (tuna), albacore x2 with two sauces, salmon, and Hamachi (yellowtail).

The sushi itself is fine. It’s not fantastic, being perhaps 80% as good as that at Sasabune. This is no Sushi-Sushi (REVIEW) either, but then again, the above was $12. It’s certainly not icky mall sushi, and the chef made it in front of me.

I also ordered a scallop hand roll, which was tasty enough. Could have used a touch of yuzu 🙂

Sushi-Don is what it is. You can have a little light sushi meal here for $15, or you could probably get stuffed for $30-35. The equivalent food at Sasabune or Sushi-Sushi or similar would be at least twice as much. Sure the quality is better there. But at Sushi-Don you can also be in and out in 15-20 minutes. So I think it fills a niche, when one is in a hurry, often alone, and just want a tasty quick bite to eat.

Sushi Nozawa has tried a similar concept with SugarFISH, but that for me is even less satisfying, as it isn’t actually much (if any) cheaper than a real sushi bar, and they’ve eliminated the chef. My colleague kevineats.com reviews that HERE.

The Wise Man’s Fear

Title: The Wise Man’s Fear

Author: Patrick Rothfuss

Genre: High Fantasy

Length: 380,000 words, 1000 pages

Read: March 4-12, 2011

Summary: A worthy sequel.

_

The Wise Man’s Fear is one of 2011’s two most anticipated Fantasy novels, the other being George R. Martin‘s A Dance with Dragons (due in July). WMF, however, can be all yours right now. It’s the sequel to The Name of the Wind (which I REVIEW HERE). This is High Fantasy of a rather less epic sort. Not that it’s any less fun to read, even weighing in as it does at 1008 hardcover pages. Although, who thinks about pages these days, as I read the Kindle version on my iPad (wouldn’t want to mess up that nice hardcover first edition I had signed by Mr. Rothfuss last week!).

Despite the length, it’s well worth it. This book is seamless with the first in the series, despite the four years gap between their publication. I read The Name of the Wind a second time last week, and WMF picks up and continues with exactly the same style and pace. There is still the box story in the present, but this accounts for no more than 5% of the pages. The action mostly takes place in the past with our hero, Kvothe, continuing on for a bit at University and then venturing out into the wider world. While we sense that some bigger events are in the works, this is still a very personal tale. And it defies all normal story telling expectations in that it just meanders along. My editor’s eye says that whole chunks and side plots could be snipped out without effecting anything. And to a certain extent this is true. But would the novel be better for it? Perhaps it could have lost 50-100 pages in line editing, but I’m not sure I’d take out any of the incidents. As the novel itself says, it’s not the winning of the game, but the playing of it that matters.

That is very much what The Wise Man’s Fear is about. It’s a story about stories. It’s rich and lyrical, a luxurious tapestry of world and story, without the distraction of the intricate mechanism of plot. The little glimpses into different sub-cultures show a deft eye for details and invention. This feels like a real place, not so much explained, but revealed through the narrator’s eyes.

As Rothfuss said in an interview, Kvothe is  older now, and he gets himself into more trouble. There’s more sex and violence this time out, although the main romance is still endlessly unrequited 🙂 Kvothe it seems, is a hero of many talents, and that includes those in the bedroom. Rothfuss doesn’t focus on these details gratuitously, it’s not a book filled with battle (or bedroom scenes).

I’m curious to see how Rothfuss wraps this up in the third book (and I suspect the trilogy might expand). Things still feel early. We find out barely anything new about the main villains. In fact they don’t even show in this volume. Just like the first book the end is completely limp and anti-climatic. Kvothe just wraps his story up for the day and we wait (hopefully for slightly less than four years).

But I’ll be waiting. Probably for so long that I’ll have to read book one and two again. I won’t mind.

Dinner and Drinks at Tavern

Restaurant: Tavern [12, 3, 4]

Location: 11648 San Vicente Blvd, Los Angeles, CA 90049. (310) 806-6464

Date: March 10, 2011

Cuisine: Market driven Californian

Rating: Good for dinner too!

 

Every couple of months I get together with a group of friends who all have kids the same age for a “Dad’s night out.” Last time we went to Father’s Office, this time we chose Tavern in Brentwood. I’m generally there either for Brunch or for an early dinner so I was pleasantly surprised to see how jammed the bar was.

The cocktail menu. The bar was hopping big time at 8-9pm on a thursday. Mostly 30 something women too. A pack of cougars were on the prowl too.

“WildRover, Jameson’s Irish Whiskey, Fresh Basil & Tangerine.” This was a hell of a good cocktail. Like a whiskey sour with basil.

We pounded through 2 bottles of this pleasant CnDP, which Parker gives a 93. “The finest tradition cuvee yet made, the 2007 Chateauneuf du Pape (70% Grenache, 20% Syrah, and 10% Mourvedre aged in foudre and concrete tanks) possesses a deep ruby/purple-tinged color as well as a bouquet of black currants, black cherries, garrigue, pepper, and lavender. It is a full-bodied, ripe, exceptionally elegant, pure wine to drink now or cellar for 12-15 years.”

Tonight’s dinner menu. Never exactly the same twice.

“Salmon crudo with cerignola olives, cucumber, and meyer lemon.”

“Endive salad with Schaner farm’s citrus, green olives and fennel.”

“Cauliflower soup with truffle butter and marcona almonds.” This was a bit blander than I had hoped. Maybe it didn’t have enough creme, or salt. Still pleasant enough.

“Wild mushroom and leek tart with aged goat cheese and herb salad.”

“The devil’s chicken with braised leeks, onionsand mustard breadcrumbs.” Captain Picard, owner of L’Idiot says, “you can’t afford the duck, you’ll have the chicken!”

“Braised lamb shank with saffron rice, merguez, peppers and pinenuts.” This was a damn good dish. The meat fell off the bone (which could be gnawed viking style at leisure). The rice is Persian, and the whole dish had a vaguely Persian thing going on.

“Niman ranch rib-eye with potato-bacon gratin,red wine butter and arugula.”

The desserts du jour.

“Chocolate and coconut coupe, chocolate ice cream, coconut sherbet and graham crackers.” This tasted like its component ingredients, and that wasn’t a bad thing. Rich and refreshing at the same time.

““Snickers Bar, salted peanut caramel and vanilla ice cream.” Very nice dessert. Inside the hard dark chocolate shell was a kind of peanut and carmel mouse.”

As you can see Tavern ain’t no slouch at dinner time either. The dishes are inventive, rich, made with good ingredients, and tasty. You can find some of my brunch reviews HERE, HERE, or HERE.

Making Crash Bandicoot – GOOL – part 9

This is part of a now lengthy series of posts on the making of Crash Bandicoot. Click here for the PREVIOUS or for the FIRST POST. I also have a newer post on LISP here.

I’m always being asked for more information on the LISP based languages I designed for the Crash and Jak games. So to that effect, I’m posting here a journal article I wrote on the subject in 1996. This is about GOOL, the LISP language used in Crash 1, Crash 2, and Crash 3. GOOL was my second custom language. Way of the Warrior had a much simpler version of this. Jak 1,2,3 & Jak X used GOAL, which was a totally new vastly superior (and vastly more work to create) implementation that included a full compiler. GOOL (the subject of this article) was mostly interpreted, although by Crash 2 basic expressions were compiled into machine code. But I’ll save details on GOAL for another time.

[ Also I want to thank my reader “Art” for helping cleanup an ancient copy of this article — stuck in some mid 90s Word format that can no longer be read. ]

_

Making the Solution Fit the Problem:

AI and Character Control in Crash Bandicoot

Andrew S. Gavin

Copyright (c) 1996 Andrew Gavin and Naughty Dog, Inc.

All rights reserved.

Abstract

Object control code, which the gaming world euphemistically calls AI, typically runs only a couple of times per frame. For this kind of code, speed of implementation, flexibility, and ease of later modification are the most important requirements. This is because games are all about gameplay, and good gameplay only comes from constant experimentation with and extensive reworking of the code that controls the game’s objects. The constructs and abstractions of standard programming languages are not well suited to object authoring, particularly when it comes to flow of control and state. GOOL (Game Oriented Object LISP) is a compiled language designed specifically for object control code that addresses these limitations.

Video games are the type of program which most consistently pushes the machine and programmer to the limit. The code is required run at blinding speeds, fit in tiny memory footprints, have no serious bugs, and be completed under short schedules. For the ultra high performance 5% of functions which run most frequently there is no substitute for careful hand coding in assembly. However, the rest of the program requires much more rapid implementation. It is this kind of code which is the subject of this article.

Object control code, which is euphemistically called AI in games, typically runs only a couple of times per frame. With this kind of code, speed of implementation, flexibility, and ease of later modification are often more important than maximizing execution time. This is because games are all about gameplay, and achieving good gameplay is about writing and rewriting object code time and time again. Programming languages are not immutable truths handed down from on high, but tools created by people to solve particular tasks. Like any tool, a programming language must be right for the job. One would not attempt to turn a hexagonal nut with a pentagonal wrench, neither is it easy to write a program in a language not well suited to the problem. Sadly, most programmers have only been exposed to a small set of similar and inflexible languages. They have therefore only learned a small number of ways to customize these languages to the task at hand. Let us stop for a second and take look at the abstractions given to us by each of the common choices, and at what price. But first a word about assemblers and compilers in general.

Assemblers and compilers are programs designed to transform one type of data (the source language) into another (the target language). There is nothing particularly mysterious about them, as these transforms are usually just a bunch of tabled relationships. We call one of these programs a compiler when it performs some kind of automatic allocation of CPU resources. Since most commonly found languages are fairly static, the transform rules are usually built into the compiler and can not be changed. However, most compilers offer some kind of macro facility to allow customizations.  In its most general form a macro is merely a named function, which has a rule for when it is activated (i.e. the name of the macro). When it is used, this function is given the old piece of program, and can do whatever normal programming functions it wishes to calculate a new expression, which it returns to be substituted for the old. Unfortunately, most languages do not use this kind of macro, but instead create a new tiny language which defines all the functions which are allowed to run during macro expansion (typically template matching of some sort). With general purpose macros, any transform is possible, and they can even be used to write an entire compiler.

Almost all programmers have had some exposure to assembly language. An assembler basically serves the purpose of converting symbolic names into binary values. For example, “add” becomes 20. In addition, most allow simple renaming of registers, assignment of constants to symbols, evaluation of constant expressions, and some kind of macro language.  Usually these macro languages consist of template substitutions, and the ability to run simple loops at expansion time. Assembly directly describes the instructions interpreted by the processor, and as such is the closest to the chip which a software engineer can get. This makes it very tedious and difficult to port to a different a machine. Additionally, since it consists primarily of moving binary words between registers and memory, and performing simple operations on them, most people find it tedious and difficult to use for large programs. In assembly, all details must be tracked by hand. Since knowledgeable humans are smarter than compilers, albeit much slower, they are capable of doing a substantially better job of creating smaller more efficient code. This is true, despite the claims of the modern OS community, compilers are still only about half as good as a talented assembly programmer. They just save a lot of time.

Many programmers learned to program with Basic. This language has an incredibly simple syntax, and typically comes with a friendly interactive environment. These features make it easy to learn and use. It however has no support for abstractions of any sort, possessing only global variables, and no macro system. Globals are great for beginners because the whole abstract arena of scope becomes a non issue. However, the absence of lexical scoping makes the isolation of code (and its associated bugs) nearly impossible. There is however an important lesson in basic which has been lost on the programming community: interactive is good. Basic typically has an interpreted listener, and this enables one to experiment very quickly with expressions to see how they work, and to debug functions before they are put into production.

The standard programming language of the last few years is C. First and foremost C provides series of convenient macros for flow control, arithmetic operations, memory reference, function calling, and structure access. The compiler writer makes expansions for these that work in the target machine language. C also provides expression parsing and simple register allocation for assembler grade data objects (i.e. words). C code is reasonably portable between machines of a similar generation (i.e. word size). As an afterthought a preprocessor provides rudimentary textual macro expansion and conditional compilation. The choice not to include any of the hallmarks of higher level languages, like memory management (aka garbage collection), run time typing, run time linking, and support for more complex data types (lists, true arrays, trees, hash tables etc.) is a reasonable one for many tasks where efficiency is crucial. However, C is crippled by an inconsistent syntax, a weak text based macro system, and an insurmountable barrier between run time and compile time name spaces. C can only be customized via the #define operator and by functions. Unfortunately, this makes it impossible to do many interesting and easy things, many of C’s fundamental areas, structures, setting, getting, expressions, flow of control, and scope are completely off limits for customization. Since functions always have a new scope, they are not useful creating flow of control constructs, and #define is so weak that it can’t even handle the vagaries of the structure syntax. For those who know C very well it is often a convenient language, since it is good at expressions and basic flow of control. However, whenever complicated data structures are involved the effort needed is obscene, and C in unable to transfer this effort from one data type to another similar one.

Modern operating system and fancy programs are filled with scripting languages.  MS DOS batch language, the various Unix shell languages, perl, tcl etc. are all very common.  These are toy languages. They often have inconsistent and extremely annoying syntaxes, no scoping, and no macros. They were invented basically as macro languages for operating system shells, and as such make it fairly easy to concatenate together new shell commands (a task that is very tedious in assembly or C). However, their ambiguous and inconsistent syntaxes, their slow interpreted execution speeds, and the proliferation of too many alternatives has made them annoying to invest time in learning.  Recently a new abomination has become quite popular, and its name is C++. This monstrosity of a language attempts to extend C in a direction it was never intended, by making structures able to contain functions.  The problem is that the structure syntax is not very flexible, so the language is only customizable in this one direction. Hence one is forced to attempt to build all abstractions around the idea of the structure as class. This leads to odd classes which do not represent data structures, but instead represent abstract ways of doing. One of the nice things about C is that the difference between pointer and object is fairly clear, but in C++ this has become incomprehensibly vague, with all sorts of implicit ways to pass by reference. C++ programs also tend to be many times larger and slower than their C counterparts, compile much slower, and because C++ compilers are written in C, which can not handle flexible data structures well, the slightest change to the source code results in full compiles of the entire source tree. I am convinced that this last problem alone makes the language a severe productivity minus. But I forgot, since C++ must determine nearly everything at compile time you still have to write all the same code over and over again for each new data type.

The advent of the new class metaphor has brought to the fore C and C++’s weakness at memory management. Programmers are forced to create and destroy these new objects in a variety of bizarre fashions. The heap is managed by the wretched malloc model, which uses wasteful memory cookies, creates mysterious crashes on overwrites, and endless fragmentation.

None of these problems are present in Lisp, which is hands down the most flexible language in common use.  Lisp is an old language (having its origins in the 50s) and has grown up over the last 30 years with the evolution of programming. Today’s modern Common Lisp is a far cry from the tiny mainframe list of 30 years ago. Aided by a consistent syntax which is trivial to parse, and the only full power macro system in a commonly used language, Lisp is extremely easy to update, customize, and expand, all without fighting the basic structures of the language. Over the years as lexical scoping, optimized compilation, and object oriented programming each came into vogue Lisp was able to gracefully adopt them without losing its unique character. In Lisp programs are built out of one of the language’s built in data structure, the list.  The basic Lisp expression is the form. Which is either an atom (symbol or number) or a list of other forms. Surrounded by parentheses, a Lisp lists always has its function at the head, for example the C expression 2+2 is written as (+ 2 2). This may seem backwards at first, but with this simple rule much of the ambiguity of the syntax is removed from the language. Since computers have a very hard time with ambiguity, programs that write programs are much easier in Lisp.

Let me illustrate beginning with a simple macro.

(defmacro (1+ value)
	"Simple macro to expand (1+ value) into (+ 1 value).
	Note that backquote is used.  Backquote is a syntax
	sugar which says to return the 'quoted' list, all
	forms following a comma however are evaluated
	before being placed in the list. This allows the
	insertion of fields into a template.
	1+ is the operator which adds 1 to its operand
	(C uses ++ for this)."
  `(+ 1 ,value))

The above form defines a function which takes as its argument the expression beginning with 1+, and returns a new expanded expression (i.e. (1+ 2) > (+ 1 2)). This is a very simple macro because it merely fills in a template. However, if our compiler did not perform constant reduction we could add it to this macro like this:

(defmacro (1+ value)
	"Smarter macro to expand 1+.  If value is a number,
	then increment on the spot and return the new
	number as the expansion."
  (if (numberp value)
      (+ 1 value)
    `(+ 1 ,value)))

The form numberp tests if something is a number. If value is, we do the add in the context of the expansion, returning the new number as the result of the macro phase. If value is not a number (i.e. it is a variable or expression), we return the expanded expression to be incremented at run time.

These full power macros allow the programmer to seamlessly expand the language in new ways. For example, the lisp form cond can be implemented from if’s with a macro. Cond is a special form which is like a C “switch” statement except that each case has an arbitrary expression. For example:

(cond
  ((= temp 2)
   (print 'two))
  ((numberp temp)
   (print 'other number))
  (t
   (print 'other type)))

Will print “two” if temp is 2, “other number” if it is a number (other than 2), and “other type” otherwise. A simple implementation of cond would be as follows:

(defmacro cond (&rest clauses)
	"Implement the standard cond macro out of nested
	'if's and 'when's. t must be used to specify the
	default case, and it must be used last. This macro
	uses backquote's ,@ syntax which splices a list
	into the list below it. Note also the use of progn.
	progn is a form which groups multiple forms and has
	as it's value, the value of the last form. cond
	clauses contain what is called an implicit progn,
	they are grouped together and the value of the
	last one is returned as the value of the cond."
  (if (eq (length clauses) 1)
      (if (eq (caar clauses) t)
          `(progn ,@(cdar clauses))
        `(when ,(caar clauses)
            ,@(cdar clauses)))
    `(if ,(caar clauses)
         (progn ,@(cdar clauses))
       (cond ,@(cdr clauses)))))

This expands the above cond into:

  (if (= temp 2)
      (progn (print 'two))
    (cond
      ((numberp temp)
       (print 'other number))
      (t
       (print 'other type))))

After a single pass of macro expansion. The macro will peel the head off of the cond one clause at a time converting it into nested ifs. There is no way to use C’s #define to create a new flow of control construct like this, yet in a compiled language these compile time transforms are invaluable to bridging the gap between efficient and readable code.

GOOL (Game Oriented Object LISP) is my answer to the difficulties of using C and assembly for object programming. It is a compiled Lisp dialect designed specifically for the programming of interactive game objects. As a language it has the following features: Consistent syntax, full power macros, symbolic names, orthogonal setting/getting, layered computation, multiple ultra light threads, grouping of computations into states, externally introduced flow of control changes (events), small execution size, retargetable backend, and dynamic linking. The GOOL compiler is embedded in Allegro Common Lisp (an ANSI Common Lisp from Franz Inc. which I run on an Silicon Graphics workstation running IRIX). Common Lisp provides an ideal environment for writing compilers because you start off with parsing, garbage collection, lists, trees, hash tables, and macros from the get go. As a language GOOL borrows its syntax and basic forms from Common Lisp.  It has all of Lisp’s basic expression, arithmetic, bookkeeping, and flow of control operators.  These vary in many small ways for reasons of speed or simplicity, but GOOL code can basically be read by the few of us lucky enough to have been exposed to Lisp. GOOL is also equipped with 56 primitives and 420 macros which support its advanced flow of control and game object specific operations. Additional ones can be trivially defined globally or locally within objects, and are indistinguishable from more primitive operations.

The GOOL compiler is an modern optimizing compiler with all sorts of smarts built into various macros and primitives. It is a fully forward referenced single pass compiler. Unlike some other programming languages with single letter names, GOOL does not require you to define something textually before you use it, and you never need tertiary declarations (like prototypes). Computers are good at remembering things, and a compiler is certainly able to remember that you called a function so that it can check the arguments when it gets to the declaration of that function. GOOL is fully relocatable and dynamically linked. So it is not necessary to include code for objects which are not nearby in memory. C is so static, and overlays so difficult and incompatible, that almost no effort is made to do dynamic binding of code, resulting in much wasted memory.

The programming tasks involved in creating game object behaviors are very inconvenient under the standard functional flow of control implied by most programming languages. In the programming of game objects it is necessary for each object to have a local state. This state consists of all sorts of information: type, position, appearance, state, current execution state (program counter), and all types of other state specific to the type of object. From the point of view of a particular object’s code all this can be viewed as an object specific global space and a small stack. This state must be unique to a specific object because it is often necessary to execute the same code on many different copies of the state. In either C or assembly it is typical to make some kind of structure to hold the state, and then write various routines or code fragments that operate on the structure. This can be accomplished either with function syntax macros or structure references. GOOL on the other hand allows this state to be automatically and conveniently bound to variable names for the most straightforward syntax. For example the C:

object >transx = object >transx + immediate_meters(4);

becomes in GOOL the similar expression:

(setf transx (+ transx (meters 4)))

However if in C one wished to add some new named state to each instance of a particular object one would have to create new structure records, accessors, initializers, memory management etc. GOOL on the other hand is able to easily allocate these on the object’s local stack with just one line of code, preserving the data there from frame to frame as well. A standard programming language like C only has one thread of control. While this is appropriate for the general case, it is inappropriate for objects, which are actually better expressed as state machines. In addition, it is extremely useful to be able to layer ultra light weight threads of execution, and to offer externally introduced transfers of control (events). While threads typically complicate most applications programs with few benefits, they are essential to the convenient programming of game objects, which often have to do several things at once. For example, an object might want to rotate 180 degrees, scale up toward 50%, and move toward the player character all at once. These actions do not necessarily take the same amount of time, and it is often useful to dynamically exchange and control them. In traditional code this is very awkward.

The basic unit of code in GOOL is a code block (or thread). These often do simple things as above. An arbitrary number of these may be combined into a state, they may be borrowed from other states, and activated and deactivated on the fly. For example:

(defgstate turn scale and move toward
	:trans	(defgcode (:label turn 180)
		; set the y rotation 10 degrees closer to 180 degrees
			(setf roty (degseek roty (deg 180) (deg 10))))
	:trans	(defgcode (:label scale to 150 percent)
		; set the x,y, and z scales 10% closer to 150% scale
			(with vec scale
				(seekf scale (scale 1.5) (scale .1))))
	:trans	(defgcode (:label move toward target)
		; set the x,y, and z position closer to the target's
		; (another object) position at a rate of 5 meters per second
			(with vec trans
				(seekf trans (target trans) (velocity (meters per sec 5)))))
	:code	(defgcode (:label play animation)
		; play the animation until this object is colliding with
		; another, then change states
			(until (status colliding)
				(play frame group animation))
				(goto collided)))

A :trans block is one which runs continuously (once per frame), and a :code block is one which has a normal program counter, running until suspended by a special primitive (frame), as in “frame is over.” These code blocks can be run as threads (as above), called as procedures, converted to lambda’s and passed to something (function pointers), and assigned to be run under special conditions (events or state exit). In this example is also illustrated the kind of simple symbolic notation used in GOOL to make object programming easier. Vectors like rotation, translation, and scale are bound to simple symbolic names (e.g. roty is the y component of the rotation vector). Many new arithmetic operations have been defined for common operations, for example, seek, which moves a number toward another number by some increment, and seekf its destructive counterpart.

GOOL also has a sophisticated event system.  It is possible to send an event (with parameters) to another object or objects. The object may then choose to do what it wishes with that event, run some code, change state, ignore it, etc., and report something back to the caller. These event handlers can be bound and unbound dynamically, allowing the object to change its behavior to basic events very flexibly.  For example:

:event	(defgcode (:params (event params))
		(reject-event-and-return
			((and (event is hit on the head)
				(< (interrupter transy) transy)))))

Says to ignore the hit on the head event when the interrupter (sender) is below the receiver in the y dimension.

Another feature illustrated here is the indirect addressing mode, (interrupter transy), in which a variable of another object (whose pointer is in the variable interrupter) is accessed. Operations can locate and return object pointers, which can be used as parameters. For example:

(send event hit on the head (find the nearest object))

which sends hit on the head to the nearest object or:

(let ((target (find the nearest object)))
	(when (and target (type target turtle))
		(send event hit on the head)))

which sends hit on the head to the nearest object only if it is a turtle.

It is the GOOL compiler’s responsibility to turn this state into code that executes the abstraction (the above state becomes about 25 words of R3000 assembly code).  GOOL code is typically much smaller than traditional code for similar tasks because the compiler does all the book keeping for this interleaving, and it is all implicit in the runtime product.  In addition it has a degree of code reuse which is practically unachievable in a normal language without extremely illegible source.

GOOL has full power macros which allow the language to be brought up to the level of the problem.  For example, many game programming tasks are more descriptive than a language like C is designed for. The following code causes a paragraph of text to appear on the bottom of the screen and scroll off the top.

(credit list (1 14)
	("AFTER THE")
	("DISAPPEARANCE")
	("OF HIS MENTOR,")
	("DR. NITRUS BRIO")
	("REDISCOVERED HIS")
	("FIRST LOVE:")
	(blank 1)
	("TENDING")
	("BAR"))

It does this by expanding into a program which creates a bunch of scrolling text objects as follows:

(defgopm credit list (params &rest body)
	"This macro iterates through the clauses in its
	body and transforms them into spawn credit line
	statements which create new credit line objects.
	It book keeps the y position down ward by height
	each time."
   (let ((list)
        (y 0)
        (font (first params))
        (height (second params)))
     (dolist (i body)
        (cond
          ((listp i)
           (case
             (car i)
             (blank (incf y (second i)))
             (t (push (append '(spawn credit line)
                               (:y ,y :font ,font :h ,height))
                      list)
                (incf y 1))))))
     `(progn ,@(reverse list))))(defgopm spawn credit line (line &key (y 0) (font 0) (h 18))
  "This macro is purely syntactic sugar, making the above macro somewhat easier."
  (spawn 1 credit line
     (frame num ,line)
     (unit ,(* y h)) ,font))

The following state is the code for the actual credit line.  When one of these credit line objects is spawned it creates a line of text. It then proceeds to use it’s trans to crawl upward from the starting y position until it is off the screen, in which case it kills itself.

(defgstate credit line (stance)
  :handles (spawn credit line)
  :trans (defgcode ()
           (unless first frame
              (setf transy ((parent transy) transvy))
              (when (> transy (unit 140))
              (goto die fast))))
  :code  (defgcode (:params (text frame y font))
           (stomp action screen relative)
           (set frame group text)
           (setf transvy y)
           (setf transy ((parent transy) transvy))
           (sleep text frame)))

As a conglomerate the above code manages to create a scrolling paragraph of arbitrary length from a descriptive block of code.  It does this by using the macro to transform the description into a program to create a cluster of new line objects.  This line objects take their simple behavior and amplify it into a more substantial effect when they are created in concert. In a conventional language it would be typical to create some kind of data structure to describe different actions, and then interpret that. C in particular is a very poor language for description. Because C’s only complex data type, the structure, can not even be declared in line (e.g. “struct foo bar={1,0}” is not legal except as a global) it is extremely awkward to describe complex things. It must be done with code, and the poor textual macro expander is not up to this. Witness the wretchedness of descriptive APIs like that of X windows. The contortions necessary to describe widget creation are unbelievable. Is it no wonder that people prefer to do interface work with resource files or Tcl/Tk which are both more descriptive in nature?

Overall, having a custom language whose primitives and constructs both lend themselves to the general task (object programming), and are customizable to the specific task (a particular object) makes it much easier to write clean descriptive code very quickly. GOOL makes it possible to prototype a new creature or object in as little as 10 minutes. New things can be tried and quickly elaborated or discarded. If the object doesn’t work out it can be pulled from the game in seconds without leaving any hard to find and wasteful traces behind in the source. In addition, since GOOL is a compiled language produced by an advanced register coloring compiler with reductions, flow analysis, and simple continuations it is at least as efficient as C, more so in many cases because of its more specific knowledge of the task at hand.  The use of a custom compiler allows to escape many of the classic problems of C.


A new 10th Crash post can be found HERE.

Subscribe to the blog (on the right), or follow me at:

Andy:  or blog

Also, peek at my novel in progress: The Darkening Dream

or more posts on LISP,

GAMES or BOOKS/MOVIES/TV or WRITING or FOOD.

Brunch at Tavern 3D

Restaurant: Tavern [1, 2, 3, 4]

Location: 11648 San Vicente Blvd, Los Angeles, CA 90049. (310) 806-6464

Date: March 6, 2011

Cuisine: Market driven Californian

Rating: Not just your typical short order brunch — but better.

 

Tavern is a favorite midend brunch spot of ours. It’s much yummier than the typical short order grills, and not as gluttonous as the high end brunches (like this). I’ve reviewed it twice before HEREHERE, and HERE, but the menu is seasonal and so always changing a bit.

Today’s menu. Online version can be found HERE, but it’s always changing and never current.

Double cap. Not a bad restaurant cappuccino.

Simple pancakes for the boy (2.4 years old).

“Brisket hash with fried eggs and horseradish cream.” In its own way, a variant on the beef and horseradish tradition. But… um richer… and more breakfasty.

“Market fish (salmon) with carrot purée, gingered beets and lime salsa.” I didn’t try it, but looked very good with a really nice selection of fresh ingredients.

“Pumpkin waffle with pecan butter and maple syrup.” What could go wrong with this?

“Smoked fish with toasted rye & redwood hill goat cheese.” A very nice fish plate. The fish is fresh, and the goat cheese a nice improvement on cream cheese. I also like the very crunchy pickles.

“The Angeleno sandwich, artichokes, buratta, cavola nero, and meyer lemon. With prosciutto added.” I modified this vegetarian sandwich to add the good stuff (ham), and it turned out fantastic. The bread had the prefect texture and the burrata (more on that HERE), combined perfectly with the prosciutto and the marinated artichokes. The chips and pickles were awesome too.

“Fried Potatoes.”

“Sauteed Cavola Nero.” This wasn’t on the menu, but they did it anyway. The green is a kind of Italian Kale.

The dessert menu.

“Carrot cake with toasted walnuts and cinnamon anglaise.” Top example of the type, with a bit of creme anglaise in case the icing wasn’t rich enough.

“Snickers Bar, salted peanut caramel and vanilla ice cream.” Very nice dessert. Inside the hard dark chocolate shell was a kind of peanut and carmel mouse.

Tavern continues to hold up as a top breakfast spot, and pretty reasonable considering the level of sophistication.

La Sandia

Restaurant: La Sandia

Location: 395 Santa Monica Place 305N,Santa Monica, CA 90401. Tel. 310.393.3300

Date: March 5, 2011

Cuisine: Mexican

Rating: Tasty, but some serious service issues need working out.

 

I’ve been questing through the various new offerings in the retrofitted Santa Monica place. I’ve already reviewed Xino (pseudo Chinese) and Zengo (Latin-Asian fusion), and next up is La Sandia, which is a modernized Mexican.


The upscale Disneyland-style decor ain’t half bad. But we did start off on a slightly sour note. They don’t take reservations on weekends, as I was told on the phone, “because they get so busy.” This always gets my blood boiling, because it’s basically like saying, “We don’t care about you (the customer), we just want to pack you into our bar and milk a couple extra drinks out of you.” I have long refused to go to places like Cheesecake factory on this basis as they adopt clearly “non user-friendly” policies to their own benefit. I was also told there was a wait of 5-10 minutes for a table of 2, when I could clearly see empty tables.

In a place that doesn’t take reservations?

We were in a rush for a movie so I bullied the hostess past this and we sat immediately. Not my preference but I hate that kind of crap and I was already in a mood.


The PDF version of the menu is HERE. Pretty big menu here of traditional Mexican items and some reinterpreted.

Chips. Pretty typical, but the salsa was good, cooked down the way I like it.

Cadillac margarita on the rocks, no salt. This was a nicely made margarita. The lime wasn’t that nuclear green crap and I could taste the tequila — which wasn’t the cheap stuff.

Now a note here. We were in a rush to get to a movie, and the parking had taken longer than we expected, so we told them we were in a hurry. This is a bit of a stress test for restaurants. The ultimate prize winner in this category, BTW, is Ortolan who flawlessly pounded through a huge prixe fixe in just over an hour. Overall La Sandia did fine with the speed, although they made us wait 20-25 minutes and then dumped all four dishes (2 appetizers and 2 entrees) simultaneously. Why they couldn’t have brought the appetizers 10 minutes earlier (a salad and a pre-prepped pastry) is anybodies guess. As I said, we got out of there in totally reasonable time, but they could have paced it better.

“LA SANDIA SALAD, arugula / cranberry / caramelized walnuts / goat cheese /pasilla-balsamic vinaigrette.”

“BEEF & CHORIZO EMPANADAS, braised beef / chorizo / raisins / oaxaca cheese / almond / crema fresca / chipotle sauce.” Very tasty. The outside was soft and buttery, and the inside rich and meaty. The sauce and the crema cut this nicely too. Exactly what I was looking for in this dish.

“ACHIOTE SALMON, grilled salmon / mild spice-citrus marinade / chile morita sauce /tomatillo-mango salsa / sweet corn tamal / charro beans.”

“SHRIMP AND AVOCADO SALAD, avocado stuffed with sauteed citrus-adobo shrimp / corn relish / cilantro pesto / chile chipotle aioli.” This was a fairly tasty and light shrimp and avocado salad. Perfect for a light lunch. The catch is, I didn’t order it.

I had ordered the Chipotle Shrimp entree. Now the room was very loud, and even though I repeated it 3-4 times I can understand the waitress making the error. The problem was that when she set it down I told her it was wrong and she said, “No it isn’t, there’s Chipotle in the dressing,” or some such nonsense. She then scooted away.

I ate it anyway because we didn’t have time, but I HATE that kind of BS. I don’t mind an honest mistake, they happen, but don’t try to snow the customer as to what he ordered. On a separate service note, I had ordered another Margarita in the gap waiting for the food but it came 15-20 minutes later with the check — after we had finished all our food.

I don’t like to sound petty, but this is a restaurant review, and drink timing is one of my pet peeves. Why would I want to pound an entire drink as I stand up to leave?

In any case, I called over the manager over the entree issue — something I do only about once a year — and he was very nice and apologetic and pulled the salad from the bill. Really I shouldn’t have paid for the second drink either, but I didn’t want to get into it. I do give him points for compensating correctly for the mistakes. He did fine by me, but the staff should NOT try and Jedi-mind-trick a customer into thinking he ordered something he didn’t.

Overall, the food here was pretty tasty. It’s owned by the same group as Zengo (which is hidden behind it), and while not as good, does maintain a solid kitchen. They have some serious service issues to work through, although it’s always possible it was a bad night. I’ll try it again at some point, I’m essentially a food based eater, and really find service mistakes to be more of an academic exercise in management problems than an actual irritation. Xino across the way had some similar problems in that we ordered about 10 small dishes and they delivered 90% of them simultaneously instead of 2-3 at a time! As someone who has eaten out at restaurants between 4 and 15 times a week for over thirty years, from taco shacks to Michelin 3 stars, I’ve pretty much seen it all.

Book and Movie Review: The English Patient

The English PatientTitle: The English Patient

Author: Michael Ondaatje

Genre: Literary Historical Drama

Length: 82,000 words, 300 pages, 162 min

Read: Spring, 2010

Summary: Lyrical.

_

I had seen the film when it came out (and several times after) and it’s long been one of my absolute favorites. So to that effect the novel has been sitting on my shelf for over ten years waiting to be read and this spring I finally got around to it. In some ways I’m glad I waited because I wouldn’t have appreciated the prose as much years ago. The voice, told in lightweight third person present, and lacking nearly all mechanical constructs (like dialog quoting or tagging, preamble explanations of scene transitions, etc.) has a breezy lyrical quality to it. It can only be described as delectable. There is a feel of watching a beautiful but flickery film, a series of stuccato images flash through your head as you read it. It’s worth quoting to illustrate:

“She stands up in the garden where she has been working and looks into the distance. She has sensed a shift in the weather. There is another gust of wind, a buckle of noise in the air, and the tall cypresses sway. She turns and moves uphill towards the house, climbing over a low wall, feeling the first drops of rain on her bare arms. She crosses the loggia and quickly enters the house.”

The plot — such as it is — involves a war battered Canadian nurse lingering in Italy at the close of WWII. She has isolated herself in a half destroyed villa and cares for a mysterious burn patient who is dying and too fragile to move. The book focuses on the nurse as its protagonist, concentrating on her relationship with an Indian (via the British army) bomb disposal tech and her efforts to come to terms with the war and loss. The patient slowly unravels his own tale to her. It is his story, set mostly in Egypt before and during the start of the war, which is the primary focus of the movie. In the book it serves more to offset and focus the nurse’s point of view.

I am blown away by the effort of translating this book for the screen. Frankly, although I loved the novel, I like the film better — this is rare. Anthony Minghella managed the near impossible, translating this gorgeous prose into an equally lyrical visual style. It’s less stuccato, more “lush and languid.” Film is a more linear medium, and Minghella focuses the story to create grander more visual arcs. To do this, he expanded the patient’s epic story of love and loss in pre-war Egypt. I’m a sucker for Egypt, the exotic, the British Empire in decay, and worlds that no longer exist. This story feels bigger than the nurse’s, being as it is more tied in with history and international events. But in both you have a powerful sense of people fighting for their passions, both interpersonal and intellectual, despite the baggage of past choices and the buffeting blows delivered by the unstoppable forces of history.

Both variants of this story are inherently complex, ambiguous, and emotional works. Look for no answers here, just gorgeously rendered questions.