Re: checkers player
"Aaron S. Hawley" <[email protected]>
| Newsgroups | gmane.org.ballistichelmet.lambda |
|---|---|
| Organization | University of Vermont |
| Message-ID | <[email protected]> |
On Sun, 15 Feb 2004, Aaron S. Hawley wrote:
> I don't know... I'm sort of partial to this:
actually the C version was more correct.
> BEGIN {
> BOARD_SIZE = 8;
> srand();
> }
>
> function random_move()
> {
> return int(BOARD_SIZE * 1000 * rand() + 1000);
return int(BOARD_SIZE* rand()) + 1 "" \
int(BOARD_SIZE* rand()) + 1 "" \
int(BOARD_SIZE* rand()) + 1 "" \
int(BOARD_SIZE* rand()) + 1;
> }
>
> /^-?[1-9][1-9][1-9][1-9]$/ {
> print random_move();
> }
>
> ! /^-?[1-9][1-9][1-9][1-9]$/ {
> print "invalid move: " $0;
> }