(Contest) How do you add 1 to a number?
Ok, now the concept of this thread is simple. Come up with ways to add 1 to a variable. It can be any programming language (and some other things too...), and the same code in different languages counts as a different method. You can only write one way per post, and no streams of posting to get around that.
I want to see how many different ways we can get. You can do some really obvious and rather lame things, but creativity would be nice.
0_0 to 0_0R.
0_1 to 1_1R.
1_0 to 0_1R. [stop]
1_1 to 1_1R.
This is for the TN + 1 Turing machine in unary notation. The form is basically state_num where state is the machine''s internal state and num is the number on the tape. R means move right.
This is a fairly non-conventional way of adding one. Go ahead and post anything you want, in C, Java, VB, Perl, Pascal, COBOL, FORTRAN, BASIC, Machine, assembly, Lisp, Scheme, Haskell, php, etc. Only one condition: You can''t write the same exact code and call it a different language because the two languages are similarly based (e.g. C, C++, C#, Java). Weird mathy notation is ok too, I guess.
Well, I started it, so let the games begin!
ASM 386
add eax,1;if the number is in eax
C
number++;
or
++number;
or
number+=1;
etc..
Height Map Editor | Eternal Lands | Fast User Directory
add eax,1;if the number is in eax
C
number++;
or
++number;
or
number+=1;
etc..
Height Map Editor | Eternal Lands | Fast User Directory
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement