[comp.sources.games.bugs] tetrix INIT_PAUSE

bjm@sabin.UUCP (Brendan J. McMahon) (03/03/89)

The first tetrix game (1 shar) compiled fine for me.  But the README said there
was a variable in tet.c INIT_PAUSE that will adjust the speed of the fall.

The only mention of INIT_PAUSE in the whole shar was in the README.

How do I adjust the speed without this nonexistant constant?

-- 
Brendan J. McMahon
Sabin Metal Corp. |     Refiners of Precious Metals    | Hardware Trouble?
Scottsville, NY   |  ****** Au  Ag  Pt  Pd  Rh ******  | Give us a call, we'll
716-538-2194      |lazlo!sabin!bjm  || ritcsh!sabin!bjm| melt your trouble away

dean@usceast.UUCP (Dean Karres) (03/07/89)

In article <204@sabin.UUCP> bjm@sabin.UUCP (Brendan J. McMahon) writes:
>
>The first tetrix game ...
>
>The only mention of INIT_PAUSE in the whole shar was in the README.
>
>How do I adjust the speed without this nonexistant constant?
>

Look in tet.c under the funtion NewGame(). There is a switch() with a
case of PLAY_KEY. There is a variable, CurrentPause, that must have
taken INIT_PAUSE's place. Anyway set this to your favorite value and
join the addicted ;-)

Dean...k...
-- 
Dean Karres
US-Mail: Math & Stat Comp Cntr, Math Dept, USC, Columbia, SC 29208
 E-Mail: ...{gatech!hubcap, mcnc!ece-csc}!ncrcae!usceast!dean
 - or -: relay.cs.net!cs.scarolina.edu!dean

