Saturday, February 26, 2011

Programmers Anonymous notes, 10


Unevenly Distributed: How I Learned To Stop Worrying And Love The @, history and reflection on 8-bit rogue-like games. Also see Sword of Fargoal -- addictive dungeon crawler for iOS.


Jacob is self-assigned to fixing the syntax in the Wikipedia automata theory page. His internal compiler naturally picks out the non-standard elements in standards based encyclopediae:
In theoretical computer science, automata theory is the study of abstract machines (or more appropriately, abstract 'mathematical' machines or systems) and the computational problems that can be solved using these machines. These abstract machines are called automata.
I am pleased as punch that I was able explain the relevance of finite state machines to programming. I drew one on the board, and Secnarf ran the machine (on her brain) on a word (program), producing the appropriate compiler error (rejection of the input word, and localizing the pointer to the appropriate memory location). Funny how computer programming is approached first using very difficult problems, making complex programs, to very simple problems, short finite state machines. It is not an easy path to understanding.

In C and C++, the tilde grapheme, "~", is the bitwise NOT operator.

We tinkered with the pegboard virtual game GLIQ (, see two posts ago) and started making modifications to construct virtual dice that somehow include dinosaur sound effects.

We talked about rolling virtual dice and wrap-around in both dimensions, 3-D dice on a 4-D toroidal manifold, represented on a 2-D finite window! I'm inclined to name our program Misner Dice, after Griffin's c = c + 1 comic, Misner a reference to Misner space.

We also talked about 32 and 128 bit IP addresses, with respect to xkcd: Nanobots. I think Griffin's comic wins the nerdy obscure humor cake.

Sunday, February 20, 2011

Programmers Anonymous notes, 1

Marvin Minsky was an adviser[7] on the movie 2001: A Space Odyssey and is referred to in the movie and book.
"Probably no one would ever know this; it did not matter. In the 1980s, Minsky and Good had shown how neural networks could be generated automatically—self replicated—in accordance with any arbitrary learning program. Artificial brains could be grown by a process strikingly analogous to the development of a human brain. In any given case, the precise details would never be known, and even if they were, they would be millions of times too complex for human understanding." Arthur C. Clarke

Moravec's paradox is the discovery by artificial intelligence and robotics researchers that, contrary to traditional assumptions, high-level reasoning requires very little computation, but low-level sensorimotor skills require enormous computational resources.
"In general, we're least aware of what our minds do best.Marvin Minsky
"The main lesson of thirty-five years of AI research is that the hard problems are easy and the easy problems are hard. The mental abilities of a four-year-old that we take for granted – recognizing a face, lifting a pencil, walking across a room, answering a question – in fact solve some of the hardest engineering problems ever conceived.... As the new generation of intelligent devices appears, it will be the stock analysts and petrochemical engineers and parole board members who are in danger of being replaced by machines. The gardeners, receptionists, and cooks are secure in their jobs for decades to come."[2] Steven Pinker

Trailer for "Rosies: The Human Computers of World War II"
Some of the women chosen to be human computers went on to become the first programmers of the machine-computer ENIAC.
The ENIAC Programmers worked tirelessly to make programming easier for all. They created the first sort routine, software application and instruction set, and classes in programming. Their work dramatically altered computing in the 1940s and 1950s. They paved the path to the modern software industry.

Processing (computer language) commands, borrowed from OpenGL's glPushMatrix() and glPopMatrix(), make my friend Libbey happy.

Few have made a name for themselves in games research, and Jane McGonigal is one of them. She is in demand as a speaker partly because of her enthusiasm for the potential of games, so I find it extraordinary that her recent book, "Reality is Broken", could draw this kind of bitter critisism:
Julian Hall wrote that he was "awed by the idealism while also believing that Reality is Broken could be an hour-long comedy show at the Edinburgh Fringe Festival."[5] Meanwhile, journalist Edward Champion called Reality is Broken "the most irresponsible nonfiction book I am likely to read this year," finding fault with McGonigal's overly optimistic viewpoint, her misunderstanding of psychology and science, and "a soul-sucking need for constant self-affirmation."[6]

Griffin's c = c + 1 comic, Misner. Obtuse, in a funny way, as usual. Charles Misner is a physicist, and his name is indelibly associated with the canonical book about general relativity, "Gravity", usually referred to as "Misner, Thorne and Wheeler", or just MTW. But Griffin's title refers to Misner space:
Misner space is an abstract mathematical spacetime, discovered by Charles Misner of the University of Maryland. It is also known as the Lorentzian orbifold \mathbb{R}^{1,1}/boost.
An intuitive analogy may be drawn with a video game screen, where a screen element exits the frame through the right side, only to re-enter the frame right away through the left side.
Moving the spatial limits (e.g.: the walls of a room) enclosing an existing Misner space in the physical world, could theoretically lead to time travel.

Griffin thinks that reality is continuous, best described by real values, not rational values. But perhaps Pacman is a good metaphor. People like George Lakoff  think that metaphor is the best (only?) description of conciousness. I personally loathe Lakoff's application of these ideas to the realm of politics. Others think that only through embodiment can machines become intelligent. Too bad Watson couldn't shake hands, nor even read, with its own eyes, the Jeapordy! clues.

