Thursday, October 13, 2011

YSON is a Structured Object Notation

Here's my proposed structure.  I want to keep the quotes to a minimum.

records:
[
    !record record:
    {
      !game &001 game:
      {
        date: 'March 2, 1962',
        versus: New York
      },
      notes: Awesome!,
      number: 100,
      !player &002 player:
      {
        name: Wilt Chamberlain,
        team: Philadelphia
      },
      record: Most points single game
    },
    
    !record record:
    {
        game: *001,
        number: 59,
        player: *002,
        record: 'Most points, one half'
    }
]


object
    hash

hash
    {}
    { pairs }

pairs
    key: value
    key: value, ...

key:
    string
    &id string
    !type string
    !type &id string
    
list
    []
    [ elements ]

elements
    value
    value, elements

value
    key
    string
    number
    object
    hash
    list
    true
    false
    null

Toward a common script grammar

It seems like scripting languages are slowly converging on a small number of common grammars and one structural data representation.


Common Grammars

The two common grammars are (1) simplified C and (2) Smalltalk.

More to the point, the simplification of C includes removing those pesky parentheses in control flow expressions.  I see them dropping everywhere, which I think is probably a good thing.

Anyway, it seems reasonable that most scripting languages' identities are bound by their feature sets and runtime details, rather than their basic grammar, and therefore it's only beneficial that they should converge.  Naturally it won't happen, but it would be nice.  

Alternately, it seems like an ideal scripting language would be able to understand many variants of C grammar, if only because the grammars are so closely related and are, essentially, representing solved problems Solved problems should not have variant grammars.


Common Structure

The structural data rep has little variations, but is essentially curly brackets to hold key-value pairs, a pair operator, and square braces to handle lists.  The data model is more powerful than JSON, and less powerful than YAML, but otherwise looks like them.  Call it JSON with references, or a strict, sane subset of YAML of scalars, lists, hashes, and references.  YSON, perhaps.

Seems that an ideal scripting language would therefore allow the user to specify the pair operator, key decoration, and value decoration.  Should take care of the major players.
 

Monday, October 3, 2011

Deneb sourcebook

...is crawling along, sometimes painfully slowly. But I'm still on schedule, thanks to giving myself lots and lots of time.  I'm currently working on "Fleets" - how duchies and smaller states in the sector squabble with each other by tradewar and skirmishings, and how they do it without provoking an Imperial response.

Wednesday, September 7, 2011

I've got no time to code Perl (or anything else)

I need a less demanding job.

One that pays what I'm getting paid, but lets me work less.

Yeah, right.

Funny, but twenty years ago, before I had a house and a family, I still didn't feel like coding once I got home from work. I suspect the reason for this is that the job sucks all the code out of me during the day, leaving my brain tired and ready for downtime.

I wish it weren't so.

The only solution is to work smarter, both at work and at home. To develop programming tools which will build a foundation upon which I can do what I want. Tools that can be written modularly, a little bit at a time. Bottom-up programming.

Perl, Javascript, and Traveller

For a couple years I've had a suite of Javascript pages for building stuff for Traveller, 5th edition. They use Traveller's new rules for stacking attributes onto a base item, resulting in myriads of armor, weapons, vehicles and smallcraft.

Very recently, I added a backend Perl component which will email the results to you.  So say you define a fast civilian grav truck which can reach orbit on your iPad.  Just enter your email address and it will email the results to you.

I wrote that bit because I wanted to use my scripts from my iPad, and didn't want to rely on cut-and-paste.

A link to the scripts is here: http://eaglestone.pocketempires.com/scripts/armormaker.html

Bioinformatics and Perl

In order to do bioinformatics programming, you have to know a LOT about genetics.  You have to know the terminology and cell, uh, let's call it 'mechanics' for now, until I know what the official Latin-based fourteen-syllable word really is.

You also have to know Perl.

I know Perl.  Maybe I can learn the language of medical science.  Maybe I can help.

Maybe it will help improve the standard of living for people with special needs.

If you had told me back in 1994 that learning Perl might aid research that could help my daughter, I would have laughed. Perl was a fun hobby. It helped me get write scripts that got work done faster so that I could spend more time writing scripts for Traveller. It was not really practical in a larger sense.

Monday, August 15, 2011

PushButtonEngine mini-reference

I have plans, always plans, to churn out some apps for the iPad. Some of those are conversions of the old 8-bit games I wrote for the Commodore 64 for my own geeky pleasure. In those cases, I want to use what I already know -- ActionScript development -- with a bit of help; that is, PushButtonEngine.

So this, a very brief, very basic component reference for me.  And an order:

(1) allocate the entity
(1a) make sure the "layerIndex" is correct... lower = further in the background
(2) create the spatial component
(3) create the sprite component
(4) create the controller component, pointing to the spatial comp.

ref: http://blog.flashgen.com/gaming/pushbutton-engine/pushbutton-engine-working-with-bitmap-sprites/




SimpleSpatialComponent - sets size and position of the Entity. 
SimpleShapeRenderer - assigns a basic shape (circle, square) to the Entity. 
Tends to "bind" to the Entity's size, position, rotation.
 
SpriteRenderer - what we actually use to represent an Entity. 
 
TickedComponent - gets called at each game tick. 
Used for controlling an Entity by listening to input, for example.
 
A flexible way to handle input is to map them to handlers.
 
public class InputMapKeyboardController extends TickedComponent
{...}
 
ref: http://blog.flashgen.com/gaming/pushbutton-engine/pushbutton-engine-handling-user-input/