# Does NOT work here
[verdepollo@atlas ~]$ cat /etc/redhat-release && bash --version
Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
GNU bash, version 3.00.15(1)-release (i686-redhat-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.
# Works flawlessly here:
[root@eve tmp]# cat /etc/redhat-release && bash --version
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
Edit 2: Also, it seems to work only when using GNU sleep.
Here is a version of maxxy() that dosn't use the xargs or awk externals:
maxxy()
{
local i a b
set -- ${box[@]}
while [ $# -gt 0 ]
do
[ 0${a[$2]} -lt $1 ] && a[$2]=$1
b[$2]="${a[$2]} $2"
shift ; shift
done
for i in "${b[@]}"
do
echo $i
done
}
Nice job. Looks good with bash 3.2.39 under a very out-dated (11.1) SUSE Linux and bash 4.1 under FreeBSD 8.2.
The only bug I've noticed is that a single block (1x1) always seems to go through the pile to the bottom. Maybe it's designed that way, but that seems odd if it is.
The attachment is already available now(the latest version 5.0)!
Please wait a moment for the link http://bash.webofcrafts.net/Tetris_Game.sh to be updated!(I've mailed Mendel(author of the Advanced Bash-Scripting Guide))
The trail mabye some issues releated with your SSH client tools but not my script as it runs pretty well under Xshell, Gnome Terminal, putty,SecureCRT etc!
Just keep your ssh client tools more newer version!
Of course, the whole algorithms and codes were designed and developed all by myself!
Version 6.0 will be released at 12/12/2012, better architecture, better optimization and new features!
Just waiting for me!
The variable mrx defines the unit of the pieces, the current value of mrx is [] ;
if you replace [] with xx (double x) ; then the [] will become xx , [][][][] will become xxxxxxxx etc, this way, you needn't to change anything else to the code, but if you want to change the code just as you have said that get
[]
[][]
[]
to
x
xx
x
(replace the [] with single x ), you must to change a lot of the source code(the value of the elements of the box arrays and some coordinates transformation functions),
as you can see that, the current subtraction between arbitrary vertical coordinates of the pieces is 2n, in your way ,the value of subtraction is n!