601
@verb #2124:"description" this none this rxdo #9780
@program #2124:"description" this none this
"Copyright (C) Olivier Beaton (aka Quadir), all rights reserved."
"Licensed under BSD, see http://www.opensource.org/licenses/bsd-license.php"
""
"Syntax:"
" :description()"
"--"
"Return a formatted playing board."
if (this.generic == this)
return pass(@args)
endif
chip1 = this.msg_chip1
chip2 = this.msg_chip2
nochip = this.msg_nochip
desc = {}
desc = {@desc, tostr(" _", @$list_utils:intersperse($list_utils:range(1, this.width), tostr("_ _")), "_ ")}
grid = this.grid
for row in (grid)
for cell in [1..length(row)]
row[cell] = `{chip1, chip2}[row[cell]] ! E_RANGE => nochip'
endfor
row = $list_utils:intersperse(row, " | ")
desc = {@desc, tostr("| ", @row, " |")}
desc = {@desc, tostr("+", $su:space(this.width * 2 * 2, "---+"))}
endfor
desc = {@desc, $su:center(tostr($su:capitalize($su:english_number(this.connect)), " connected wins."), this.width * 2 * 2 + 1)}
if (this.width != 7 || this.height != 6 || this.connect != 4)
desc = {@desc, "Non Regulation Board"}
endif
desc = {@desc, ""}
desc = {@desc, tostr("It is player ", this.player, "'s turn.")}
desc = {@desc, tostr("[ ", chip1, " ] is player 1.")}
desc = {@desc, tostr("[ ", chip2, " ] is player 2.")}
desc = {@desc, tostr("[ ", nochip, " ] is a blank space.")}
return desc
"Last modified by Quadir (#9780) on Mon Sep 23 11:25:43 2002 MDT."
.
0