Re: tetris(6) "Random Generator" and advanced controls

2022-09-11 Thread Tom MTT.
ping?



Re: tetris(6) "Random Generator" and advanced controls

2022-08-27 Thread Tom MTT.
Apparently, as some people pointed it out, DMARC doesn't influence spam score.
I thought that since my e-mail failed both SPF and DKIM and my DMARC
policy was set to quarantine my mail would've been trashed instantly.

I'm really sorry for the inconvenience, I won't do the same mistake twice.

~ tmtt



tetris(6) "Random Generator" and advanced controls

2022-08-27 Thread Tom MTT.
  putstr("Next shape:");
-
-   /* draw */
-   if (SOstr)
-   putpad(SOstr);
-   moveto(r, 2 * c);
-   putstr(SOstr ? "  " : "[]");
-   for (i = 0; i < 3; i++) {
-   t = c + r * B_COLS;
-   t += nextshape->off[i];
-
-   tr = t / B_COLS;
-   tc = t % B_COLS;
-
-   moveto(tr, 2*tc);
-   putstr(SOstr ? "  " : "[]");
-   }
-   putpad(SEstr);
+   /* draw preview of hold piece */
+   if (lastholdshape == NULL || holdshape != lastholdshape) {
+   lastholdshape = holdshape;
+   preview_shape(holdshape, "Hold shape:", 5, 2);
}
 
+
bp = &board[D_FIRST * B_COLS];
sp = &curscreen[D_FIRST * B_COLS];
for (j = D_FIRST; j < D_LAST; j++) {
@@ -478,7 +499,7 @@ scr_update(void)
 void
 scr_msg(char *s, int set)
 {
-   
+
if (set || CEstr == NULL) {
int l = strlen(s);
 
Index: tetris.6
===
RCS file: /cvs/src/games/tetris/tetris.6,v
retrieving revision 1.21
diff -u -p -u -p -r1.21 tetris.6
--- tetris.619 Jun 2017 06:04:16 -  1.21
+++ tetris.626 Aug 2022 19:35:42 -
@@ -32,7 +32,7 @@
 .\"
 .\"@(#)tetris.68.1 (Berkeley) 5/31/93
 .\"
-.Dd $Mdocdate: June 19 2017 $
+.Dd $Mdocdate: August 26 2022 $
 .Dt TETRIS 6
 .Os
 .Sh NAME
@@ -57,14 +57,24 @@ The default level of play is 2.
 The default control keys are as follows:
 .Pp
 .Bl -tag -width "" -compact -offset indent
-.It j
+.It h
 move left
+.It j
+soft drop
 .It k
-rotate 1/4 turn counterclockwise
+hold shape
 .It l
 move right
+
+.It a
+rotate counterclockwise
+.It s
+rotate 180�
+.It d
+rotate clockwise
+
 .It 
-drop
+hard drop
 .It p
 pause
 .It q
@@ -74,7 +84,7 @@ quit
 The options are as follows:
 .Bl -tag -width indent
 .It Fl c
-Classic tetris mode, in which shapes rotate clockwise and are drawn with
+Classic tetris mode, in which shapes are drawn with
 .Dq [] .
 .It Fl k Ar keys
 The default control keys can be changed using the
@@ -82,16 +92,16 @@ The default control keys can be changed 
 option.
 The
 .Ar keys
-argument must have the six keys in order; remember to quote any
+argument must have the ten keys in order; remember to quote any
 space or tab characters from the shell.
 For example:
 .sp
-.Dl "tetris -l 2 -k 'jkl pq'"
+.Dl "tetris -l 2 -k 'hjklasd pq'"
 .sp
 will play the default game, i.e. level 2 with the default
 control keys.
 The current key settings are displayed at the bottom of the screen
-during play.
+during play, unless the screen is too small.
 .It Fl l Ar level
 Select a level of play.
 .It Fl p
@@ -112,15 +122,21 @@ When this shape
 .Dq "touches down"
 on the bottom of the field, another will appear at the top.
 .Pp
-You can move shapes to the left or right, rotate them counterclockwise,
-or drop them to the bottom by pressing the appropriate keys.
-As you fit them together, completed horizontal rows vanish,
-and any blocks above fall down to fill in.
+You can move shapes to the left, right and down, hold them, rotate them
+counterclockwise, clockwise and by 180�, or drop them to the bottom
+by pressing the appropriate keys. As you fit them together, completed
+horizontal rows vanish, and any blocks above fall down to fill in.
 When the blocks stack up to the top of the screen, the game is over.
+.Pp
+The hold control allows you to swap the active shape with the one in
+the hold space. If there's none, the active shape is moved into the
+hold space and the next shape comes into the board. The shape in the
+hold space is kept as-is until you decide to use it. This feature can
+only be used once until the next randomly-chosen shapes comes.
 .Sh SCORING
 You get one point for every block you fit into the stack,
 and one point for every space a block falls when you hit the drop key.
-(Dropping the blocks is therefore a good way to increase your score.)
+(Hard dropping the blocks is therefore a good way to increase your score.)
 Completing a row rewards you with a bonus corresponding to the number
 of simultaneous rows completed.
 Your total score is the product of the level of play
@@ -168,5 +184,15 @@ and
 .Pp
 Shape previewing code adapted from code by
 .An Hubert Feyrer .
+.Pp
+Tetris' bag-based
+.Dq Random Generator ,
+hold piece and advanced controls made by
+.An Tom MTT .
+.Sh TODO
+A flag that adds a ghost shape at the bottom of the board
+to let the player know where the shape will land.
+
+A way to set arrow keys as controls in the -k flag.
 .Sh BUGS
 The higher levels are unplayable without a fast terminal connection.
Index: tetris.c
==