Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 150 151 [152] 153 154 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 902505 times)

GalenEvil

  • Bay Watcher
    • View Profile
    • Mac-Man Games
Re: if self.isCoder(): post() #Programming Thread
« Reply #2265 on: April 22, 2012, 03:14:15 am »

I feel very very stupid now... I seem to have missed the Rdiff - Threshold = 0 part of your post :( and that equation looks pretty awesome. I would pressume that T = the Threshold for the problem being found? Does it work for varying radii and threshold values? I am gonna plug that into my program tomorrow and probably feel stupid again lol. Would you be willing to send a pm to me of your work from start to finish when working through the problem so that I can add that to my database of knowledge plz?
Logged
Fun is Fun......Done is Done... or is that Done is !!FUN!!?
Quote from: Mr Frog
Digging's a lot like surgery, see -- you grab the sharp thing and then drive the sharp end of the sharp thing in as hard as you can and then stuff goes flying and then stuff falls out and then there's a big hole and you're done. I kinda wish there was more screaming, but rocks don't hurt so I guess it can't be helped.

Aptus

  • Bay Watcher
  • Indeed ôo
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2266 on: April 22, 2012, 05:44:05 am »

backing up


You can always try GIT, I'm not a big fan of it myself since I find it too easy to screw projects up by a couple misstypes. Other than that there's for example Mercurial.
Logged

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2267 on: April 22, 2012, 07:22:28 am »

backing up


You can always try GIT, I'm not a big fan of it myself since I find it too easy to screw projects up by a couple misstypes. Other than that there's for example Mercurial.
You'll have that with any similar software. The best way to avoid screwing up, if you're paranoid, is to use a frontend, such as git-cola for Git or TortoiseSVN for SVN.
« Last Edit: April 22, 2012, 07:34:41 am by Virex »
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2268 on: April 22, 2012, 09:54:31 am »

R(0) = Initial Area
R(1) = sqrt(2A(0) / pi)
R(2) = sqrt(3A(0) / pi)
...
R(n) = sqrt((n-1)A(0) / pi)

And the differences in Radius are calculated simply using the latest R value, let's say R(n), against the previous R value, R(n-1):

Rdiff = R(n) - R(n-1) = [sqrt((n-1)A(0)/pi)] - [sqrt((n-2)A(0)/pi)]

Slight issue with your maths. The radii should be:

Code: [Select]
R(0) = Initial Area
R(1) = sqrt(2A(0))/pi
R(2) = sqrt(3A(0))/pi
...
R(n) = sqrt((n-1)A(0))/pi

Rdiff = R(n) - R(n-1) = [sqrt((n-1)A(0))]/pi - [sqrt((n-2)A(0))]/pi

Or, alternatively,

Rdiff = [sqrt((n-1)A(0)) - sqrt((n-2)A(0))]/pi

A = r*r*pi, so r = sqrt(A)/pi, not sqrt(A/pi).

AlStar

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2269 on: April 22, 2012, 06:04:53 pm »

Thanks in part to the help in the (for dummies) thread, I've now got a generic fantasy dude creator up and running!

Spoiler (click to show/hide)

Next up - getting them to wander around my generic fantasy realm, doing heroic things.

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2270 on: April 22, 2012, 06:10:20 pm »

I'm having a bit of trouble with a do-while loop. I'm working on a text-based adventure game to practice some stuff I learn in class.
Spoiler (click to show/hide)
There will obviously be code for the rest of the commands, but typing help doesn't show anything and typing quit will not exit the loop. What am I missing?
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

fergus

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2271 on: April 22, 2012, 06:18:38 pm »

You have to use strcmp() to compare the contents of strings, == just tests if the strings are stored in the same location in memory.
Logged
BY THE GODS! THIS QUOTE MADE MY SIG BOX HAVE A SCROLL BAR! HAPPY DAYS INDEED!
BY THE GODS! YOU HAVE TOO MANY SIGS!

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2272 on: April 22, 2012, 06:39:51 pm »

Would strcmp() still be required if I changed the loop and variable to use chars instead?
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

fergus

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2273 on: April 22, 2012, 07:33:16 pm »

You can compare char's with ==, but you won't be able to use scanf(), because whenever it writes a string to a variable, it adds '\0' to the end, so the space taken up by the string is one char longer then the actual string.
Logged
BY THE GODS! THIS QUOTE MADE MY SIG BOX HAVE A SCROLL BAR! HAPPY DAYS INDEED!
BY THE GODS! YOU HAVE TOO MANY SIGS!

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2274 on: April 22, 2012, 07:38:01 pm »

So...what do you use instead of scanf? That's the only thing we've used in class so far.
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2275 on: April 22, 2012, 07:52:41 pm »

A = r*r*pi, so r = sqrt(A)/pi, not sqrt(A/pi).
Not so: if A=r*r*pi, then r*r=A/pi therefore r=sqrt(A/pi).
« Last Edit: April 22, 2012, 09:43:51 pm by RulerOfNothing »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2276 on: April 22, 2012, 08:30:45 pm »

So...what do you use instead of scanf? That's the only thing we've used in class so far.

I use std::cin>> more than anything else.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2277 on: April 22, 2012, 08:59:29 pm »

So...what do you use instead of scanf? That's the only thing we've used in class so far.

I use std::cin>> more than anything else.
I'm getting a 'Error: name followed by '::' must be a class or namespace name' for the std.
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2278 on: April 22, 2012, 09:28:07 pm »

If you are using namespace std the code is just cin >> <<variable>>.

Also don't forget to #include <iostream>.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2279 on: April 22, 2012, 09:36:12 pm »

Eh, still getting errors, though at least the squiggle line under std have disappeared. I'm starting to think I should hold off on this project for a year or so, because it's not being as straightforward as I was hoping :P
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread
Pages: 1 ... 150 151 [152] 153 154 ... 796