Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 428 429 [430] 431 432 ... 796

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

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #6435 on: October 04, 2014, 02:12:30 am »

Logged

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #6436 on: October 04, 2014, 02:30:22 am »

Spoiler (click to show/hide)
I know the purpose of this thread is to help and encourage, but that should win a medal. For something.
That's being mean.

Gunin basically implemented a manual hardcoded key-value lookup table or an array using if/elses, which is a pretty logical way to handle things if you don't know that dicts exist.
yeah...

I'm sorry, GUNIN.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #6437 on: October 04, 2014, 02:35:31 am »

Is otay. :3
Logged

gigaraptor487

  • Bay Watcher
  • Escaped Lunatic now civilised
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6438 on: October 05, 2014, 10:15:58 am »

Are there any good 2d graphical libraries for C that don't use camelcase? I am beginning to have thought of moving on from NCurses to something more complex.
Logged
Hehe, you thought there would be an interesting sig here

I now run a program which brings old multiplayer games back to life : click

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6439 on: October 05, 2014, 10:40:48 am »

Allegro uses underscore_case, and is a pretty good library.
Logged

vagel7

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6440 on: October 05, 2014, 11:11:35 am »

Say that I have a file with words in a list and my program must guess a word. How can I narrow the list down each time without deleting entries from the file? Or is the only way possible by creating a temporary file with the exact same contents and from there delete words with the help of different criteria?

Say I want to narrow it down from length and I want to decrease the amount of viable words from the search. I remove the shorter and longer words. But how do I do that?
Logged
That last gobbo would stand there, missing an arm, punctured in a kidney, liver, and spleen, fading in and out of consciousness at the far end of where the drawbridge would go, and his last sight would be the drawbridge dropping down and smashing him like a bug.

God DAMN I love this game!

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6441 on: October 05, 2014, 11:22:39 am »

How big is the list? Can't you copy the list of words to an array and use that?
Logged

vagel7

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6442 on: October 05, 2014, 11:25:01 am »

How big is the list? Can't you copy the list of words to an array and use that?

Pretty much the entire dictionary.

EDIT: Well I solved this little problem by creating a temporary file in which I only copied the words which had the exact same length. But is there a way to do this without making a temporary file?
« Last Edit: October 05, 2014, 01:34:08 pm by vagel7 »
Logged
That last gobbo would stand there, missing an arm, punctured in a kidney, liver, and spleen, fading in and out of consciousness at the far end of where the drawbridge would go, and his last sight would be the drawbridge dropping down and smashing him like a bug.

God DAMN I love this game!

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6443 on: October 05, 2014, 12:28:07 pm »

No seriously, copy the words to an array, it's much faster than reading them all from disk every cycle. No actually use two vectors. Store all your words (by reference) in the first vector. When you have a new criterion, just fill the second vector with the matching words from the first vector, clear the first, then swap them. Repeat per criterion. This should be the fastest method, after all it's only the entire dictionary.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #6444 on: October 05, 2014, 04:40:36 pm »

You can even reserve a certain size if you're using C++ to decrease vector allocation time. Precount the number of words per word size and retrieve values!
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

frostshotgg

  • Bay Watcher
  • It was a ruse
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6445 on: October 08, 2014, 09:24:27 pm »

This is only sorta programming, but is there a way to have a fork of something on github on the same account as the master? We want to have two versions of the code, one controlled by a joystick and one by a controller, but it seems like the only option is to just have it in the same branch and have some weird toggling going on.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6446 on: October 08, 2014, 09:26:30 pm »

Uh... branch it. You don't have to respect the master that much.

frostshotgg

  • Bay Watcher
  • It was a ruse
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6447 on: October 08, 2014, 09:34:10 pm »

With branches, when you push to them, won't they go back to the master? Eg, if joystick was master and then I made some changes to it then pushed to controller, wouldn't it replace the controller code with joystick code?
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6448 on: October 08, 2014, 09:41:25 pm »

Not unless you changed joystick code.

GiglameshDespair

  • Bay Watcher
  • Beware! Once I have posted, your thread is doomed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6449 on: October 09, 2014, 09:20:12 am »

PTW.
Logged
Old and cringe account. Disregard.
Pages: 1 ... 428 429 [430] 431 432 ... 796