#!/usr/bin/perl -w
# $Id: format.pl,v 1.1.1.1 2008/10/12 04:05:34 alamos Exp $
# The state is in an array
use strict;

# A position array
my $sample_pos = [' ',  'o',  'o', 'o',  ' ',  'o', 'x',  'x',  'x'];

# Variable used in formatting
my $pos;

# Mapping to the opponent
my($opponent) = {x=>'o', o=>'x'};

################################################
#
# Format game position, using an array reference
#
################################################
format POS =
+-----+-----+-----+
|     |     |     |
|  @  |  @  |  @  |
$pos->[0], $pos->[1], $pos->[2] 
|     |     |     |
+-----+-----+-----+
|     |     |     |
|  @  |  @  |  @  |
$pos->[3], $pos->[4], $pos->[5] 
|     |     |     |
+-----+-----+-----+
|     |     |     |
|  @  |  @  |  @  |
$pos->[6], $pos->[7], $pos->[8] 
|     |     |     |
+-----+-----+-----+
.
################################################


sub display_position {
    $pos = $_[0];
    $~ = 'POS';
    write
}

&display_position($sample_pos);
