
abbiistabbii
25298
429
8

https://github.com/abbiistabbii/pythonscripts/blob/main/metromapmaker.py
Playing around with Turtle has taught me more Python than any other programming tutorial ever has.
Metro map generator on github. I take no responsibility if it accidentally creates a Swastika, it's procedurally generated and random.
aurifex
I think we learned something similar in the 80s in school
TheWojoPL
Nice!
I've been meaning to learn some Python for years... and I just lack the motivation :(
š
nikinnorge
i taught myself python a few years ago to replace statistics programs and microsoft power BI. Never looked back.
CrestoftheStars
NeverConfusedForNaught
It's the memey stabey gal! Learning python too!
cryborg
That's awesome! I don't know how to do that!
ourari
"Python Turtle is a beginner-friendly library that offers an interactive environment for learning and creating graphics. It provides a canvas on which the turtle can move and draw, allowing users to visualize the execution of their code in real time."
jimd1954
geekykeycap
Attaching your learning to something you're passionate about is a great way to advance technically. I'm a former tech lead of 7 years and a current consultant. My biggest advancements in knowledge have all been driven by hobby projects I used languages and frameworks to build which I later used at work.
killernat
your cartesian plane needs some viagra
METROlD
turtledicks
ricbri695
Iirc MIT has some free courses on python. I havenāt taken them so I canāt vouch, but itās MIT so I canāt imagine the quality is badā¦
ProfessorBanesworth
That's a good start. I hesitate to recommend this, but I'd throw that into Claude AI and ask it to clean up the code, then have it explain why it did the things it did. I hesitate because AI absolutely makes mistakes and I don't want you to learn from bad examples, but I offer it up because it can provide more information than I can in this box. There are practices that you'll want to adopt in order to make your code more readable (this will help you in the future, trust) and reusable.
ProfessorBanesworth
Some things like descriptive variable and function names will be critical in helping you understand what the code does/returns by reading a line rather than digging into the func to try to parse what it does. Putting all your constants and global variables (I'd avoid using global variables) up at the top will help with organization and locating them. I'd also recommend adopting the convention of naming all constants WITH_ALL_CAPS so they're immediately identifiable as a constant.
ProfessorBanesworth
Global variables can make life easier, but they can also lead to chaos. I'm not a python dev, so I'm not sure how often globals are used, but in my own development I avoid them like the plague. A good dev may be able to properly coordinate their code and avoid bugs that can be common with globals, but it takes just one team member who doesn't understand the code/timings to mess everything up. Or one brainfart on your own part. Then it becomes a nightmare to track down and fix.
Tarmaccian
I used to teach programming. This is EXACTLY what Iād recommend.
Every student makes their own subtle mistakes that are likely to become bad habits, and frankly thereās never enough teachers to go around.
Sure, AI has problems, but itās good enough to be at ājunior programmerā level⦠and thatās good enough that a ābeginner programmerā can learn from it.
Chronomechanist
I'd counter this by saying no novice should ever use Claude AI, or copilot, or any other form of AI to write or rewrite their code until they have more fully learned how the language works.
They can be a useful tool, but like any advanced tool, they require more than foundational knowledge to apply them correctly.
Tarmaccian
You can just ask it to explain. Thatās one of the best uses for AI LLMs there is.
It is a teacher with expert knowledge in a subject, no time limit, and infinite patience for a studentās needs. You can ask it to explain multiple ways, create analogies, and often even provide references for further learning.
When I used to teach coding, the limiting factor was usually the teacherās ability to communicate their knowledge within the available time. Modern AI drastically reduces that restriction.
ProfessorBanesworth
To anyone downvoting me, know that I'm not belittling or negating what @OP has accomplished; I think it's great that they're learning and this is a good start. I also know that if I were in their place and still learning, I'd appreciate feedback from an experienced dev so that I could better my craft.
cybergeek
i think the downvotes are probably because of the words "I'd throw that into Claude AI" more than anything else.
Hannah1986
As long as you don't end up as Charles Tyson Yerkes, and then have a youtuber moan about you whenever talking about the UERL, but still, good work.
abbiistabbii
Ah, a Jago Hazzard Subscriber.
Hannah1986
The underground was the bane of my life for 3 years when I lived in London, moved back up North, hate the trains, love the lack of insanity here
abbiistabbii
Ah, idk which part of the north you're at but if you need a metro fix, there's always the Metrolink or the Tyne and Wear Metro.
Hannah1986
I grew up with Metrolink so I'm well aware how good it is, just a smidge outside of it's range now (20-30 minute bus)
ArchMagos
Accidental swastika are pretty common in any graphical medium that makes use of straight lines and right angles. Also, this is pretty awesome. Does it have a function to erase blocks and then build new ones in the space to simulate how cities evolve over time?
abbiistabbii
nah, it's pretty simple.
DartTarget13
@OP what ever your local transit agency might offer an API that you could use to generate live bus/train stop info (as a json file) for use, also looking into the use of geopy and tkintermapview libraries for a map GUI and and translating GPS coords into locations (I can provide code and screenshots when I have time).
abbiistabbii
I have been thinking about making a script that plays a train whistle 10 mins before a train arrives at my local station.
littlefoxpounce
What got me to learn python finally was several Minecraft mods that are just too much fun to play with. I've automated so many farms this way, and it's such a delight watching them do what i programmed
n0gal
Huh? Since when can Minecraft integrate python mods? Every mod I've seen for it is in Java, every mod I've written for it (or any game) has been in the game's native language, or straight up hex edits/file-replacements rather than mods that are "loaded", when we made "Halo 2" before it came out by modding Halo 1, it was 100% hex edits. Where can I find info on Minecraft mods written in Python?
littlefoxpounce
There is a mod called Computer Craft, and another one called Computer Craft Tweaked, that one runs on LUA but there is absolutely a way to get it to use python instead. Plus there is another mod called minescript that allows you to control your character using python as well.
CorgiInALilBlackDress
Thank you for this, sweet fox ā¤ļø
littlefoxpounce
:3 you're most welcome! I kinda wanna put together a group of people just for making these scripts together, so if you ever wanna talk programming, let me know!
CorgiInALilBlackDress
š Thanks!! I'm a sloppy hobbyist but when I sharpen up I'd love to!
littlefoxpounce
I know all this because I do use all of them. I love programming a lot and it happens to be one of my biggest hyper focuses. I understand I better than I understand people
KingR3quiem
I love programming too but struggle to focus on it. No idea where to start, tutorials leave me with more questions and I struggle with people on reddit and forums that are rude when questions are asked. And higher education for it costs so much money, self teaching is the only way. You guys are magicians to me.
littlefoxpounce
I would love to help!
PartyLich
Idk what the OP is specifically referring to, but mcpi might be among the relevant things here https://github.com/martinohanlon/mcpi. Aside from minecraft, scripting a game with Lua or a similar language is very common, and modding capabilities are often exposed via those means rather than requiring anything in a game's native language.
n0gal
Aye, I mentioned using approved-extensions to existing mods here: /gallery/UDelLcZ/comment/2469296083
n0gal
(*apart from the meshes and animations, but even when it came to meshes they were edits to existing stuff because of the weird way it validated stuff, for example we made Zanzibar out of the polygons in "The Library" so the game saw it as a "valid" level to load)
CanOnlySayYes
I think dude might be referring to some python scripts that alter the server-side behavior? I donāt know much about this so I might be talking out of my ass, I just remember playing MC with friends on a server they assembled that had all the block drops randomised with a python script.
n0gal
The way Minecraft works, it's both a client and a server. The "server" version is basically just 1/2 of the normal game. The same mod system works on both. On the server-specific side there's unique stuff like bukkit and spigot, but even that's all java. At best I can see a mod written in Java that allows the player to add their own jython or lua code for that sort of thing, but that's adding approved-extensions to an existing mod, not really modding it yourself.