The most recent XKCD
I made it a rule that as soon as I finished any task, or got bored with it, I had to power off my computer.
I could turn it back on right away--this wasn't about trying to use the computer less. The rule was just that the moment I finished (or lost interest in) the thing I was doing, and felt like checking Google News et. al., before I had time to think too much, I'd start the shutdown process. There was no struggle of willpower; I knew that after I hit the button, I could decide to do anything I wanted. But if I decided to look at a website, I'd have to wait through the startup, and once I was done, I'd have to turn it off again before doing anything else. (This works best if your ongoing activities are persistent online--for example, all my IRC chat is through irssi running in screen, so turning off my laptop doesn't make me sign out.)
A Boing Boing comment points out LeechBlock software for Firefox that gives better control over how to control browser clicktrance.
LeechBlock is a simple productivity tool: an extension for the Firefox web browser designed to block those time-wasting sites that can suck the life out of your working day.

Arts, Fear and Gaming

Fear and Gaming: Being and Nothingness and “Minecraft”

Jonathan Gourlay explores Minecraft, an ugly game with no point and endless possibility.

Friday, February 11, 2011

Programmers Anonymous notes, 0

 Sec Narf requested a start of a project:
Can we mess around with putting 'windows'(like buttons, text fields, or forms of output) in a window? We could do something like write a random number generator where you press a button, a dice rolling sound plays, and your result is displayed in the window. After that we could make maybe it more complicated...
How does one play sounds in our current C environment? I found a nice example code/program,, that implements a button (as a mesh icon with OpenGL) and plays a sound, a .wav file. It is only useful on a Windows (Win32 only?) platform, as it uses the Beep() or PlaySound() function that is found in the Windows API (declared in window.h):

        Beep(1000, 40);
        PlaySound("MySound.wav", NULL, SND_FILENAME);

On other hardware platforms, there are probably corresponding functions. This example program, with a screenshot, is from this set of OpenGL programs and code.

Jacob's comic blog, 256. Minimalist existentialism.

Sec Narf's Tumblr blog, DuctTapeCreations. It is not important to know how to factor polynomials, though it might improve your algebra grade. It is very important to know that polynomials can sometimes be factored.

From Irreduceable polynomials (Wikipedia):
It is helpful to compare irreducible polynomials to prime numbers: prime numbers (together with the corresponding negative numbers of equal modulus) are the irreducible integers. They exhibit many of the general properties of the concept of 'irreducibility' that equally apply to irreducible polynomials, such as the essentially unique factorization into prime or irreducible factors.

Griffin's newest c = c + 1 comic, "Star System". I like its meta-legend. I wish there was a facility for hyperlinking items in strips.

The Wormworld Saga, Daniele Lieske. Don't miss the descriptions of how he does his visual art and stories in his blog archives.

Critical gaming blog
    Emergence you can see
We have come to a point where how we talk about video games is insufficient in expressing how we feel and think about them. With each year comes increasingly complex games, yet we are still, for the most part, writing and talking about games on a shallow consumer level.

It is time to start thinking and writing critically about games. However, before we can do this, we must approach gaming from a critical mode or mindset. To do this, we must first understand of how the different parts of a game work together (game design). Unfortunately, many of the people who have experience in this area spend their time making video games. Beyond this, the body of knowledge that does exist is scattered at best. For this reason, it is hard for a thorough understanding of game design and critique to become widespread.

From Digital physics (Wikipedia):
"It always bothers me that, according to the laws as we understand them today, it takes a computing machine an infinite number of logical operations to figure out what goes on in no matter how tiny a region of space, and no matter how tiny a region of time. How can all that be going on in that tiny space? Why should it take an infinite amount of logic to figure out what one tiny piece of space/time is going to do?"
So I have often made the hypothesis that ultimately physics will not require a mathematical statement, that in the end the machinery will be revealed, and the laws will turn out to be simple, like the checker board with all its apparent complexities. But this speculation is of the same nature as those other people make—'I like it,' 'I don't like it'—and it is not good to be prejudiced about these things"   Richard Feynman

We're currently working with OpenGL libraries, and the dinoshade.c code is a very good OpenGL example:
Example for PC game developers to show how to combine texturing, reflections, and projected shadows all in real-time with OpenGL. Robust reflections use stenciling. Robust projected shadows use both stenciling and polygon offset.

GLfloat is defined in gl.h with the statement:
typedef float           GLfloat;        /* single precision float */
So it is just another name for float type, which is itself represented by 32-bits on a 32-bit operating system.

Declaration and explicit assignment of an array in C/C++, with 2 dimensions holding a list of coordinate pairs, where each coordinate is of type GLfloat:
GLfloat body[][2] = { {a,b}, {c,d} ... }
In C this array "body" is not of type GLfloat, but is a pointer to the memory location of the first element of the array.

Implicitly an array is passed by reference (as a pointer), not by value (as all the array elements). Only the pointer is needed, not a copy of every element of the array. But most functions will need to know the size of the array, so a second argument is needed because the array size is "out of scope" within the function:
extrudeSolidFromPolygon( body, sizeof(body), bodyWidth, ...);

  We can use pointer arithmetic to trim the first 2 coordinate pairs, if we know the size of each element of the array:
// a pointer to the 5th element of the array  
body + 4   

// size (in memory) of the  array without the
// first 4 elements, or 2 coordinate pairs

// as arguments in a function call
extrudeSolidFromPolygon( body + 4, sizeof(body)-4*sizeof(GLfloat), ... );
This references the array elements starting with the fifth, through the end of the array. The syntax looks strange (and it is not obvious) if you are not used to thinking about array names as a pointer to memory.