DP console is TURING COMPLETE!

Discuss anything to do with Nexuiz here.

Moderators: Nexuiz Moderators, Moderators

What do you think of this?

In-f'n-credible!
3
25%
Abso-f'n-lutely useless!
3
25%
Sorry, can't answer the poll - my brain just shut down forever.
3
25%
Mutually Inexclusive Polls Are Stupid
3
25%
 
Total votes : 12

DP console is TURING COMPLETE!

Postby divVerent » Mon Mar 19, 2007 9:15 pm

(DISCLAIMER: if you do not know what a Turing machine is, do not read on)

I just found out that the DarkPlaces console is Turing complete...

get this config file http://mensa.ath.cx/~polzer/temp/math.cfg and type "exec math.cfg" in game. It will calculate the prime numbers from 2 to 79 and print them out as unary numbers... as strings of ones. You can easily make it print more primes by changing the number of "inc v0"s in the big block - or let it run infinitely by removing the inc v0 block altogether (which would only work on a dedicated server because the display won't update while the calculation is running).

The first lines of the file prove that the DP console is Turing complete, that is, that you can do ANY sort of calculation using aliases (simply because it is a known fact that the INC/CLR/JE register machine can). What you can do is just limited by memory... and creepiness of code :P

Have fun!

BTW: you can also use that file as CPU benchmark. Run the dedicated server like this:

Code: Select all
$ time nexuiz-dedicated +"exec math.cfg; quit"


It takes 6.21s CPU time on my computer.

EDIT: excuse the slight obfuscation :P
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby GreEn`mArine » Mon Mar 19, 2007 10:12 pm

you're creepy, sorry... :o (yes, I do know what a turing machine is, learned it today in theoretical info II xD)
IRC quote:
[kojn] I've been coming a bit more recently
[kojn] she took it the dirty way
GreEn`mArine
Forum addon
 
Posts: 1509
Joined: Tue Feb 28, 2006 9:33 pm
Location: Germany

Postby Psychcf » Tue Mar 20, 2007 12:13 am

well, I can see it's use, but it's nothing to jump out of your pants about. Unless it was a REALLY HOT GIRL, which it's not... :lol:

interesting idea, you could use it for things like gradual mouse sensitivity ajustment bindings, or certain ajustments based on cvar values. I think...
Psychcf
Forum addon
 
Posts: 1554
Joined: Sun Dec 03, 2006 11:38 pm
Location: NY, USA

Postby divVerent » Tue Mar 20, 2007 7:05 am

Actually, it is hard to impossible to READ a value of a cvar, but one can (with quite some work, however) convert from unary to decimal representation...

so gradually changing sensitivity WOULD be possible. But even more ugly code...

This example proves that you can do basically everything in the DP console - but it does not prove that the resulting cfg files are maintainable.
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby GreEn`mArine » Tue Mar 20, 2007 8:16 am

hehe, so it's time for you to write a neat parser :)
IRC quote:
[kojn] I've been coming a bit more recently
[kojn] she took it the dirty way
GreEn`mArine
Forum addon
 
Posts: 1509
Joined: Tue Feb 28, 2006 9:33 pm
Location: Germany

Postby Xeno » Tue Mar 27, 2007 9:37 am

Image
Xeno
peregrinus originis incognitae
 
Posts: 396
Joined: Wed Nov 15, 2006 10:42 pm


Return to Nexuiz - General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron