I wrote some Python3 code that will generate a random ST devotional deck for you

gerald witcher3 gwent

Hi, so I recently watched a couple Fuschia Briefs video where he spends 20 minutes randomly generating decks and I wondered if it could be possible to do this with python code.

I am a student in university and I have a summer class coming up where I'll be asked to write code that does a lot of array manipulation. My coding skills are not great so I picked this task as a way to sharpen what little skills I have just a bit. I'm sure more advanced coders will see my code and cringe because it is very amateurish. But it works and Ive tested in in online python compilers to make sure its not just working on my machine.

It's not commented and there's some unused variables. Apologies. I'm not sure if sharing this kind of code goes against any rules? It's certainly not malicious, it's just doing some basic for loops, array manipulation (for the deck and cardpool) and random integer generation.

You will have a ST leader ability and stratagem randomly assigned to you as well. All decks are pretty much devotional only because it's a very time consuming process to type all the card names out. This is mostly a proof of concept, I welcome anyone else to build on it and make something that includes neutral cards or other factions.

If this goes against any reddit rules I apologize.

My (original) code:

https://pastebin.com/METKL8iA

edit:

I have updated the code to now include neutral units. No longer devotional! Still we are only limited to ST. Here you go. I accidentally left in some debug print function and its possible I might have coded a unit as a special or a special as a unit somewhere at some point. An impossible to build deck might possibly be generated but Im not sure.

https://pastebin.com/b5EDYkSt

Source: https://www.reddit.com/r/gwent/comments/nk4c6e/i_wrote_some_python3_code_that_will_generate_a/

leave a comment

Your email address will not be published. Required fields are marked *