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: 356

Views: 280

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: 113
Comments: 2
Ratings: 1
Date added: 2019/10/08 18:21:05
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: One Hit Wonder
Rating: 5
Filesize: 24.06 kB
Downloads: 368
Comments: 3
Ratings: 1
Date added: 2012/10/21 11:36:14
Made with: Algodoo v2.0.2 Edu
Rating: rated 5
download
Title: Another Volcano
Rating: 5
Filesize: 34.22 kB
Downloads: 495
Comments: 1
Ratings: 1
Date added: 2011/04/03 17:42:09
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Title: Mouseover Light
Rating: 5
Filesize: 222.64 kB
Downloads: 85
Comments: 2
Ratings: 1
Date added: 2019/07/20 10:59:49
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: MORSE CODE SENDER
Rating: 5.625
Filesize: 0.93 MB
Downloads: 1082
Comments: 2
Ratings: 2
Date added: 2013/08/06 09:02:40
Made with: Algodoo v2.1.0
Rating: rated 5.6
download
Title: Algoduuino HELP
Rating: 5.625
Filesize: 332.75 kB
Downloads: 322
Comments: 0
Ratings: 2
Date added: 2015/01/21 16:10:03
Made with: Algodoo v2.1.0
Rating: rated 5.6
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.