Jake Charman

Resident Geek of Nitrous Junkie Racing



Using Tug Of War Dynamics In Programming…

Tue 25 Aug 2015


So i heard about some researchers claiming that an iron bar could make decisions based on their position. This looked to me like an interesting method that could be used in programming for various different purposes.

 

Script used:

import random

ironBar = 0

for x in range (0, 5):
    randOne = (random.randint (0, 9))
    randTwo = (random.randint (0, 9))

    if randOne > randTwo:
        ironBar = (ironBar + 1)

    elif randTwo > randOne:
        ironBar = (ironBar – 1)

    elif randOne == randTwo:
        ironBar = (ironBar)

    print (randOne)
    print (randTwo)
print (ironBar)