Help - Search - Members - Calendar
Full Version: C++ Host Generator (using rules in SR3 and Matrix)
Dumpshock Forums > Discussion > Community Projects
Dashifen
Hello All!

Over the last two days, I've been coding a host generator program using the rules in SR3 and Matrix. I've gotten it running fine on WinXP Pro and I was wondering if I could get some others to test it on other platforms.

I have a windows executable built so if you have a Win95/98/ME/2000 machine I can email you the executable and you can test it a few times. It runs in a "dos" window because I haven't built a graphical-user interface for it yet (and I may not) so it's back to the good old days of command line prompts!

If you have a Linux/UNIX box, I'd really like you to drop me a line and I'll send you the source code. Then if you could run it through compilers like g++ and/or gcc and let me know the success or failure of the system, that'd be great.

And lastly, does anyone have a compiler for C++ on a Mac? I don't think I've ever met someone with one -- though I guess since OSX is based on BSD Unix, then perhaps newer Macs can take part in the glory .... okay, so I'm tooting my own horn with that one grinbig.gif

_________

Here's a run down of the program: you enter the color of the host (blue, green, orange, red) and then the difficulty (easy, average, hard). Then you enter the name for the host (becomes the file name). After that, you're done. The program generates a security sheaf for the host and writes an HTML file that I've tested in IE6. The bonus of the HTML is that I put links to pages that you could fill with notes from the books about each type of IC and the alert statuses. I'm not including such pages with my program because I'm not sure if it would infringe on copyrights or not.

So, for example, if a Probe IC is generated for trigger step 14, then you could click on the name Probe and it would load the page probe.htm which you could create to contain information about the Probe IC and what it does. Good for beginning GM (like me) who need the notes and need them fast! The files that you would have to produce on your own would be: probe.htm, trace.htm, tbaby.htm, killer.htm, scout.htm, crippler.htm, tpit.htm, ripper.htm, blaster.htm, sparky.htm, psycho.htm, lethal.htm, nlethal.htm, cerebro.htm, passive.htm, active.htm, shutdown.htm, and construct.htm. psycho.htm refers to Psychotropic Black IC and cerebro.htm would refer to Cerebropathic Black IC.

The house rules in the program deal with the way constructs are made. The rules in the text say that you place at least two kinds of IC within the construct no matter what (or at least thats how I read them) and alter the IC ratings to fit the frame core. My program will be sure that the IC ratings within the construct do not get bigger than the frame core of the construct. It does this by decrementing the IC ratings as necessary. Not exactly random anymore, but it helps to keep constructs under control. Plus, it was the only way that I could get it to generate the constructs. Because of the way the algorithm worked in the computer, you could get a construct that has only one type of IC in it, which seems dumb, but you do still get the targetting option that all constructs get that IC doesn't. I thought it was a fair trade off.

If you want the source code, let me know. It's not the best piece of commented work I've done, but maybe I'll get some more in there to help it become more understandable.

If you're interested in helping me test this program on other platforms or want the source code, let me know by sending me a PM through the boards. I check them often enough that I'll see your message quickly.

Edit: Added file names for the html files.
Grey
I'll give it a shot for you on my Win2k systems.

Email: metis76@yahoo.com
Matrix Monkey
send the code my way, I'll give it a run on my linux boxes smile.gif

sam@crashdot.be
Connor
You can toss the code my way as well. I can see what happens with a compile under FreeBSD.

I can also see what the excutable does on some friends machines that aren't up to XP yet.

connor@dicebag.com
Sigfried McWild
I have a mac. If you send me the code I can try both Linux and OS X compiles.
Grey
I never got it...
KosherPickle
QUOTE (Dashifen)

Over the last two days, I've been coding a host generator program using the rules in SR3 and Matrix.  I've gotten it running fine on WinXP Pro and I was wondering if I could get some others to test it on other platforms. 

I have a windows executable built so if you have a Win95/98/ME/2000 machine I can email you the executable and you can test it a few times.  It runs in a "dos" window because I haven't built a graphical-user interface for it yet (and I may not) so it's back to the good old days of command line prompts!


If you send it to me, fuchsiawonder@yahoo.com, I'll check it out on Win ME and 98.
Matrix Monkey
no output, I tried changing the header includes like so:
[brackesa@cerberus brackesa]$ head matrix.cpp
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

but this still doesn't work, see below:

[brackesa@cerberus brackesa]$ gcc -save-temps -time matrix.cpp
# cpp0 0.08 0.00
matrix.cpp:57: 'ofstream' is used as a type, but is not defined as a type.
matrix.cpp:94: `main' must return `int'
matrix.cpp: In function `int main(...)':
matrix.cpp:107: `out' undeclared (first use this function)
matrix.cpp:107: (Each undeclared identifier is reported only once for each
function it appears in.)
matrix.cpp:149: `endl' undeclared (first use this function)
matrix.cpp: In function `void GetHostType()':
matrix.cpp:162: `cout' undeclared (first use this function)
matrix.cpp:165: `cin' undeclared (first use this function)
matrix.cpp: In function `void DumpHost()':
matrix.cpp:248: `cerr' undeclared (first use this function)
# cc1plus 0.48 0.04
Matrix Monkey
Looks like I got it running after hacking the code a little bit:

