connect4 stable port information

Package: connect4
Version: 1.2
Revision: 1011
Patch: %n.patch
Source: http://members.tripod.com/boneheadproductions/%n/dl/%nv%v.tar.gz
Source-MD5: c6260a22aa1807f243eb43941cd8a0c1
GCC: 4.0
CompileScript: <<
c++ *.cpp -O2 -ffast-math -fforce-addr -fomit-frame-pointer -finline-functions -o %n
tail -n 2 README.txt >> LICENSE
<<
InstallScript: <<
mkdir -p %i/bin/
install -s %n %i/bin/
<<
DocFiles: README.txt LICENSE
Description: Text-based Connect Four game
DescDetail: <<
An exploration into artificial intelligence.

There are many computer players. Each uses slightly different
heuristics. When you set the computer's level you are essentially
telling it how many moves to look ahead in the beginning (it looks ahead
further as the game progresses). You can play human vs. human, human vs.
computer, or computer vs. computer. When the computer fights itself you
can set a different level and heuristic for each player.

The AI can be quite good, making it difficult to win if you do not
make good moves in the early game.
<<
DescPort: <<
Note: iostream I/O seems to be a move behind in Jaguar.
<<
License: GPL
Maintainer: Ben Hines
Homepage: http://members.tripod.com/boneheadproductions/connect4/

connect4 stable port .patch

--- connect4v1.1/bd_string.cpp 2002-09-27 19:20:25.000000000 -0700
+++ connect4v1.1/bd_string.cpp 2002-09-27 19:20:53.000000000 -0700
@@ -4,6 +4,37 @@
#include

#include "bd_string.h"
+// myGetline:
+// The gcc 3.1 version of the 'getline' function has a bug - it requires
+// two delimiters (e.g. newlines) before it accepts the input
+// See gcc problem report # 6648
+// The 'myGetline' function provides a replacement for 'getline'
+// Sample use: char name[100]; myGetline(cin, name, 100);
+
+std::istream& myGetline(std::istream& in, char* buffer, std::streamsize n, char delim =
+'\n')
+{
+ if (in.peek() == delim)
+ {
+ // the gcc 3.1 version of the 'get' function fails if there
+ // are no characters before the delimiter (e.g. an empty line).
+ // This would seem to be a bug but the discussion on gcc problem
+ // report # 4419 says that this behaviour accords with the standard.
+
+ buffer[0] = '\0';
+ }
+ else
+ {
+ in.get(buffer, n, delim);
+ }
+
+ if (in.good() && strlen(buffer) < n - 1)
+ {
+ // eat the delimiter
+ in.ignore(1);
+ }
+ return in;
+}

String::String()
{
@@ -410,7 +441,7 @@

temp=new char[maxChar];

- inputStream.getline(temp, maxChar);
+ myGetline(inputStream, temp, maxChar);
*this=temp;

delete [] temp;

connect4 _unstable_ port information

Package: connect4
Version: 1.2
Revision: 1011
Patch: %n.patch
Source: http://members.tripod.com/boneheadproductions/%n/dl/%nv%v.tar.gz
Source-MD5: c6260a22aa1807f243eb43941cd8a0c1
GCC: 4.0
CompileScript: <<
c++ *.cpp -O2 -ffast-math -fforce-addr -fomit-frame-pointer -finline-functions -o %n
tail -n 2 README.txt >> LICENSE
<<
InstallScript: <<
mkdir -p %i/bin/
install -s %n %i/bin/
<<
DocFiles: README.txt LICENSE
Description: Text-based Connect Four game
DescDetail: <<
An exploration into artificial intelligence.

There are many computer players. Each uses slightly different
heuristics. When you set the computer's level you are essentially
telling it how many moves to look ahead in the beginning (it looks ahead
further as the game progresses). You can play human vs. human, human vs.
computer, or computer vs. computer. When the computer fights itself you
can set a different level and heuristic for each player.

The AI can be quite good, making it difficult to win if you do not
make good moves in the early game.
<<
DescPort: <<
Note: iostream I/O seems to be a move behind in Jaguar.
<<
License: GPL
Maintainer: Ben Hines
Homepage: http://members.tripod.com/boneheadproductions/connect4/

connect4 _unstable_ port .patch

--- connect4v1.1/bd_string.cpp 2002-09-27 19:20:25.000000000 -0700
+++ connect4v1.1/bd_string.cpp 2002-09-27 19:20:53.000000000 -0700
@@ -4,6 +4,37 @@
#include

#include "bd_string.h"
+// myGetline:
+// The gcc 3.1 version of the 'getline' function has a bug - it requires
+// two delimiters (e.g. newlines) before it accepts the input
+// See gcc problem report # 6648
+// The 'myGetline' function provides a replacement for 'getline'
+// Sample use: char name[100]; myGetline(cin, name, 100);
+
+std::istream& myGetline(std::istream& in, char* buffer, std::streamsize n, char delim =
+'\n')
+{
+ if (in.peek() == delim)
+ {
+ // the gcc 3.1 version of the 'get' function fails if there
+ // are no characters before the delimiter (e.g. an empty line).
+ // This would seem to be a bug but the discussion on gcc problem
+ // report # 4419 says that this behaviour accords with the standard.
+
+ buffer[0] = '\0';
+ }
+ else
+ {
+ in.get(buffer, n, delim);
+ }
+
+ if (in.good() && strlen(buffer) < n - 1)
+ {
+ // eat the delimiter
+ in.ignore(1);
+ }
+ return in;
+}

String::String()
{
@@ -410,7 +441,7 @@

temp=new char[maxChar];

- inputStream.getline(temp, maxChar);
+ myGetline(inputStream, temp, maxChar);
*this=temp;

delete [] temp;