Comments on: DX. Dumb Robots http://mathfactor.uark.edu/2008/05/dx-dumb-robots/ The Math Factor Podcast Site Fri, 08 Aug 2014 12:52:06 +0000 hourly 1 https://wordpress.org/?v=4.9.25 By: Eric http://mathfactor.uark.edu/2008/05/dx-dumb-robots/comment-page-1/#comment-329 Mon, 19 May 2008 05:18:02 +0000 http://mathfactor.uark.edu/2008/05/13/dx-dumb-robots/#comment-329 For an added challenge, it turns out you can solve the puzzle using only one direction of travel.

Hint:
[spoiler]
You will need to assume that each instruction requires some amount of time, even when the robot does not travel.
[/spoiler]

Solution:
[spoiler]
1 – Go Left
2 – If you are standing on a parachute, go to instruction 4
3 – Go to instruction 1
4 – Go Left
5 – Go to instruction 4
[/spoiler]

]]>
By: jpincott http://mathfactor.uark.edu/2008/05/dx-dumb-robots/comment-page-1/#comment-324 Mon, 19 May 2008 04:34:37 +0000 http://mathfactor.uark.edu/2008/05/13/dx-dumb-robots/#comment-324 For the robot puzzle, if we label the commands thus:

L = Move left one step
R = Move right one step
Gn = Goto instruction n
Cn = Conditional goto – Gn iff currently standing on a parachute

then the following program will suffice:


1. R
2. L
3. R
4. C6
5. G1
6. R
7. G6

]]>
By: nklein http://mathfactor.uark.edu/2008/05/dx-dumb-robots/comment-page-1/#comment-323 Mon, 19 May 2008 04:12:12 +0000 http://mathfactor.uark.edu/2008/05/13/dx-dumb-robots/#comment-323 DUMB ROBOTS SPOILER

The shortest algorithm I am sure of has 7 instructions.

1. Go Left
2. If Parachute, Skip to 6
3. Go Left
4. Go Right
5. Skip to 1
6. Go Left
7. Skip to 6

Thus, both progress left at one square every three moves until the one who landed on the right hits the other robot’s parachute. After that, the robot that landed on the right speeds up to one square leftward every move.

I had assumed instruction time was negligible compared to moving time in arriving at the algorithm. If every instruction takes equal time, we can eliminate 3 and 4. Both robots move leftward one space every three ticks until the rightmost robot finds the other parachute. Then, the rightmost robot accelerates to one square leftward every two ticks.

]]>
By: cstarbi http://mathfactor.uark.edu/2008/05/dx-dumb-robots/comment-page-1/#comment-335 Mon, 19 May 2008 02:07:10 +0000 http://mathfactor.uark.edu/2008/05/13/dx-dumb-robots/#comment-335 Something that I found interesting: Find out if this code is the fastest way to cause a collision, and, if not, what code is? (I assumed in my solution that travel time is much much longer than the time it takes to detect a parachute or perform a goto)

]]>
By: strauss http://mathfactor.uark.edu/2008/05/dx-dumb-robots/comment-page-1/#comment-330 Fri, 16 May 2008 11:12:42 +0000 http://mathfactor.uark.edu/2008/05/13/dx-dumb-robots/#comment-330 (* Man, 27 by hand is quite a treat! Here’s the same result in Mathematica; I love the compactness of this language! *)

Collatz[1] = 1;

Collatz[n_] := If[EvenQ[n], n/2, 3 n + 1];

DoCollatz[n_] := (Print[Length[#] – 1, ” steps: “, #, “\n”]) &@ FixedPointList[Collatz, n]

(* so typing in DoCollatz[27] spits out the sequence starting at 27;

DoCollatz /@ Range[1,200] spits out results for 1 through 200 *)

]]>
By: cybersekkin http://mathfactor.uark.edu/2008/05/dx-dumb-robots/comment-page-1/#comment-328 Fri, 16 May 2008 05:05:21 +0000 http://mathfactor.uark.edu/2008/05/13/dx-dumb-robots/#comment-328 #I (being a dumb chemical robot) made an error going by hand
#so put this together as a simple test for a single number (27))

#!/usr/bin/perl
#
#
my $num = 27;
my $count = 0;
my $test3 = 0;

until( $test3 == 1 )
{
print “$count number is: $num\n”;

if($num eq 1)
{
$test3 = 1;
}
#get last digit if even divide by 2
if(!($num % 2))
{
$num = $num / 2;
}
#if not multiply by 3 and add 1
else
{
$num = (($num * 3) + 1)
}
$count++;
}

]]>
By: intchanter http://mathfactor.uark.edu/2008/05/dx-dumb-robots/comment-page-1/#comment-322 Wed, 14 May 2008 22:16:24 +0000 http://mathfactor.uark.edu/2008/05/13/dx-dumb-robots/#comment-322 I whipped up some Python code that any of you can hack on to try out the Collatz function. By posting it here, I am releasing it into the public domain, so have fun with it.

————-
#!/usr/bin/env python

def collatz(start):
    '''
    Run through the collatz series for a given number and return the number of
    iterations and the largest number found.
    '''
    current = start
    iter = 0
    max = start
    while current != 1:
        iter += 1
        if current % 2: # odd
            current = current * 3 + 1
        else: # even
            current = current / 2
        if current > max:
            max = current
    return (iter, max)

if __name__ == "__main__":
    target = 1000
    max_tuple = (0, 0, 0)
    iter_tuple = (0, 0, 0)
    for start in xrange(1, target + 1):
        (iter, max) = collatz(start)
        if max > max_tuple[2]:
            max_tuple = (start, iter, max)
        if iter > iter_tuple[1]:
            iter_tuple = (start, iter, max)
    print 'Largest integer hit:', max_tuple
    print 'Longest series hit:', iter_tuple
————-

]]>