sgrid() { # print $1 while saving it to a grid state file
printf '%s' "$1"
[ "$2" -gt 1 ] && {
printf '%s' "$1" >> grid.state
} || { # >>
printf '%s' "$1" > grid.state
} # >
}
# L = lines; C = COLUMNS
listr() { # create a new typelist using the items in $2; MUST not contain $1
@ -44,25 +81,32 @@ listS(){ # return a number that determines the legth of the number of items
@@ -44,25 +81,32 @@ listS(){ # return a number that determines the legth of the number of items
[ "$LINES" -a "$COLUMNS" ] || exit 10 # exit code 10 will be for rgrid errors
unset IFS
for l in $(s 1 $LINES); do # for each line
for c in $(s 1 $COLUMNS); do # left to right across screen
typelist="wall;door;topwall;corner;blank" # these are set in rbase
tln=5 # $tln is the number of items in typelist
ml=0; for l in $(s 1 $LINES); do # for each line
mc=0; for c in $(s 1 $COLUMNS); do # left to right across screen
listgen # generate the typelist
#echo "$typelist"
# basically the idea here is have a list of all possible things a 1x1 space can be
# wall,door,blank,etc; these are ofc effected by the blocks around them and the current pos
# basically use ran() and some pain to have it pick what a block should be
# the list should be dynamic based on the pos and blocks around it
# ie; placing a door when there is no where for it to lead makes no sense
[ "$c" -le 3 -o "$l" -lt 2 ] && { # must be at least 3 over on C to create a door
# must also be at least 1 L down; this should also be effected by the surrounding blocks
IFS=';'
listr "door" "${typelist}" ";"
}
#[ "$mc" -eq "$MC" ] && {
# listr "topwall" "${typelist}" ";"
#}
# now use ran to generate a random number
# $((ran*ran))
ran=0; until [ "$ran" -gt 0 -a "$ran" -eq "$ran" -a "$ran" -le "$tln" ]; do