r/programminghelp • • Apr 10 '16

Python, attempting to figure out why my code always rounds down instead of just using the given value.

I'm sorry for including all of the code instead of any tiny relevant bits, but that's probably actually useful. When you run the program and insert the variables, ARMROTS always is rounded down to the nearest whole number.

http://pastebin.com/33XhsvHX

4 Upvotes

23 comments sorted by

View all comments

Show parent comments

1

u/TangleF23 Apr 10 '16

Okay. Virtualenv is incredibly confusing, and I have no idea how to use it at all, especially because I can't open it in the command line. I think the only thing I can actually manage is editing it through brackets. Currently working on updating the Ring, Lenticular, Elliptical, and Irregular code to work the same way as the Spiral generation.

0

u/[deleted] Apr 10 '16

[deleted]

1

u/TangleF23 Apr 10 '16 edited Apr 11 '16

I put it up on github, just because. Also probably makes it easier to handle. Currently, none of the files are functional and I think this is because of filename thingies.

https://github.com/Tangle10/Python-Galaxy-Generator

Edit: Nope, still nonfunctional.

1

u/TangleF23 Apr 11 '16

...Welp, at the moment it is not producing output. :/

I tried fixing it by removing the random filename, but nope. Still nonfunctional. Is there anything like virtualenv that is intuitive to run?

Unless you'd like to try your hand at it, in which case it is in fact on github. For reasons.

0

u/[deleted] Apr 11 '16

[deleted]

1

u/TangleF23 Apr 11 '16

http://imgur.com/fbs0LR1 is what the error seems to be. It happened with my older versions too, so is Python not recognizing PIL for some stupid reason?

0

u/[deleted] Apr 11 '16

[deleted]

1

u/TangleF23 Apr 11 '16 edited Apr 11 '16

Okay, trying that...

PIL uninstalled, Pillow apparently already there. Trying it out...

The exact same "the _imaging C module is not installed" error.

EDIT: python -m pip install --upgrade pillow worked!

Okay, next question: How would I make it also create a .txt that contains the values used to create the galaxy? I know how to do the filename for it, but not how to insert text.

0

u/[deleted] Apr 11 '16

[deleted]

1

u/TangleF23 Apr 11 '16 edited Apr 11 '16

Whoa, that's amazing! As of now: Spiral one works, all others do not. Updated on github.

Maybe give each star a given velocity, based on position? Might be hard though.

The only problem is that each star as it moves can look like multiple...

Oh, also: In the original, the largest I ever managed (actually, tried for) was 60 million stars in a 12000x12000. I just tried that one again and it stopped working after 2 or 3 minutes.

But for now, I have a beautiful "Spyglass Galaxy": http://imgur.com/FEaQTWd

1

u/TangleF23 Apr 11 '16 edited Apr 11 '16

Galaxy .txt system entirely functional, and I only needed to find one thing on stackoverflow to figure it out! Only problem is, it doesn't go to a new line, but hey that's because it's a .txt and I didn't hand-format it.

Currently figuring out how to make the galaxy have a name that isn't a number and yet still have it default to 0- any suggestions? I know it can't be float, int, or string followed by (raw_input("blahblah") or "0"

Edit: Okay, so I've decided that you gotta put in a name. Whatever. Works like a charm now, except of course the non-line-break .txts.

1

u/TangleF23 Apr 11 '16

Okay, so currently: Ring and Spiral scripts fully functional on github; Elliptical, Lenticular, and Irregular are not. They're all uploaded to github though.

0

u/[deleted] Apr 11 '16

[deleted]

→ More replies (0)