[comp.sources.games.bugs] MS-DOS patches to Scrabble

talvola@cory.Berkeley.EDU (Erik Talvola) (04/11/89)

 After getting Scrabble, I decided to port it over to MS-DOS.  It didn't
turn out to be too bad.  Here is a Shar file which has a Makefile, patches
to various files, a replacement util.c file, etc.  Please let me know if
you have any comments on my changes, bug fixes, etc.

--
Erik Talvola               | "It's just what we need... a colossal negative 
talvola@cory.berkeley.edu  | space wedgie of great power coming right at us
...!ucbvax!cory!talvola    | at warp speed." -- Star Drek

------------------------CUT=HERE---------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	README.PC
#	Makefile.tcc
#	board.dif
#	dict.dif
#	move.dif
#	player.dif
#	plural.dif
#	savegame.dif
#	scrabble.dif
#	scrabblh.dif
#	tty.dif
#	user.dif
#	utilh.dif
# This archive created: Mon Apr 10 20:36:51 1989
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'README.PC'" '(2914 characters)'
if test -f 'README.PC'
then
	echo shar: "will not over-write existing file 'README.PC'"
else
cat << \!Funky!Stuff! > 'README.PC'
FILES:

    README.PC		This file
    Makefile.tcc	A make file for Turbo-C and Opus Make

    board.dif     	Patch file for board.c
    dict.dif		Patch file for dict.c
    move.dif   		Patch file for move.c
    player.dif   	Patch file for player.c
    plural.dif   	Patch file for plural.c
    savegame.dif  	Patch file for savegame.c
    scrabble.dif   	Patch file for scrabble.c
    tty.dif        	Patch file for tty.c
    user.dif       	Patch file for user.c

    scrabblh.dif	Patch file for scrabble.h
    utilh.dif      	Patch file for util.h

    util.c		Replacement for original util.c



  This is an initial attempt to get Wayne Christopher's Scrabble program
running under MS-DOS.  I initially attempted to use Microsoft C v5.1, but
soon ran into some strange bugs, which prompted me to switch over to Turbo-C.
After a little while, I was able to get the whole thing compiled and running
fine.  

  To compile, you will need Turbo-C, and Bjorn Larsson's PC-Curses package.
Bjorn's address is:

 ...mcvax!enea!infovax!bl 

  from the notes in the PC-Curses source files.  I used version v1.3 of the
code - earlier (or later) versions may also work.

  I have included a Makefile which seems to work fairly well.  I cheated in
creating the compilation command for scrabble.exe though - I use *.obj in
the command line, which will bomb if, for example, plural.obj is lying 
around.  Before you do a make, just delete any spurious obj's like this.
I used OpusMake from Opus Software, an excellent program - other make programs
may or may not work.

  Note that refresh.c from the original distribution is not needed on the
PC.  All the diff files should be applied to the original distributed
sources.  There is a new util.c file needed for MS-DOS, as the diffs to
the original Unix file were larger than the file itself.

  The only problem so far is that I can only get the program to read in a 
dictionary of about 88K or so, which may be sufficient, but I don't have a
good dictionary for DOS.  In testing, I just skipped about 3 out of every 4
words from the one I played with on Unix, and it loaded, but a lot of good
words were obviously deleted by using this random deletion.  Also, the Unix
dictionary has things like roman numerals, words such as "qs" (more than one
q), which aren't good Scrabble words.  If anyone gets a good DOS dictionary,
tell me.  Also, if you can up the limit that the program can read in, please
let me know as well.  I don't have much experience with far pointers, and may
have used them incorrectly.

  Anyway, I hope people can get some use out of this program.  It seems pretty
robust, and plays a decent game of Scrabble (even with the mutant wordlist).
Please let me know if anyone makes any improvements to the MS-DOS port.


	 Erik Talvola

	 talvola@cory.berkeley.edu
	 ...!ucbvax!cory!talvola
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'Makefile.tcc'" '(1858 characters)'
if test -f 'Makefile.tcc'
then
	echo shar: "will not over-write existing file 'Makefile.tcc'"
else
cat << \!Funky!Stuff! > 'Makefile.tcc'

