デザイン面でもっと自由なWebPageを作成するためのモジュール群です. 詳しくは以下のサイトを参考にしてください. http://webviewer.php.xdomain.jp/?content=./Contents/ContentsViewer/ContentsViewer
このシステムは,2018/10/7を持って更新を打ち切り, 新しいシステムCollabCMSへと移行しました.
お手数ですが, 新システムCollabCMSをご覧ください.
The pure shell script (sh) that implements the Tetris game following the Tetris Guideline (2009).
Home Page: https://contentsviewer.work/Master/ShellScript/Apps/Tetris/Tetris
License: MIT License
デザイン面でもっと自由なWebPageを作成するためのモジュール群です. 詳しくは以下のサイトを参考にしてください. http://webviewer.php.xdomain.jp/?content=./Contents/ContentsViewer/ContentsViewer
このシステムは,2018/10/7を持って更新を打ち切り, 新しいシステムCollabCMSへと移行しました.
お手数ですが, 新システムCollabCMSをご覧ください.
I think it would be useful to be able to pause and resume the game.
We need to hide the playfield while posing. The Tetris guideline says the following.
I create an Issue as you might want to implement this. I will contact you before I start the implementation.
I noticed that the load was very high on ksh93. This is probably a bug related to local variables (typeset
) in ksh93. This is not reproduced by ksh93u+m and ksh2020.
Note: ksh2020 is the latest version on macOS, but it is a discarded version due to compatibility issues. The official latest version is ksh93u+, and the unofficial bug-fixed version is ksh93u+m.
This can be reproduced in the following way. If you remove typeset
, it will work fine.
diff --git a/tetris b/tetris
index c08a360..ee04710 100755
--- a/tetris
+++ b/tetris
@@ -530,7 +530,7 @@ if (PATH=/dev/null; f() { local v; }; f) 2>/dev/null; then
else
localvar() {
set -- "$1" "$*"
- eval "function $1 { typeset${2#"$1"}; _$1 \"\$@\"; }"
+ eval "function $1 { _$1 \"\$@\"; }"
}
fi
Use typeset
to reproduce it. (You may need to play with it for a while.)
@@ -1587,10 +1587,10 @@ _redraw_playfield() {
# 4 - rotation
# 5 - cell content
# 6 - mask with playfield
-localvar draw_piece posx posy type rotation content x y mask
-_draw_piece() {
+#localvar draw_piece posx posy type rotation content x y mask
+function draw_piece {
# at first, we should save arguments.
- posx="$1"; posy="$2"; type="$3"; rotation="$4"; content="$5"; mask="${6:-false}"
+ typeset posx="$1"; posy="$2"; type="$3"; rotation="$4"; content="$5"; mask="${6:-false}"
# set minos coordinates.
eval set -- \$piece_"$type"_minos_"$rotation"
I have an idea to implement a stack to store variables as a way to achieve local variables instead of typeset
. But in my opinion, it's overdoing.
I think it is better to stop using local
and typeset
and use global variables carefully. The current code works with very little modification. I am going to create a PR for the proposed changes.
https://tetris.fandom.com/wiki/Tetris_Guideline
- Game must have ghost piece function enabled by default.
Feature in detail: https://tetris.fandom.com/wiki/Ghost_piece
I think it would be useful to be able to replay without exiting the program after a game over. This allows you to skip the display time of copyright.
I create an Issue as you might want to implement this. I will contact you before I start the implementation.
local
is not available on POSIX sh.
So, if you want to improve compatibility, consider removing them.
I would like to see the number of combos displayed under the name of the technique when it is deleted in succession. It would make the game more fun.
Ref: https://harddrop.com/wiki/Combo
I would like to play 40 line time attack (splint mode) and measure LPM (erase lines per minute).
- 40 line mode (called sprint or 40 lines)
As with any other command, there is an overhead in executing the sleep command.
# FALL_SPEED_LEVEL_15=0.007
$ time sh -c 'i=0; while [ $i -lt 1000 ]; do i=$((i+1)); sleep 0.007 > /dev/null; done'
real 0m11.345s
user 0m0.911s
sys 0m1.748s
I would like to eliminate this. I suspect that measuring the execution time of the sleep command will improve this issue. I don't know if this will work, but I am going to give it a try.
After erasing lines, inputs during freeze is reflected.
Is it a specification?
Hello, friends.
I recently includes shtris as a package in x-cmd. Now, users can simply type "x shtris" and x-cmd will automatically download and execute. https://www.x-cmd.com/pkg/shtris
Installing x-cmd is extremely easy. Just run eval "$(curl https://get.x-cmd.com)"
and the process should be quick since x-cmd only uses shawk (shell/awk) and curl.
For more information on installation, please visit https://www.x-cmd.com/.
Maybe you can consider using x-cmd to start shtris.
Thank you to bring this game to terminal using shell.
I think "T-spin" should be displayed when one or more lines are deleted.
- 2 or 3 minute timed mode (called ultra)
Even if I give script --no-beep
option, terbell still rings.
no_beep
flag seems to be unused. Is not handler implemented?
It would be nice to see this.
Hello!
Thank you for your kindness and contributions!
As you know, there are many changes and improvements from v2.1.0.
I'd like to freeze the features and release the next version (v2.2.0). (But still going to fix bugs and merge small changes.)
I'll plan to release between 2021-12-30 ~ 2022-01-03.
I'm currently having trouble with this error. If this error occurs within tetris
, the lockdown_timer
will stop functioning. It may take some time for the error to occur.
I think this is probably an issue with macOS (Big Sur?). And I'm guessing it's an issue with /bin/sh
(bash 3.2.57 with apple patches). So this is a report to share information. Do you have any information on this?
This is a small code that can be reproduced.
#!/bin/sh
set -eu
timer() {
trap ':' USR1
while kill -0 "$1"; do
sleep 0.0001 &
wait ||:
done
echo "timer end" >&2
}
reader() {
while kill -0 "$1"; do
sleep 0.1 # smaller values should be more likely to occur
echo "reader 0"
done
echo "reader end" >&2
}
controller() {
timer_pid="$1"
echo "start [timer:$timer_pid]"
while IFS= read -r line; do
kill -USR1 "$timer_pid"
done
}
timer "$$" & timer_pid=$!
reader "$$" | controller "$timer_pid" # line 31
$ sh tetris
start [timer:26583]
tetris: line 26: kill: (26583) - No such process
tetris: line 31: 26583 Illegal instruction: 4 timer "$$"
$ docker run -it fidian/multishell
$ cat <<'HERE'>tetris
#!/bin/sh
set -eu
timer() {
trap ':' USR1
while kill -0 "$1"; do
sleep 0.0001 &
wait ||:
done
echo "timer end" >&2
}
reader() {
while kill -0 "$1"; do
sleep 0.1
echo "reader 0"
done
echo "reader end" >&2
}
controller() {
timer_pid="$1"
echo "start [timer:$timer_pid]"
while IFS= read -r line; do
kill -USR1 "$timer_pid"
done
}
timer "$$" & timer_pid=$!
reader "$$" | controller "$timer_pid" # line 31
HERE
$ bash-3.2.57 tetris
This Issue is only for sharing information and you are free to close it. If I can find a workaround, I'll suggesting it.
How do I configure these settings?
https://tetris.fandom.com/wiki/Tetris_Guideline
- Game must have this notice when the game starts (XXXX is the year the game was created):
Tetris © 1985~XXXX Tetris Holding. Tetris logos, Tetris theme song and Tetriminos are > trademarks of Tetris Holding. The Tetris trade dress is owned by Tetris Holding. Licensed to The Tetris Company. Tetris Game Design by Alexey Pajitnov. Tetris Logo Design by Roger Dean. All Rights Reserved.
I may be mistaken, but I think it sometimes shows up as "Mini T-Spin" when I am not doing Mini T-Spin. I am not sure how to reproduce this.
i suggest to change the name to tetrish or shelltris. if you dont want to thats fine lol its just an idea
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.