Anyone know of any Game Programming Chrestomathies?

Started by
7 comments, last by Tutorial Doctor 9 years, 11 months ago

In computer programming, a program chrestomathy is a collection of similar programs written in various programming languages, for the purpose of demonstrating differences in syntax, semantics and idioms for each language. This term is thought[according to whom?] to have been first used by Eric S. Raymond in the Retrocomputing Museum web site. It is used by analogy to a linguistic chrestomathy.

http://en.wikipedia.org/wiki/Chrestomathy

http://stackoverflow.com/questions/1527573/language-syntax-comparison

I have been thinking of making something like this myself, and today when looking up language syntax comparisons, I found out that there is actually a name for it. CHRESTOMATHY!

The chrestomathies I found looking through Stack Overflow are not quite verbatim, but I guess that is how languages are? Perhaps there is always some interpretation going on?

Check out this list for making a hello World Program.

And check out the various tasks that are collected for over 500 languages.

It would be nice if there were game chrestomathies, or perhaps it would be a nice thread on this site? It would probably have to be more than a thread, perhaps a whole new category.

I would only expect the top languages to be mentioned here, like C++, Lua, C#, Java, etc.

Anyone know of any game programming related chrestomathies for C++ to Lua? Or perhaps from C++ to Java?

I would like some for Lua to C++ particularly.

They call me the Tutorial Doctor.

Advertisement

oh god, another buzz word smile.png

a simple search using none buzz words gives this

http://en.wikipedia.org/wiki/Comparison_of_programming_languages_(syntax)

Gotta say, I never heard that word in my life. Anyway, rosettacode is the website I usually hit on google when I need a quick code recipe. I think it does its thing well. What would be specific enough to qualify as game development related?


The chrestomathies I found looking through Stack Overflow are not quite verbatim, but I guess that is how languages are? Perhaps there is always some interpretation going on?

Yes, one could say some things are lost in translation. If all languages looked exactly the same, they would all be the same. And there are of course often multiple ways of writing the same program, all equally valid and efficient, code is to a large extent influenced by the developer, you can sometimes recognize the author just by reading the code if you know him well enough (and I don't just mean style, also the way the program logic as a whole flows).

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

oh god, another buzz word :)

a simple search using none buzz words gives this

http://en.wikipedia.org/wiki/Comparison_of_programming_languages_(syntax)


Yeah, I saw that one, which actually lead me to he links I posted.

But I am talking about things like rosetacode where you have a tic tac toe game in several languages, as a comparison to see how the same game might be done across multiple languages.

I had been thinking about writing good pseudocode and just filling in, but this idea seems better.

For instance, a game loop loos different across languages. A simple GUI could be sort of translated to another.

That is the word I am looking for, some type of translation key.

I have actually been doing something similar for Python and Lua.

They call me the Tutorial Doctor.

What we used to do in the old days was write a macro file, this became a sort of programming language in it's own rite and solved a lot of platform issues.

so we could have something like this


    cpy r0,#1
    cpy r1,#2
    add r1,r0
    cpy r1,r0

then we could create a macro file for each processor defining the cpy and add macros and we didn't have to port the code from 6502 to z80 or 68000 to 8086

This grew into a language called VP, a sophisticated assembler like language with it's own assembler which created processor dependant assembler as output.

(this eventually grew into a byte code based system which was translated into native machine code at load time giving ultimate platform independence, but that's another story)

Maybe it would be interesting to do the same here.

You could design a language and write an app that output translated this into c/c++,lua, python, whatever

If you wrote it in javascript you could do it all in a web page.

Just a thought to get you going smile.png

This presupposes that there is one "right" way to do the thing in question, or at least one specific "general" case. There are lots of different ways to write the same game loop in a given language. Which one should be provided as the "translation" from another language?

I fail to see the usefulness of this as anything other than a curiosity. Sounds like an attempt to cut learning corners to me.

The usefulness is if you started a game in one language, and wanted to adapt it to another, you could do so faster, or at least get a head start.

It would get too complicated where APIs are concerned perhaps.

The tic tac toe example is almost a good example of what I am thinking of, except that there could have been a better translation.

They call me the Tutorial Doctor.


The usefulness is if you started a game in one language, and wanted to adapt it to another, you could do so faster, or at least get a head start.

How? By taking each bit of your game, finding the equivalent bit on an online chrystanthamum or whatever its called, looking up the translation then copying that into your new game?

Sounds far easier to just, you know, learn the new language to me.

The ideal way would be a translator actually, similar to what Stainless presented.

But I would use it as a basis, for example, making a simple GUI, then take that and expand it. So I would still have to know the new language anyhow. Nowhere is that being avoided with a chrestomathy.

They call me the Tutorial Doctor.

This topic is closed to new replies.

Advertisement