zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@fysh.org>
To: zsh-workers@sunsite.dk
Subject: Re: Tetris
Date: Mon, 3 Sep 2001 10:50:56 +0100 (BST)	[thread overview]
Message-ID: <E15dqNc-0003jf-00@bowl.fysh.org> (raw)
In-Reply-To: <Pine.LNX.4.33L2.0109022303580.3990-100000@phong.blorf.net> from Wayne Davison at "Sep 2, 2001 11:08:54 pm"

Wayne Davison wrote:
>	setopt localoptions unset

Ah, I thought I'd written it for zsh native mode, but there I actually
wrote it for my interactive setup.  Here's the proper fix.

--- tetris.zsh	Mon Sep  3 01:45:35 2001
+++ tetris.zsh	Mon Sep  3 10:46:46 2001
@@ -23,6 +23,7 @@
 
 zle -N tetris
 function tetris {
+	emulate -L zsh
 	tetris_save_buffer=$BUFFER
 	tetris_save_cursor=$CURSOR
 	local i
@@ -44,6 +45,7 @@
 }
 
 function tetris-new-block {
+	emulate -L zsh
 	tetris_block=$tetris_shapes[1+RANDOM%$#tetris_shapes]
 	tetris_block_y=0
 	tetris_block_x=4
@@ -59,6 +61,7 @@
 
 zle -N tetris-left
 function tetris-left {
+	emulate -L zsh
 	tetris-place-block " "
 	(( tetris_block_x-- ))
 	tetris-block-fits || (( tetris_block_x++ ))
@@ -68,6 +71,7 @@
 
 zle -N tetris-right
 function tetris-right {
+	emulate -L zsh
 	tetris-place-block " "
 	(( tetris_block_x++ ))
 	tetris-block-fits || (( tetris_block_x-- ))
@@ -77,6 +81,7 @@
 
 zle -N tetris-rotate
 function tetris-rotate {
+	emulate -L zsh
 	tetris-place-block " "
 	local save_block=$tetris_block
 	tetris_block=$tetris_rotations[$tetris_block]
@@ -87,6 +92,7 @@
 
 zle -N tetris-drop
 function tetris-drop {
+	emulate -L zsh
 	tetris-place-block " "
 	((tetris_block_y++))
 	while tetris-block-fits; do
@@ -98,6 +104,7 @@
 
 zle -N tetris-timeout
 function tetris-timeout {
+	emulate -L zsh
 	tetris-place-block " "
 	((tetris_block_y++))
 	if tetris-block-fits; then
@@ -110,6 +117,7 @@
 }
 
 function tetris-block-dropped {
+	emulate -L zsh
 	tetris-place-block "O"
 	local fl=${tetris_blankline// /O} i=$((tetris_block_y*tetris_hsz)) y
 	for ((y=0; y!=4; y++)); do
@@ -124,6 +132,7 @@
 }
 
 function tetris-block-fits {
+	emulate -L zsh
 	local y x i=$((1+tetris_block_y*tetris_hsz+tetris_block_x)) b=0x8000
 	for ((y=0; y!=4; y++)); do
 		for ((x=0; x!=4; x++)); do
@@ -143,6 +152,7 @@
 }
 
 function tetris-place-block {
+	emulate -L zsh
 	local y x i=$((1+tetris_block_y*tetris_hsz+tetris_block_x)) b=0x8000
 	for ((y=0; y!=4; y++)); do
 		for ((x=0; x!=4; x++)); do
@@ -155,6 +165,7 @@
 }
 
 function tetris-render-screen {
+	emulate -L zsh
 	local s i extras
 	extras=(
 		"Score: $tetris_score"
@@ -164,7 +175,7 @@
 	)
 	for ((i=0; i!=tetris_vsz; i++)); do
 		s="$s|${tetris_board[1+i*tetris_hsz,(i+1)*tetris_hsz]}|"
-		s=$s"   "$extras[1]$'\n'
+		s=$s${extras[1]+   $extras[1]}$'\n'
 		extras[1]=()
 	done
 	s="$s+${tetris_blankline// /-}+"
@@ -172,6 +183,7 @@
 }
 
 function tetris-timed-move {
+	emulate -L zsh
 	tetris-render-screen
 	LBUFFER=
 	RBUFFER=$'\n'$tetris_screen
@@ -181,6 +193,7 @@
 
 zle -N tetris-quit
 function tetris-quit {
+	emulate -L zsh
 	if [[ ! -o always_last_prompt ]]; then
 		BUFFER=
 		zle -M $tetris_screen


  reply	other threads:[~2001-09-03  9:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-03  0:03 Tetris Zefram
2001-09-03  6:08 ` Tetris Wayne Davison
2001-09-03  9:50   ` Zefram [this message]
2001-09-03 17:14 ` Tetris Bart Schaefer
2001-09-03 17:43   ` Tetris Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E15dqNc-0003jf-00@bowl.fysh.org \
    --to=zefram@fysh.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).