jonl@sco.COM (ScoMole #192-1232A) (03/08/89)

+-I seem to recall bjm@sabin.UUCP (Brendan J. McMahon) writing:
|
|The first tetrix game (1 shar) compiled fine for me.  But the README said there
|was a variable in tet.c INIT_PAUSE that will adjust the speed of the fall.
|
|The only mention of INIT_PAUSE in the whole shar was in the README.
| 
|How do I adjust the speed without this nonexistant constant?

you change the value of CurrentPause on around line 140 or so in tet.c
to whatever you want.

-- 
jon luini, falcon@gorn.santa-cruz.ca.us

sparks@corpane.UUCP (John Sparks) (03/09/89)

In article <204@sabin.UUCP>, bjm@sabin.UUCP (Brendan J. McMahon) writes:
> The first tetrix game (1 shar) compiled fine for me.  But the README said there
> was a variable in tet.c INIT_PAUSE that will adjust the speed of the fall.
> The only mention of INIT_PAUSE in the whole shar was in the README.
> How do I adjust the speed without this nonexistant constant?

I found this same error. However after experimenting I found that you
need to change the variable CurrentPause in tet.c line 126.
here is an excerpt showing the line:

----


/**************************************************************/
NewGame()
{
	register int x,y;

	CurrentPause=0;

	while (!CurrentPause) {
		GetKey();
		switch (Key) {
			case BEEP_KEY   : Beep = !Beep ;
					  if (Beep) beep(); 
					  break;
			case SCORE_KEY  : DrawScore(); break;
			case MENU_KEY	: DrawMenu(); break;
			case BOSS_KEY	: Boss(); break;
change this ---->	case PLAY_KEY	: CurrentPause=2000; break;
			case QUIT_KEY   : Leave();
-----
good luck.

-- 
John Sparks      // Amiga  |  {rutgers|uunet}!ukma!corpane!sparks 
               \X/  UUCP   |  >> call D.I.S.K. @ 502/968-5401 thru 5406 << 
 
The next sentence is true.  The previous sentence is false.

dave@jplopto.uucp (Dave Hayes) (03/10/89)

OK, tetris gives me a segmentation fault when I try to run it. 
What's the problem?

============================================================================
Opinions expressed here are my own and not necessarily those of my employer. 
=-=-=-=-=-=-=-=-=-=-=-=-=<<<<<([Dave Hayes])>>>>>=-=-=-=-=-=-=-=-=-=-=-=-=-=
dave%jplopto@jpl-mil.jpl.nasa.gov | Jet Propulsion Laboratory   M/S 300-329                
{cit-vax,ames}!elroy!jplopto!dave | 4800 Oak Grove Drive Pasadena, CA 91109   
BIX:  dhayes                      | (818) 354-1910
           Now experiencing the unbearable lightness of being
============================================================================

lmna_cif@uhura.cc.rochester.edu (Louis Nau) (03/10/89)

In article <14235@elroy.Jpl.Nasa.Gov> dave%jplopto@jpl-mil.jpl.nasa.gov writes:
>OK, tetris gives me a segmentation fault when I try to run it. 
>What's the problem?
>============================================================================


	I too have the same problem.  Could someone please either post
or mail me as to why it does this?  It compiles without any problem, but
just dumps core when run.  I am trying to run it on a Sun 3/280S with SunOS.
Thanks for any help you can give.  I really want to run this game.
					-Louis M. Nau
					lmna_cif@uhura.cc.rochester.edu

-- 
	" I'm not bad, I'm just drawn that way. "
					-J. Rabbit

tif@cpe.UUCP (03/10/89)

Written  4:09 pm  Mar  7, 1989 by sco.UUCP!jonl in cpe:comp.src.gam.b
>+-I seem to recall bjm@sabin.UUCP (Brendan J. McMahon) writing:
>|How do I adjust the speed without this nonexistant constant?
>you change the value of CurrentPause on around line 140 or so in tet.c
>to whatever you want.

First, to increase the speed tetrix just decrements this value.  This
means that if you change this to 1000, you'll never even notice the
decrement.  I think the decrement should be something like

	CurrentPause -= 10 /* some fraction of original CurrentPause value */

Next, anyone got any ideas on how to do this without the busy-loop stuff?

How about doing all reads with a VTIM =< the desired pause time and VMIN
of 1.  Then using timeb (is that the right name for the time function that
gives fractional seconds) to actually time the game and decide when to move
pieces.  But the way read works if you did several moves in one tick they'd
all get done at the end of the tick (is that acceptable?).

What we really need is a read that causes interrupts but the only way I
can see doing that is with two processes.  One that does nothing but wait
for keys and send signals to the other.  Is this feasible?  What about
the old signal bug (too many too fast)?  Would you have to use sigset
and family?

			Paul Chamberlain
			Computer Product Engineering, Tandy Corp.
			{killer | texbell}!cpe!tif

ath@helios.prosys.se (Anders Thulin) (03/11/89)

In article <1085@ur-cc.UUCP> lmna_cif@uhura.cc.rochester.edu (Louis Nau) writes:
>In article <14235@elroy.Jpl.Nasa.Gov> dave%jplopto@jpl-mil.jpl.nasa.gov writes:
>>OK, tetris gives me a segmentation fault when I try to run it. 
>>What's the problem?
>	I too have the same problem.  Could someone please either post
>or mail me as to why it does this?  It compiles without any problem, but
>just dumps core when run.  I am trying to run it on a Sun 3/280S with SunOS.
>Thanks for any help you can give.  I really want to run this game.

A short wrestle with a debugger on a Sun3/60 shows that it is strcpy()
that dies. The buggy code can be found early in main():

:  /* if the user has set an environment variable "TETRIS" then process it */
:
:  if(argc<2 && getenv("TETRIS") == NULL) {
:    [ ... ]
:    strcpy(tetrisenv, getenv("TETRIS"));

Just change '==' to '!=' -- 15th commandment: thou shalt not invoke strcpy()
with a NULL source string.

-- 
Anders Thulin			INET : ath@prosys.se
ProgramSystem AB		UUCP : ...!{uunet,mcvax}!enea!prosys!ath
Teknikringen 2A			PHONE: +46 (0)13 21 40 40
S-583 30 Linkoping, Sweden	FAX  : +46 (0)13 21 36 35

mike@yunexus.yorku.ca (Mike Marques) (03/12/89)

Greetings...

Since a couple of people are asking this question I'm posting this:
In article <14235@elroy.Jpl.Nasa.Gov> dave%jplopto@jpl-mil.jpl.nasa.gov writes:
>OK, tetris gives me a segmentation fault when I try to run it. 
>What's the problem?
>============================================================================
There are a couple of bugs in the game.  The way to get around this one is
to give the game one of the arguments it requires.  I give it -N<name>.
That will get you through.
  
If anybody has fixed the bug in the high scores save routine, please
let me know.  Tetris keeps on appending userids together on the score
file for some strange reason.  You'll also notice that if you are
rotating a block as it is about to land on another one it will imbed
itself on the other blocks which I don't think is correct behaviour.

Real nice game otherwise and very addictive indeed.

							Mike


--
Mike Marques                         | Usenet: ......!utzoo!yunexus!mike 
York University (Computing Services) |         mike@nexus.yorku.ca
-------------------------------------| Bitnet: mike@libra.yorku.ca
Only visiting this planet...         | Voice:  (416) 736-5257

snsrjth@nmtsun.nmt.edu (- Jeff -) (03/12/89)

In article <1085@ur-cc.UUCP>, lmna_cif@uhura.cc.rochester.edu (Louis Nau) writes:
> In article <14235@elroy.Jpl.Nasa.Gov> dave%jplopto@jpl-mil.jpl.nasa.gov writes:
> >OK, tetris gives me a segmentation fault when I try to run it. 
> >What's the problem?
> 	I too have the same problem.  Could someone please either post
> or mail me as to why it does this?  It compiles without any problem, but
> just dumps core when run.  I am trying to run it on a Sun 3/280S with SunOS.

It core dumped when I compiled it too. But I think I have a solution. I found
that it is core dumping because of line 77 of main.c. 

It was dying in strcpy() on line 77:

		strcpy(tetrisenv, getenv("TETRIS"));

because the optional 'TETRIS' environment variable wasn't defined. When
I defined it (ie 'setenv TETRIS'), it seemed to run fine.

To fix this problem change line 74 in main.c from

	if(argc<2 && getenv("TETRIS") == NULL) {
		i=0, j=0, k=0;
		
to

	if(argc<2 && getenv("TETRIS") != NULL) {
		i=0, j=0, k=0;
		
Hopefully this should remedy the problem (Or at least it did with the
version I have).

			- Jeff

-- 
+--------------------------------------------------------------------------+
| - Jeff -                          |     snsrjth@nmtsun.nmt.edu           |
| ERROR: Quote file not found.      |     {...unmvax!nmtsun!snsrjth}       |
+--------------------------------------------------------------------------+

rjd@occrsh.ATT.COM (Randy_Davis) (03/13/89)

In article <440@corpane.UUCP> sparks@corpane.UUCP (John Sparks) writes:
>In article <204@sabin.UUCP>, bjm@sabin.UUCP (Brendan J. McMahon) writes:
>> The first tetrix game (1 shar) compiled fine for me.  But the README said there
>> was a variable in tet.c INIT_PAUSE that will adjust the speed of the fall.
>> How do I adjust the speed without this nonexistant constant?
>I found this same error. However after experimenting I found that you
>need to change the variable CurrentPause in tet.c line 126.

  Or you could do as I did: change the line 126 in tet.c to read:

CurrentPause=INIT_PAUSE;

  ..then add an INIT_PAUSE #define at the beginning of tet.c, so at least the
file now agrees with the README file.  You might also want to play around with
the decrement if you have to put a huge number in to get it to run slow enough,
as, from inspection of the code and the CurrentPause-- line, it only decreases
the pause by one for each line that is filled and removed.  If you start out at
>1000, it is going to speed up very slowly, which may or may not as you like it.

  It would be fairly easy to add the decrement as a #define, like #define DEC 10
then change the CurrentPause-- line to CurrentPause -= DEC;.

Randy Davis					UUCP: ...(att!)ocrjd!randy
						      ...(att!)occrsh!rjd

ppanicolle@orchid.waterloo.edu (Philippe Nicolle) (03/13/89)

In article <MIKE.89Mar11142353@yunexus.yorku.ca> mike@yunexus.yorku.ca (Mike Marques) writes:
>In article <14235@elroy.Jpl.Nasa.Gov> dave%jplopto@jpl-mil.jpl.nasa.gov writes:
>  
>If anybody has fixed the bug in the high scores save routine, please
>let me know.  Tetris keeps on appending userids together on the score
>file for some strange reason.

In tetris.h, only 8 chars are allocated per userid.  For userid's of 8 (or 
more as in my case) the first 8 chars are appended.  Simply change the line:

char high_user[15][8]; 

to

char high_user[15][13];

The second digit should 1 more than the maximum userid length.

Phil.
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Philippe P.A. Nicolle                     ppanicolle@waterloo.{edu, cdn, csnet}
ppanicolle@orchid.uwaterloo.ca            ppanicolle@water.{bitnet, uucp}
     {uunet, allegra, decvax, ihnp4, utzoo, ...}!watmath!orchid!ppanicolle

maujp@warwick.ac.uk (S Shipway) (03/13/89)

In article <204@sabin.UUCP> bjm@sabin.UUCP (Brendan J. McMahon) writes:
>The first tetrix game (1 shar) compiled fine for me.  But the README said there
>was a variable in tet.c INIT_PAUSE that will adjust the speed of the fall.

I failed to get most of the .c files too. I think the sharfile was half eated
as it crossed the atlantic - was it ( by any chance ) >100k? Whatever the
cause, can we gave a repost?

-Steve
-----------------------------------------+------------------------------------
JANET:  maujp@uk.ac.warwick.cu           | "I wonder as I wander, out under
ARPA:   maujp@cu.warwick.ac.uk           |  the sky .. "  - Trad. Carol.
BITNET: maujp%uk.ac.warwick.cu@UKACRL    | "Im the wanderer, yeah the
UUCP:   maujp%uk.ac.warwick.cu@ukc.uucp  |  wanderer .. " - Someone
-----------------------------------------+------------------------------------

anderson@cme.nbs.gov (William E. Anderson) (03/14/89)

In article <1085@ur-cc.UUCP>, lmna_cif@uhura.cc.rochester.edu (Louis Nau) writes:
> In article <14235@elroy.Jpl.Nasa.Gov> dave%jplopto@jpl-mil.jpl.nasa.gov writes:
> >OK, tetris gives me a segmentation fault when I try to run it. 
> >What's the problem?
> >============================================================================
> 
> 
> 	I too have the same problem.  Could someone please either post
> 					-Louis M. Nau
> 					lmna_cif@uhura.cc.rochester.edu

I beieve the segmentation fault in tetris (not tetrix) can be 
cured by changing the == to != on line 51 of init_tetris.c.

-- 
NAME:   William E. Anderson            TELE: (301) 975-2423
USMAIL: NIST (formerly NBS)            INTERNET: anderson@ceee.nbs.gov
        Rm. B-344, Bldg. 220           UUCP: uunet!cme-durer!anderson
        Gaithersburg, MD  20899