Browse Search Popular Register Upload Rules User list Login:
Search:
SELF-MODIFYING CODE

Image:
screenshot of the scene

Author: Xray

Group: Default

Filesize: 16.28 kB

Date added: 2013-01-10

Rating: 5.6

Downloads: 563

Views: 454

Comments: 2

Ratings: 2

Times favored: 0

Made with: Algodoo v2.0.2 Edu

Tags:

Scene tag

Some of you experienced software engineers may be familiar with self-modifying code. It is when a number of program lines of code modifies itself, and then the resultant new code executes differently from the original (unmodified) program code. This is rarely done by professional programmers because of the potential problems that it can create, and it can be a nightmare to maintain, especially by other people besides the original programmer.

In this scene, the code doesn't actually modify itself, but it does "spawn" new code in different areas of the script menu of a box.
I display text on the box to show each stage of programs and their status. Unfortunatley, the program code that's written to the variables in the script menu do not automatically update when the script menu is being displayed. So the only way that you can see the code that's been created is to left-click your mouse cursor in code sections of the airfrictionMult and the controllerAcc variables after starting and then stopping Algodoo.

An example of truely self-modifying code would be:
In the airFrictionMult variable, place the following code:
{airFrictionMult = 1.0}. As soon as you enter that line of code and either click outside the box, or you hit the Enter key, the code will disappear, and the value 1.0 will be written to the airFrictionMult variable! Of course that type of code has no useful purpose, but there sometimes has been very clever code written for very specific processes that cannot otherwise be done using conventional coding techniques. Although the practice of writing self-modifying code is very much frowned upon by professional engineers, people still do it. :tdown:
Please log in to rate this scene
edit
Similar scenes
Title: Crack the code
Rating: 5
Filesize: 21 kB
Downloads: 360
Comments: 4
Ratings: 1
Date added: 2019/10/08 18:21:05
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: code lock
Rating: 5.625
Filesize: 123.71 kB
Downloads: 481
Comments: 5
Ratings: 2
Date added: 2010/12/15 19:20:35
Made with: Phun
Rating: rated 5.6
download
Title: Human Code
Rating: 5
Filesize: 38.83 kB
Downloads: 984
Comments: 0
Ratings: 1
Date added: 2020/03/28 22:02:57
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Morse Code Machine
Rating: 5.625
Filesize: 231.1 kB
Downloads: 2325
Comments: 4
Ratings: 2
Date added: 2013/07/23 00:14:11
Made with: Algodoo v2.1.0
Rating: rated 5.6
download
Title: Code Generator(not working atm)
Rating: 5
Filesize: 14.03 kB
Downloads: 404
Comments: 1
Ratings: 1
Date added: 2014/06/06 20:40:42
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: QR code dropping on another QR code
Rating: 5
Filesize: 37.89 kB
Downloads: 421
Comments: 1
Ratings: 1
Date added: 2021/07/15 09:18:56
Made with: Algodoo v2.1.0
Rating: rated 5
download
It was used many times before, why you pay attention? :P
Kilinich - Yes, I know that it was used before, but no one has made a tutorial about it before. I wanted to show people who have never heard of this technique.