Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 686 687 [688] 689 690 ... 796

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

monkey

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10305 on: January 02, 2017, 04:42:02 pm »

With an unordered list I'd have to potentially search the entire list for the lowest F score ...

You end up iterating the whole array either way, to search for the lowest F, or to make room to add another node.
You could avoid cache misses if you pool the LinkedListNodes, also saves you of creating & destroying nodes all the time.
Logged

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10306 on: January 05, 2017, 03:10:15 am »

How does the Steam in-game overlay work?
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10307 on: January 09, 2017, 12:29:16 am »

It sounds like your problem is to do with Unicode to Ascii conversion. Unicode is 16 bits, Ascii is 8 bits, so any special character will be 2 bytes, or 2 8-bit chars.

Unix traditional "cut" function probably works in Ascii. But filenames are stored in Unicode. So any special characters are being interpreted as two characters when read as Ascii. You need to run a conversion to Ascii before working with the string (and then search/replace anything that could be a problem), or use string functions that explicitly know about Unicode.
« Last Edit: January 09, 2017, 12:47:44 am by Reelya »
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10308 on: January 09, 2017, 12:56:06 am »

Well, the "cut" function in Unix shell dates from 1982, and they almost never change the built-in stuff because of compatibility. Unicode only came into being in 1987.

Unicode's UTF-8 is backwards compatible with Ascii (e.g. all 1 byte Ascii codes are the same in both codes, and the high bit being "on" indicates a multi-byte character), which explains why Ascii string handling on most Unicode strings works "most of the time" until you run into the weird characters.
« Last Edit: January 09, 2017, 01:02:57 am by Reelya »
Logged

Shadowlord

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10309 on: January 09, 2017, 02:51:03 am »

I'd certainly recommend using regular expressions (yes, you can do that in python) in the future.
« Last Edit: January 09, 2017, 02:52:41 am by Shadowlord »
Logged
<Dakkan> There are human laws, and then there are laws of physics. I don't bike in the city because of the second.
Dwarf Fortress Map Archive

Avis-Mergulus

  • Bay Watcher
  • This adorable animal can't work.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10310 on: January 09, 2017, 05:09:43 pm »

Yes, I think the best way would be regular expressions and os.rename(). Something like:

Code: [Select]
for file in filenames:
    os.rename(file, re.sub(file, "—.*$", ""))

If you're using Python 3, you shouldn't have to worry about unicode.
Logged
“See this Payam!” cried the gods, “He deceives us! He cruelly abuses our lustful hearts!”

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10311 on: January 10, 2017, 10:31:41 am »

He didn't say he was trying to rename the files, he just said he was trying to extract the episode number from a video file. The dash is the token that he's using to detect where the episode number starts. Removing that from the filename defeats the purpose.

Avis-Mergulus

  • Bay Watcher
  • This adorable animal can't work.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10312 on: January 11, 2017, 05:57:56 pm »

He didn't say he was trying to rename the files, he just said he was trying to extract the episode number from a video file. The dash is the token that he's using to detect where the episode number starts. Removing that from the filename defeats the purpose.
Ah. Yes, sorry. I just interpreted "cut from the filename" and "kerjigger" wrong. My reading comprehension suffers late at night sometimes.
Then:
Code: [Select]
episode_numbers = [re.search('—(.*?$)', filename).group(1) for filename in filenames]
E: used the nonmagic dash by accident
« Last Edit: January 11, 2017, 06:00:52 pm by Avis-Mergulus »
Logged
“See this Payam!” cried the gods, “He deceives us! He cruelly abuses our lustful hearts!”

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10313 on: January 16, 2017, 03:31:35 pm »

I've been working with some other guy on his project, because fuck it I didn't have any other ideas at the time. I figured a collaborative project would boost my ego credibility and lead to something I could reasonably list as an example of past work, since my Newgrounds games are... not that, to put it nicely.

I've written about every line there is in the project. Now he's working on some other thing that I think is a homework assignment, and hits me up on Skype for answers to really simple problems.

Is this generally what it's like to work with people in a non-corporate setting? I suspect I've been taken in by an "ideas guy". Yeesh.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10314 on: January 16, 2017, 03:42:18 pm »

In my experience, yeah, that's pretty normal.  Most people don't know how much work programming is, and / or don't have the drive to stick with a project to completion.

It's unfortunately also frustratingly common to run into similar issues while in school.  I usually ended up as the guy doing all of the programming whenever we were assigned to group projects, which, as the instructor was sure to point out, is how you'll be expected to work in a corporate environment.

In that case though, it's the fact that a distressingly large percentage of students working on capstone projects in computer science really can't program, more than just being an "idea guy".  Graduate students are the same way, some how.
Logged
Through pain, I find wisdom.

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10315 on: January 16, 2017, 03:59:16 pm »

... What does homework in a computer science course look like? I always assumed some programming is taught along the way. That sounds like being the fire chief and not knowing how to work the hose on the fire truck.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10316 on: January 16, 2017, 05:19:12 pm »

Pretty much.  Or "magical thinking" where people just reuse things taught in class directly without understanding them, sometimes from previous assignments or classes where it isn't remotely relevant to the problem at hand.  "We did this last time, so we have to do it again, right?"

Really though, I think the biggest problem is that most computer science students don't like to program, and as a result don't really learn how.  They learn enough to get by for the class, then forget most of it because they never use it afterward until the next class, at which point they're struggling to catch up and relearn what they have to.

I've always thought that to be a good programmer, you had to have a passion for it that would cause you to want to use it for personal projects and such.  Optional things where your interest in it really drives learning how to do it.
Logged
Through pain, I find wisdom.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10317 on: January 16, 2017, 06:42:18 pm »

Is this generally what it's like to work with people in a non-corporate setting? I suspect I've been taken in by an "ideas guy". Yeesh.

I don't know but it could be worse than the "ideas guy", could be a "manager guy" for want of a better term. An "ideas guy" has the ideas but can't implement them, a "manager guy" will take your ideas, get you to implement them, then take the credit for running the project because he offered to write up the report (although once established, this guy will also delegate the report writing drudgery).
« Last Edit: January 16, 2017, 06:44:36 pm by Reelya »
Logged

jaked122

  • Bay Watcher
  • [PREFSTRING:Lurker tendancies]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10318 on: January 17, 2017, 03:15:20 pm »



... What does homework in a computer science course look like? I always assumed some programming is taught along the way. That sounds like being the fire chief and not knowing how to work the hose on the fire truck.


There's a lot of programming where I took it, first year I took a class called data structures where I implemented a bunch of things from the STL in C++.


There are a bunch of theoretical courses which I didn't do as well in too, like Foundations of computer science (which was mostly discrete math), or the lambda calculus in Programming Languages.


I have no idea how people are capable of making it through both sets of classes without knowing how to program, but I see it a lot.


Though oddly enough, I've wondered if math majors are generally better at it by necessity, as the solutions to many of their problems might not be as easy to find.

Spehss _

  • Bay Watcher
  • full of stars
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10319 on: January 17, 2017, 11:45:28 pm »

I thought I could get some experience looking at more complicated projects by fiddling around with the source code of angband. There were instructions included w/ the source code for setting it up in Visual Studio.

I followed the instructions and get an error when compiling: #error Macro definition of snfprint conflicts with standard library function declaration.

Don't know what to do from here. Does anyone here have any experience with this error? Or tips on alternate IDEs for messing with a program written in C?
Logged
Steam ID: Spehss Cat
Turns out you can seriously not notice how deep into this shit you went until you get out.
Pages: 1 ... 686 687 [688] 689 690 ... 796