# RCS Info: $Revision: 1.2 $ on $Date: 89/03/15 11:16:17 $
#           $Source: /yew3/faustus/src/scrabble/RCS/Makefile,v $
# Copyright (c) 1987 Wayne A. Christopher, U. C. Berkeley CAD Group
#
# Program Makefile
#
# This makefile has the standard options "clean", "require", and "install".
# Also available are "lint", "depend", "tags", "opt", "debug", and "prof".
# "opt" causes the program to be compiled optimized, "debug" with -g, and
# "prof" with -pg.  As an added bonus, the Makefile remembers the last of
# these options given.
#
# Heavily mutated to work with OpusMake, Turbo-C v1.5 (at least), and
# Bjorn Larsson's (...mcvax!enea!infovax!bl) PC-Curses package.
#
#   Erik Talvola
#   talvola@cory.berkeley.edu
#   ...!ucbvax!cory!talvola

what: all

#---- Tool specific stuff ----

PROGRAM = scrabble.exe

SRC	=		\
	board.c		\
	dict.c		\
	move.c		\
	player.c	\
	savegame.c	\
	scrabble.c	\
	tty.c		\
	user.c		\
	util.c 

OBJ	= board.obj dict.obj move.obj player.obj savegame.obj \
	scrabble.obj tty.obj user.obj util.obj 

HDR	=		\
	scrabble.h	\
	util.h

SUPPORT		=	plural

CC = tcc
MODEL = c
CFLAGS = -m$(MODEL) -I\turboc\include -G -O -Z -DMSDOS
LIBDIR = \turboc\lib

LIBS = $(LIBDIR)\$(MODEL)curses.lib
LDFLAGS = -L$(LIBDIR) -m$(MODEL)

#---- Generic stuff ----

# EXTDEFINES are things that come from a higher-level Makefile

all: date.h $(PROGRAM) $(SUPPORT).exe
	@echo "All done."

# the next rule isn't very good - before making scrabble.exe, delete
# plural.obj (and any others) if they exist.  I didn't bother writing
# a file to give to LINK, and the command line is too long to handle all
# the obj's directly.

$(PROGRAM): $(OBJ)
	$(CC) -e$(PROGRAM) $(LDFLAGS) *.obj $(LIBS)

$(SUPPORT).exe: $(SUPPORT).obj
	$(CC) -e$(SUPPORT) $(LDFLAGS) $(SUPPORT).obj $(LIBS)

!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'board.dif'" '(172 characters)'
if test -f 'board.dif'
then
	echo shar: "will not over-write existing file 'board.dif'"
else
cat << \!Funky!Stuff! > 'board.dif'
11a11,15
> #ifdef MSDOS
> typedef char bool;
> #include <stdlib.h>
> #endif
70a70,73
> #ifdef MSDOS
> 		j = rand() % (i + 1);
> #else
74a74
> #endif				
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'dict.dif'" '(274 characters)'
if test -f 'dict.dif'
then
	echo shar: "will not over-write existing file 'dict.dif'"
else
cat << \!Funky!Stuff! > 'dict.dif'
11a11,14
> #ifdef MSDOS
> typedef char bool;
> #endif
20a20,23
> #ifdef MSDOS
> static dict_t far *dictionary;
> #else
24a24
> #endif
41a41,44
> #ifdef MSDOS
> 	dictionary = (dict_t far *) util_farmalloc(sizeof (dict_t));
> #else	
45a45
> #endif	
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'move.dif'" '(61 characters)'
if test -f 'move.dif'
then
	echo shar: "will not over-write existing file 'move.dif'"
else
cat << \!Funky!Stuff! > 'move.dif'
11a11,14
> #ifdef MSDOS
> typedef char bool;
> #endif
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'player.dif'" '(61 characters)'
if test -f 'player.dif'
then
	echo shar: "will not over-write existing file 'player.dif'"
else
cat << \!Funky!Stuff! > 'player.dif'
11a11,14
> #ifdef MSDOS
> typedef char bool;
> #endif
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'plural.dif'" '(79 characters)'
if test -f 'plural.dif'
then
	echo shar: "will not over-write existing file 'plural.dif'"
