Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Tristable oscillator

by ikegami (Patriarch)
on Jul 08, 2008 at 21:47 UTC ( [id://696348]=note: print w/replies, xml ) Need Help??


in reply to Tristable oscillator

Very neat! But it has four states.
State 1: y,ys,sy,,s,ys,sy, State 2: s,sy,sy,,y,sy,ys, State 3: y,ys,ys,,s,ys,sy, State 4: y,sy,ys,,s,ys,sy, State 2: s,sy,sy,,y,sy,ys, ...

That it has a distinct "initializing" state could seen as an advantage. If not, change the initial string to one of states 2, 3 or 4 to get a purely three state engine.

State 1: y,sy,ys,,s,ys,sy, State 2: s,sy,sy,,y,sy,ys, State 3: y,ys,ys,,s,ys,sy, State 1: y,sy,ys,,s,ys,sy, ...

Modified engine that tracks the states:

use strict; use warnings; local $_ = 'y,ys,sy,,s,ys,sy,'; my %h; my $i; for my $n (1 .. $ARGV[0] || 12) { $h{$_} ||= ++$i; print("State $h{$_}: $_\n"); eval; }

As for your question, longer is trivial. Shorter, on the other hand...

State 1: y/123/231/ State 2: y/231/312/ State 3: y/312/123/ State 1: y/123/231/ ...

And with an "initializing" state:

State 1: y/123i/231/ State 2: y/2311/312/ State 3: y/3122/123/ State 4: y/1233/231/ State 2: y/2311/312/

Replies are listed 'Best First'.
Re^2: Tristable oscillator
by Prof Vince (Friar) on Jul 09, 2008 at 13:50 UTC
    Yes, it has an initializing state. I didn't thought of specifying it because it was transient.

    With longer I meant "of longer period", but your examples show us how to actually get any permutation !

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://696348]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-26 00:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found