[brackesa@cerberus brackesa]$ diff Matrix.cpp matrixorig.cpp
2d1
< #include <iostream.h>
4c3
< #include <unistd.h>
---
> #include <afx.h>
95c94
< int main() {
---
> void main() {




[brackesa@cerberus brackesa]$ ./a.out
Please enter the type of host:
1. Blue Host
2. Green Host
3. Orange Host
4. Red Host
Host Color: 1

Please enter the difficulty of the host:
1. Easy
2. Average
3. Hard
Host Difficulty: 1

Enter the name of the host. Use the underscore (_) instead of spaces.
Host Name: Test


[brackesa@cerberus brackesa]$ g++ -dumpversion
3.2.2
[brackesa@cerberus brackesa]$ g++ -dumpmachine
i386-redhat-linux

This was on a Redhat 9.0 system, I'll try and compile it on a few other test machines (slackware, solaris etc.)
Matrix Monkey
I'm getting a crapload of errors on the following system (Debian 3.0):
Linux birkoff 2.4.22-grsec #6 SMP Fri Sep 12 12:45:22 CEST 2003 i686 GNU/Linux
([...] signifies repeated error)


/tmp/ccA0R37b.o(.text+0x8a): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
[...]
/tmp/ccA0R37b.o(.text+0x290): In function `GetHostType()':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
[...]
/tmp/ccA0R37b.o(.text+0x55d): In function `DumpHost()':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
[...]
/tmp/ccA0R37b.o(.text+0xdf6): In function `DumpReactiveWhite(bool)':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
[...]
/tmp/ccA0R37b.o(.text+0xed9): more undefined references to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' follow
/tmp/ccA0R37b.o(.text+0x13fe): In function `DumpICRating()':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
[...]
/tmp/ccA0R37b.o(.text+0x15aa): In function `DumpPsychotropic()':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
[...]
/tmp/ccA0R37b.o(.text+0x15ec): more undefined references to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' follow
/tmp/ccA0R37b.o(.text+0x1742): In function `DumpConstruct()':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
[...]
/tmp/ccA0R37b.o(.text+0x1a37): In function `GeneratePayData()':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
[...]
/tmp/ccA0R37b.o(.text+0x1bbc): more undefined references to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' follow
/tmp/ccA0R37b.o(.text+0x1bee): In function `GeneratePayData()':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
[...]
/tmp/ccA0R37b.o(.text+0x1e37): In function `DumpWorm()':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
[...]
/tmp/ccA0R37b.o(.text+0x1f57): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccA0R37b.o(.text+0x1f8e): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::basic_ofstream[in-charge]()'
/tmp/ccA0R37b.o(.text+0x1fbe): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccA0R37b.o(.text+0x1fd2): In function `__tcf_1':
: undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::~basic_ofstream [in-charge]()'
/tmp/ccA0R37b.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

Probably due to a lack of installed libraries

UPDATE: got rid of a bunch of errors after linking iostream.h to iostream, fstream.h to fstream
Dashifen
QUOTE (Matrix Monkey @ Sep 25 2003, 04:24 AM)
no output, I tried changing the header includes like so:
[brackesa@cerberus brackesa]$ head matrix.cpp
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

but this still doesn't work, see below:

[brackesa@cerberus brackesa]$ gcc -save-temps -time matrix.cpp
# cpp0 0.08 0.00
matrix.cpp:57: 'ofstream' is used as a type, but is not defined as a type.
matrix.cpp:94: `main' must return `int'
matrix.cpp: In function `int main(...)':
matrix.cpp:107: `out' undeclared (first use this function)
matrix.cpp:107: (Each undeclared identifier is reported only once for each
  function it appears in.)
matrix.cpp:149: `endl' undeclared (first use this function)
matrix.cpp: In function `void GetHostType()':
matrix.cpp:162: `cout' undeclared (first use this function)
matrix.cpp:165: `cin' undeclared (first use this function)
matrix.cpp: In function `void DumpHost()':
matrix.cpp:248: `cerr' undeclared (first use this function)
# cc1plus 0.48 0.04

that looks like you tried to compile with a C compiler but I coded in C++. That would explain why fstream.h wouldn't include and why it wants the main() function to return an int. I'm not sure what happened on the Debian box, but it looks like you're on the right track with the i/o libraries. Perhaps it's time to set up a few linux boxes of my own to run some tests .... ork.gif

-- Dash --
Matrix Monkey
QUOTE (Dashifen)
that looks like you tried to compile with a C compiler but I coded in C++. That would explain why fstream.h wouldn't include and why it wants the main() function to return an int. I'm not sure what happened on the Debian box, but it looks like you're on the right track with the i/o libraries. Perhaps it's time to set up a few linux boxes of my own to run some tests .... ork.gif

-- Dash --

Nope, gcc by default passes .cpp files off to g++ if you don't explicitly state otherwise. (Furthermore, I tried using g++ at first but it gave the same errors)

I'll look into the debian box's library issues tomorrow, it could be related to the gcc version I'm using there also (differs from the redhat box)
Sigfried McWild
I compiled it fine in linux.
Just had to change afx.h (or something like that) to iostream.h
Bigity
Is this still available?
JuanGolbez
Can we still get this, or has it been tossed in the bitbucket? I'm interested!
Dashifen
sure, pm me with your email address and I can mail it to you. Do you want to source code or a compiled windows executable?
Connor
You know, seeing this thread again reminded me of how I had the same problems Matrix Monkey had above, but I couldn't quite figure out what he did to fix it. I'm not much of a C++ coder. I'd love to get the code compiled however so if anyone reading this can help out in that regard I'd appreciate it.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Dumpshock Forums © 2001-2012