else
cat << \!Funky!Stuff! > 'plural.dif'
13a13,16
> #ifdef MSDOS
> #include <string.h>
> #else
17a17
> #endif
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'savegame.dif'" '(61 characters)'
if test -f 'savegame.dif'
then
	echo shar: "will not over-write existing file 'savegame.dif'"
else
cat << \!Funky!Stuff! > 'savegame.dif'
11a11,14
> #ifdef MSDOS
> typedef char bool;
> #endif
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'scrabble.dif'" '(323 characters)'
if test -f 'scrabble.dif'
then
	echo shar: "will not over-write existing file 'scrabble.dif'"
else
cat << \!Funky!Stuff! > 'scrabble.dif'
11a11,15
> #ifdef MSDOS
> typedef char bool;
> #include <stdlib.h>
> #endif
26a26,29
> #ifdef MSDOS
> static char *dictfile = "dictionary";
> #else
30a30
> #endif
51a51,54
> #ifdef MSDOS
> 	srand((unsigned int) time(0));
> #else
55a55
> #endif		
130a130
> #ifndef MSDOS
132a132
> #endif	
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'scrabblh.dif'" '(82 characters)'
if test -f 'scrabblh.dif'
then
	echo shar: "will not over-write existing file 'scrabblh.dif'"
else
cat << \!Funky!Stuff! > 'scrabblh.dif'
28a28,31
> #ifdef MSDOS
> #define HASH_SIZE	1003
> #else
32a32
> #endif
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'tty.dif'" '(100 characters)'
if test -f 'tty.dif'
then
	echo shar: "will not over-write existing file 'tty.dif'"
else
cat << \!Funky!Stuff! > 'tty.dif'
11a11,15
> #ifdef MSDOS
> #include <curses.h>
> #include "scrabble.h"
> #else
18a18
> #endif
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'user.dif'" '(61 characters)'
if test -f 'user.dif'
then
	echo shar: "will not over-write existing file 'user.dif'"
else
cat << \!Funky!Stuff! > 'user.dif'
13a13,16
> #ifdef MSDOS
> typedef char bool;
> #endif
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'utilh.dif'" '(315 characters)'
if test -f 'utilh.dif'
then
	echo shar: "will not over-write existing file 'utilh.dif'"
else
cat << \!Funky!Stuff! > 'utilh.dif'
9c9,10
< #define UNIX
---
> /* #define UNIX */
> #define MSDOS
42a44
> #ifdef UNIX
44a46
> #endif
75a77,80
> #ifdef MSDOS
> extern char far *util_farmalloc();
> #endif
80a82
> #ifdef UNIX
82a84
> #endif
91a93
> #ifdef UNIX
94a96
> #endif
98a100
> #ifdef UNIX
100a102
> #endif
!Funky!Stuff!
fi  # end of overwriting check
exit 0
#	End of shell archive
--
Erik Talvola               | "It's just what we need... a colossal negative 
talvola@cory.berkeley.edu  | space wedgie of great power coming right at us
..!ucbvax!cory!talvola    | at warp speed." -- Star Drek

swh@hpsmtc1.HP.COM (Steve Harrold) (04/11/89)

Re: Scrabble for MSDOS

Unhappily, the newly posted "diffs" for porting the recent "scrabble"
to MSDOS are defective.  The "patch" utility doesn't like them.  Here's
an example of one of the ".dif" files that were supplied.

The "move.dif" file contains exactly 4 lines:

	11a11,14
	> #ifdef MSDOS
	> typedef char bool;
	> #endif

As I understand the "diff" output that this is supposed to represent, it
says that FOUR lines (numbered 11, 12, 13, 14) are to be added AFTER the
the original line 11.  BUT only THREE additional lines are provided.
Furthermore, an additional line cannot be the same line number as the 
original line number.  Perhaps the "11a11,14" string should really be
"11a12,14"?

This error is simple enough to fix manually in this file, but other ".dif"
files are not so easy, as they contain combinations of changes and deletions.

Could the original poster of these "diffs" please mend the files so that we
can all enjoy the benefits of your labors?

Thanks,
--
---------------------
Steve Harrold			swh@hpsmtc1.hp.com
				...hplabs!hpsmtc1!swh
				HPG200/11
				(408) 447-5580
---------------------