Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Supermikhail

Pages: 1 ... 19 20 [21] 22 23 ... 73
301
Uh... how do I declare a constructor with it? As far as I can manage, it doesn't like either Element(std::string ), or Element(std::string &).

302
Creative Projects / Re: An Otherworldly Ark
« on: December 13, 2010, 11:10:49 am »
Unfortunately, due to recent self-inflicted sleep deprivation... the progress towards the ultimate knowledge has been rather slow.

Hey, what do you know, flip a page and it's Cnidaria. Wikipedia says jellyfish are there. However, the section is another hundred pages. :-[

303
Yep. Turns out I don't know how to use string. How do I use it? Can't I have string as a return value? I've looked at a C++ reference, and got no idea.

304
Creative Projects / Re: An Otherworldly Ark
« on: December 13, 2010, 09:35:51 am »
Yeah, the tubes are supposed to eat what the balloon finds unsavoury. And I guess right now this could use some divergence (one creature has no symbionts, one creature suffers from parasites and deals with the problem somehow, one creature has 2 symbionts, and one creature has 3 symbionts, and those are arranged somehow), and 3d visualisation, as I'm having trouble visualising all that in my head, and especially working with visualisations. Unfortunately, it is programming season for me.

And phylogeny trees could be useful, too.

305
Well, er, because I don't know how to use it properly, and my book on C++ mentions it only teasingly... Oh, it's stl::! Does that mean I can using namespace it? So using stl::string really won't be considered an overkill?

306
Creative Projects / Re: Any guitarists/bassists?
« on: December 13, 2010, 09:01:53 am »
That was a joke. :)

Well, not only riffs, unless it fits the tune very well. Or... yeah, Nirvana's riffs are quite short and simple, so the tribute could feature one riff from a song, to not be very repetitive.

You don't know how glad I am! :)

307
Yeah, finally bothered with a sizeof program. short is 2 bytes, int is 4 and long is 8 on my computer.

In other news, segfault has finally caught up with me, what do you know! Now I'm looking for a way to store a string of characters so that I could write it together with the rest of an object to a binary file. If I make it a char array with fixed length, it just doesn't compile, because sometimes it's apparently still just a pointer whatever I do.

For anybody curious or incredulous:
Code: [Select]
#include <iostream>
using namespace std;

class Element
{
public:
Element() {}
~Element() {}

Element(char[], short, double , short[] , short );

void DisplayName() const;
short GetNumber() const { return itsNumber; }
double GetElectronegativity() const { return itsElectronegativity; }
short GetValnumber() const { return itsValnumber; }
void DisplayValencies() const;

void AssignValues(char[], short, double , short[] , short );

private:
char itsName[20];
short itsNumber;
double itsElectronegativity;
short itsValency[7];
short itsValnumber;
};

Element::Element(char name[20], short number, double electronegativity, short valency[7], short valnumber)
{
itsName = name;
itsNumber = number;
itsElectronegativity = electronegativity;
itsValnumber = valnumber;
for(int i=0; i<valnumber; i++)
{
itsValency[i] = valency[i];
}
cout << "*Element constructor called*\n";
}

void Element::DisplayName() const
{
cout << itsName;
}

void Element::AssignValues(char name[20], short number, double electronegativity, short valency[7], short valnumber)
{
itsName = name;
itsNumber = number;
itsElectronegativity = electronegativity;
itsValnumber = valnumber;
for(int i=0; i<valnumber; i++)
{
itsValency[i] = valency[i];
}
cout << "*Values assigned*\n";
}

void Element::DisplayValencies() const
{
for(int i=0; i<itsValnumber; i++)
{
cout << itsValency[i];
if( i==(itsValnumber-1) )
cout << "." << endl;
else
cout << ", ";
}
}

Assign values is a copy of Element constructor, because I've decided to separate the program into reading and writing, and don't want to create two different objects, yet.

308
Creative Projects / Re: An Otherworldly Ark
« on: December 12, 2010, 03:33:23 pm »
Well, they are supposed to clean up the inside of the balloon and release the refuse outside... Er. I can't visualise that myself. Do you think it would work? I actually suspect that having three/two tubes protrude outside of one's mouth doesn't help biting on food.

309
Creative Projects / Re: Burried Houses (AI Programming Project)
« on: December 12, 2010, 02:43:37 pm »
Whoah. Reading the debug text is like learning about quantum physics for the first time!

So I wonder if there is eventually going to be long-term memory, but more importantly if there is priority value for memories based on their emotional importance.

310
Hm. A profiler goes with an IDE? I can't find any for my Geany.

Also, well, I might have found a critical bottleneck (or something) in my very idea. Can somebody tell me if any shenanigans are involved in compiling code written on Linux, on Windows? Especially if it involves SDL.

Also, is there any advantage in using short over integer, even if hypothetical?

311
Your existing code is fine. It gets the job done. It uses standard C++. Don't bother with "optimization" or "efficiency" until you're comfortable with your own code.
Er. I decided to replace most "endl" with "\n" . I guess it's kind of silly, but I suspect it gives me a few milli- (micro?) seconds advantage. ::)

312
It's a book on C++, but I've read a couple of "books" (both of them were pretty short and introductory) on C, and even did a stupid book of exercises.

Actually, streams is the first lesson I did properly. That is, typed out most of the code from the book, because I was curious how it worked out. But it's still kind of scary. Well, maybe because I first got introduced to file operations through Delphi, then I went to C, and I recall file operations were kind of difficult in both of them.

Edit: Hm, that code post is misleading, if you think about it. I waited until after the streams lesson to start my project, because it's going to need that and lessons haven't been going very well (I just can't take as much code in one sitting as this book offers me). File input/output isn't there yet. I'd appreciate it if somebody could point out how I could make the existing code more efficient.

313
Creative Projects / Re: Any guitarists/bassists?
« on: December 12, 2010, 05:17:22 am »
Don't patronise me, please. :'(

 :) Actually, you've been pretty inspirational, and yesterday I laid my hands on a few pieces that I thought I wouldn't ever play.

Also, I'm a bit sleep-deprived, so I wonder, if you did a symphonic tribute to Nirvana what songs you would include, assuming, of course, you like Nirvana.

314
Creative Projects / Re: An Otherworldly Ark
« on: December 12, 2010, 05:04:38 am »
Oh. My bad. When I was drawing the first panel, I intended it to be about evolution. So, the first panel is kind of irrelevant. The tubes don't leave, ever, the only time the balloon goes without a tube is before they are united when they leave their parent.

Well, it's not a face, but they still go outside, and what we have outside, usually, is bilateral.

315
Creative Projects / Re: Bay12 Writers Guild
« on: December 12, 2010, 04:59:20 am »
Oh, were you actually curious? I thought you were just making fun of me, haha. I haven't picked a particular journal yet, but I planned to start with ones that publish experimental fiction, then run through SF publications, and end up with a free online journal. The last is the only one I have any confidence that it'll be accepted for though.
Hm. Correct my Ruslish, please, but didn't you mean "magazine", not "journal"? And I guess I was just curious, as I myself haven't looked into any magazines (journals?) to publish my works in - for some reason I want to start with a novel. Actually, I prefer reading novels to reading short stories, at least when I'm not on the Internet, I guess that's a reason.

Yeah, the problem was that I wasn't all that interested in Urist, and I involved him in the story way too much. It's not so much about him as it is Irongates, and to an extent the artifact.
Yeah, should have omitted Urist then. The name gives him quite a bit of importance.

Pages: 1 ... 19 20 [21] 22 23 ... 73