Share your repls and programming experiences

← Back to all posts
Mandelbrot Set, Enhanced.
LizFoster (647)

Hello all! I have been working on fixing up my old Mandelbrot Set code over the past few days. I will not list everything I changed (and that is definitely not because I forgot all that I did!), but if you are interested, you can feel free to look at the old code (which I have linked below) and compare it with the new code. Essentially, the major things that I changed help to improve scaling of the resolution, and improve color-picking accuracy. It takes quite a long while to finish rendering, so here's a finished product:

Hope you enjoy this revamp, and any feedback you might have would be greatly appreciated. Thank you!

The old code is here: https://repl.it/@LizFoster/The-Mandelbrot-Set#main.py

Comments
hotnewtop
Codemonkey51 (1029)

Hello, haven't seen you on repl talk in a while. Cool project!

LizFoster (647)

@Codemonkey51 Thank you! Yes, I haven't quite had the opportunity or time due to stuff in real life ^ ^"

Codemonkey51 (1029)

Cool ^_^ @LizFoster how's the Pokémon game going?

LizFoster (647)

@Codemonkey51 I actually just started back up on it. I've switched over to PyGame now, with a lot of help from @AmazingMech2418 (Like, a LOT a lot of help *^ _^)!

Codemonkey51 (1029)

Cool, I thonk pygame might speed up development a lot. Also one question: are you going to make it so you can easily add new Pokémon, so like you can easily implement other Pokémon games (like the different colors (sorry I'm a Pokémon nub)) once ur done? @LizFoster

LizFoster (647)

@Codemonkey51 I think that would be very cool, though you would need to make it so the user provides the new Pokemon's stats, sprite, and all the values surrounding it. Could be a cool little Easter Egg, but might be a bit complicated for a user who doesn't want to go through the trouble of all that..

Codemonkey51 (1029)

I meant make it easy for a programmer (you) to add new characters and maps, and stuff @LizFoster

LizFoster (647)

@Codemonkey51 Oh, I see. Yes, I will eventually.

Codemonkey51 (1029)

Coolio, can't wait to see it when it is done @LizFoster

[deleted]

This is amazing. Excellent job ;)

DynamicSquid (4598)

How's your Pokemon game going?

LizFoster (647)

@DynamicSquid It is on a bit of a standstill at the moment. I need to do some research to find faster ways of rendering objects on the screen, since I am not sure how to get multiple turtles to run simultaneously in the Python with Turtle option. I could probably get something put together for that in the Python IDLE program, but the Python with Turtle on repl.it lacks some modules, several of which might be necessary..

DynamicSquid (4598)

@LizFoster I heard that PyGame was better than Turtle. Have you tried that?

LizFoster (647)

@DynamicSquid I have yet to try PyGame. In truth, I have been stubbornly hoping to find a way to do it using Turtle exclusively, since I quite like Turtle.. It probably would not even look good if I could actually find a way to pull it off, ha ha!

I will look into PyGame at some point, I just have not gotten to it.

AmazingMech2418 (1014)

@LizFoster Probably PyGame would be best. I mean, Turtle has its uses, but game dev isn't usually one...

LizFoster (647)

@AmazingMech2418 Yeah, true. I am not sure what the best way to learn it would be, though, since even when I follow the (limited) tutorials on the tutorial tab, it just pops up with errors..

Also hello ^_^

AmazingMech2418 (1014)

@LizFoster I'm actually working on finding a way to transfer your sprite renderer to PyGame right now! :D

Also, hi!

AmazingMech2418 (1014)

@LizFoster Can you by any chance find a working keyboard input thing for PyGame? I think I have the basic renderer made...

LizFoster (647)

@AmazingMech2418 Oh, wow! Thank you! How have you been? Made any cool codes lately?wwwww

AmazingMech2418 (1014)

@LizFoster Thank you and you're welcome! :D I've been doing pretty well. How about you? Also, I just recently published my third NPM package! :D

LizFoster (647)

@AmazingMech2418 Okay, this seems simple enough:

keys = pygame.key.get_pressed()

if keys[x]:
  do y
if keys[a]:
  do b

I am not sure if this is exactly what you're looking for, but here is where I found this:

https://stackoverflow.com/questions/16044229/how-to-get-keyboard-input-in-pygame

Does that work for the project?

AmazingMech2418 (1014)

@LizFoster For some reason, I keep getting this:

LizFoster (647)

@AmazingMech2418 Looks good! (Why have I not gotten a program to run properly T~T)

What key does [K_q] refer to?

LizFoster (647)

@AmazingMech2418 Nice! I've been doing alright myself, lately I've found a lot more artists to listen to whilst coding or vIbInG, so that's nice. ^1^

AmazingMech2418 (1014)

@LizFoster Actually, I think I got something working...

AmazingMech2418 (1014)

@LizFoster That was the ID for the letter q I think...

LizFoster (647)

@AmazingMech2418 PyGame is complex... >~<

That's odd, since this list shows K_q as valid...

LizFoster (647)

@AmazingMech2418 Yes, sorry, I hadn't seen that list yet..

AmazingMech2418 (1014)

@LizFoster Thank you! And nice! :D And it's fine! I honestly just looked it all up right then and there. LOL! But I did get it all working! https://repl.it/@AmazingMech2418/Learning-PyGame#main.py :D

LizFoster (647)

@AmazingMech2418 How odd, now it says there is an error (Also, I apologize for my absence, I kinda passed out, ha ha!)... '~'7

AmazingMech2418 (1014)

@LizFoster Well, just run it again. The error is an x-server connection thing for the display... (and wait, passed out? Is everything okay?)

LizFoster (647)

@AmazingMech2418 Ah, alright, sounds good. I will try that out, then. (Also, yes, everything is alright. I just did not get much sleep last night, and kind of dozed off. Is "passed out" the wrong term there?)

AmazingMech2418 (1014)

@LizFoster Okay. :D (Okay. Usually, "passed out" refers to something during the daytime where something medical (usually respiratory or circulatory) causes you to lose consciousness, so I was kind of worried something was wrong. It's good that you're okay though! And that is much better than actually passing out!)

LizFoster (647)

@AmazingMech2418 (Oh, oops! LOL)

(I'm glad I'm okay too!)

LizFoster (647)

@AmazingMech2418 Hello! Would it be alright by you if I copied the code over from the "Learning Pygame" code (giving credit and thanks of course) so that I could tinker with it more?

LizFoster (647)

@AmazingMech2418 Yay! Thank you! Seriously, you have been a huge help with this. If it weren't for you I probably would still be stumped on drawing the sprites in turtle !wwwww