#!/usr/bin/perl -w
#
# an example route for the worm engine worm.pm, fusionworm-version
#
# author: Max-Gerd Retzlaff <m.retzlaff@gmx.net>
#                           <mgr@hannover.ccc.de>
#
# date:    Fri Aug  2 15:18:35 CEST 2002
# verion:  0.2
#
# GnuPG-Information:
#  Fingerprint: 49CD 21F2 41AC 72C5 D0D1  27DC C2B2 48AE 8123 9F12
#  pub  1024D/81239F12 2002-03-12 Max-Gerd Retzlaff <m.retzlaff@gmx.net>
#  uid                            Max-Gerd Retzlaff <mgr@hannover.ccc.de>
#  sub  4096g/63E36E39 2002-03-12
#
# This application is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version. 
#
# This application is distributed in the hope that it will be useful, 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111 USA.  

use fusionworm;
use termfusion;
init_worm( "\@.OOOOOOooooooo...... " );
#init_worm( "there is more than one way to do it... " );
#init_worm( "'O o o ... . .  .  .   . " );
set_worm_delay(0.04);

set_clients( [
	      { host => "localhost", port => "2306" },
	      { host => "localhost", port => "2301" }
	      ],
	     [
	      { host => "localhost", port => "2302" },
	      { host => "localhost", port => "2303" }
	      ],
	     [
	      { host => "localhost", port => "2304" },
	      { host => "localhost", port => "2305" }
	      ]
	     );
connect_clients();
show_clients_info();

printallcenter( "::[ fusionworm ]::" );
select( undef, undef, undef, 1 );
clrscr();
my $width=40;

while(1) {
    # top left -> bottom right
    foreach my $x (1..$width) {
	creep_worm( $x, $x );
    }
    # bottom right -> top right
    for( my $x = $width; $x != 1; $x-- ) {
	creep_worm( $width, $x );
    }
    # top right -> top middle
    for( my $x = $width; $x != $width/2; $x-- ) {
	creep_worm( $x, 1 );
    }
    # top middle -> bottom middle
    foreach my $x (1..$width) {
	creep_worm( $width/2, $x );
    }
    # bottom middle-1 -> center
    for( my $x = $width; $x != $width/2; $x-- ) {
	creep_worm( $width/2-1, $x );
    }
    # center -> left middle
    for( my $x = $width/2-1; $x != 1; $x-- ) {
	creep_worm( $x, $width/2 );
    }
    # left middle -> top left
    for( my $x = $width/2; $x != 1; $x-- ) {
	creep_worm( 1, $x );
    }
}
disconnect_clients();
