Posts: 9,706
Threads: 69
Joined: Dec 2010
Hello, everyone.
I'm back for some more Civ 6. I've been not very active at the forum for some time, but I still like our community a lot. Hopefully this thread will help get more people engaged, be it in Civ 6 or in the forums as a whole.
I'm currently quarantined in my house, as the situation in Brazil regarding COVID-19 is really worrisome. My situation is actually not that bad, as I live in a state that is not one of the focal points of the epidemic and whose government is taking things very seriously (the same can’t be said about some other states and, especially, about the Federal government). I’m worrying a lot about my family and about the population as a whole. So, a game of Civ is a way for me to relax a bit, put my mind in other, lighter stuff and interact with a community that I really enjoy and admire.
I was thinking of making this thread themed around computer programming, as it’s something that has piqued my interest in the last couple of years. I messed around a bit with some different languages, attended some classes here and there and read a bit (not a lot). I like doing challenges in sites like Hackerrank and, while my knowledge of Data Structures and Algorithms is surely lacking, I understand enough to see the beauty of it. I love finding creative solutions to problems, perhaps more than the “technology” side of things. I never messed with big projects as well.
Anyway, I think I’ll post some problems here and there, with some comment about what I feel is the path to the solution, perhaps we can discuss a bit if there’s enough interest. I remember that the forums had a lot of programmers back in the day. Does this still hold today?
In game related news (there’s a game?), I’m hoping to get Brazil, so that I can represent my homeland as it deserves. It helps that Brazil is probably the best of the bunch that we selected. I don’t think it’s a weak Civ overall, I’ll admit that I voted for it more due to a desire to play with the Civ than because of its power level. There’s a big chance this decision will come to bite me, though.
How is everyone doing? What are you all up to?
May 14th, 2020, 23:34
(This post was last modified: May 14th, 2020, 23:34 by El Grillo.)
Posts: 2,941
Threads: 12
Joined: Apr 2015
Hey Ichabod, good to see you again. I’ll subscribe to participate in the programming exercises, since I know almost nothing about Civ6 I’ve been gradually learning about developing code both at work and in some of my leisure projects. The one I’m excited about right now is a Fire Emblem SRPG engine in python.
I’ve been self isolating due to Covid as well in California, where thankfully the state took pretty quick measures and the incidence rate seems fairly low, and lots of us are working from home. A lot of my family are in China and Hong Kong though, so we call almost every day and try to keep our spirits up for the long haul. With all this extra time, I’ve also been playing a PB here, as well as practicing the trumpet more often.
Good luck and have fun!
Posts: 6,722
Threads: 59
Joined: Apr 2004
Welcome back! Lurkers demand Calvin and Hobbes references!
Posts: 549
Threads: 3
Joined: Apr 2018
I'll probably dedlurk if you don't mind. I like the theme of the game though, best of the worst. I'll be scarce for the next three weeks. The stay at home correlated with my MA thesis, so I've barely noticed. Not like I would be doing much different (except physically going to campus). I am not a program but I am getting some familiarity with it through data processing (degree is in Econ).
Posts: 4,650
Threads: 33
Joined: May 2014
Hey Ichabod, also happy to see you again. Always enjoyed your threads since I started lurking in PB13. Ever considering to return for some Civ 4 as well? (I keep looking at te screenshots people post from the Civ6 PBEMs but don't understand a thing)
How much autonomy do the states in Brazil have in dealing with the pandemic? I have some connections to your country and have been looking in horror at news that have come out about the federal government (well, that was true before Corona as well), but if you say your state is less affected, how much can the local government do to ensure it keeps that way? Wish you and your family all the best!
(May 15th, 2020, 15:57)DaveV Wrote: Welcome back! Lurkers demand Calvin and Hobbes references!
+1
Posts: 9,706
Threads: 69
Joined: Dec 2010
(May 14th, 2020, 23:34)El Grillo Wrote: Hey Ichabod, good to see you again. I’ll subscribe to participate in the programming exercises, since I know almost nothing about Civ6 I’ve been gradually learning about developing code both at work and in some of my leisure projects. The one I’m excited about right now is a Fire Emblem SRPG engine in python.
I’ve been self isolating due to Covid as well in California, where thankfully the state took pretty quick measures and the incidence rate seems fairly low, and lots of us are working from home. A lot of my family are in China and Hong Kong though, so we call almost every day and try to keep our spirits up for the long haul. With all this extra time, I’ve also been playing a PB here, as well as practicing the trumpet more often.
Good luck and have fun!
Hey, El Grillo. I really appreciate the help in the coding department (perhaps I can help in the Civ 6 department, though I’m far from an expert as well). I think tomorrow I’ll post a challenge that I found online that gave me a lot of headaches (I didn’t solve it yet, just stopped trying for a bit), perhaps we can discuss it and see where we end up. I have no experience with big projects, like actually trying to finish something from start to finish (your project sounds really fun, by the way). I should try doing it sometime, I think it helps to internalize the things you learn way more than the online courses and book exercises that I do.
Actually, I recently entered in a selection process for a course sponsored by the Santander Bank, which will focus on full stack development for newbies. The first phase was an IQ test, which was laughably easy to pass. I’m waiting for the second part, which will start on Monday. It’ll be some classes and challenges in an online platform. After that, it’s actual classes, for some months (it was supposed to be in person, but changed to online, due to the pandemic). It sounded interesting and fun to try, let’s see what happens next.
I’m happy to hear that the situation seems to be good where you live. What the news tells me about China and Hong Kong is that they have it under control as well. But I imagine how hard it is to have family in a distant place right now. I’m also trying to keep in touch with family and friends through online means as much as possible. I’m studying a bit of German in my free time and trying to practice eating healthier, with mixed success.
(May 15th, 2020, 15:57)DaveV Wrote: Welcome back! Lurkers demand Calvin and Hobbes references!
Hey, DaveV. I’ll make sure to post some Calvin and Hobbes then. I’m always looking for some new excuses to go back and binge read some C&H strips. It’s actually been a while since I’ve done it. A few days ago I was going through my Dropbox, trying to organize some things, and I found a lot of C&H strips that I posted in the forums. I had a blast reading them, as usual. It’s a pity that most of those links are broken since Dropbox changed some settings. Time to post some fresh ones, I guess.
(May 15th, 2020, 16:25)Banzailizard Wrote: I'll probably dedlurk if you don't mind. I like the theme of the game though, best of the worst. I'll be scarce for the next three weeks. The stay at home correlated with my MA thesis, so I've barely noticed. Not like I would be doing much different (except physically going to campus). I am not a program but I am getting some familiarity with it through data processing (degree is in Econ).
Welcome aboard, Banzailizard. Nice to have you aboard. Lets kick some ass and chew some gum! I’m happy that the timings worked for you regarding your thesis.
(May 16th, 2020, 16:37)Miguelito Wrote: Hey Ichabod, also happy to see you again. Always enjoyed your threads since I started lurking in PB13. Ever considering to return for some Civ 4 as well? (I keep looking at te screenshots people post from the Civ6 PBEMs but don't understand a thing)
How much autonomy do the states in Brazil have in dealing with the pandemic? I have some connections to your country and have been looking in horror at news that have come out about the federal government (well, that was true before Corona as well), but if you say your state is less affected, how much can the local government do to ensure it keeps that way? Wish you and your family all the best!
(May 15th, 2020, 15:57)DaveV Wrote: Welcome back! Lurkers demand Calvin and Hobbes references!
+1
Hey Miguelito. I actually thought about proposing a Civ 4 Succession Game before signing up for this game. The theme would be “Can RB still beat Deity?” and would consist of a standard game, deity difficulty, random map and civs. We have stayed away from Civ 4 SP for so long that I wonder if we can still manage deity. To be fair, I was never much of a Deity player; my best phase as a SP player was in Immortal difficulty (I remember only a single win in Deity).
Regarding MP, I feel Civ 6 is a bit more of a leisure hobby, while Civ 4 is way more cutthroat. In Civ 6, I can just open the turn, decide some things here and there and it’s done. Civ 4 requires way more planning just to not fall too much behind everyone else. Since it’s been a while since I played a MP game here, I guess I want to start it slow.
Regarding the situation in Brazil, the highest court in Brazilian justice recently decided that the states and cities have autonomy to impose restrictions regarding operation of business and other isolation measures. That’s a bit of a silver lining, because more reasonable governors can act to limit the spread of the disease, despite the federal government trying its hardest to downplay the situation (I’ll leave it at that, but the actions of the federal government are borderline psychotic right now). My personal take is that this decision from the high court has to do with the current situation of the federal government and that they would have decided otherwise, if we had a more reasonable president.
As an example, the state I live in, Rio Grande do Sul is enacting a model that categorizes different regions in a scale of lowest to highest risk. Based on this scale, different types of business can open. It’s not perfect, but it’s reasonable, and it tries to have a basis in scientific analysis. I think our governor is really doing a great job midst the chaos. A different problem is that people are starting to disrespect the measures more and more, which is very concerning. Right now, though, the health system in my state is working pretty well, it’s far from full.
Usually, though, the states in Brazil have way less autonomy than the states in the US, from which we copied our government structure. The tributary organization in Brazil (what I mean by that is who gets the money from each type of tribute) also heavily favors the federal government over the states and cities. It’s a big talking point in current political discussion here (well, if you can take a break from all the lunacy going on).
Posts: 179
Threads: 1
Joined: Jul 2016
Your random civilizations are:
BRAZIL
or
KONGO
Post in this thread, or send me a PM, confirming which of these civs you would like to play; or declare that you will reroll and get a different set of two from which you must pick.
Posts: 9,706
Threads: 69
Joined: Dec 2010
Ichabod’s Coding Challenge (AKA Ichabod gets challenged by code) number 1
Here’s the problem: https://www.hackerrank.com/challenges/do...ii/problem
The gist of it is the following:
You get a number. You can perform two operations with this number:
1. Decrease it by 1.
2. Factor the number by two integers. If N is your number and you use this to make it A . B, you have to take the highest integer from A or B. So, if N is 12 and you factor it as 4 . 3, you’ll end up with 4.
Each of these operations costs 1 to perform. You need to find out what is the lowest cost for you to go from N to 0.
For example, if N = 4, the answer is 3. We can either go 4 → 3 → 2 → 1 or 4 → 2 → 1 → 0. The second option is the best, which is 3.
So, about my solution. Lets call the optimal solution to this problem as Q(X). Given N, the optimal movement to make will be to go the number that has a smaller Q(X), be it N – 1 or one of the factors of N, using operation number 2. Lets call this optimal number as M. Q(N) will be Q(M) + 1.
Considering the above, you need to know at least Q(N - 1) to know Q(N). So, it seems to me that to find Q(N), you will have to find all the way from Q(1) to Q(N). Right now, I don’t see a way around this. So, trying to solve the problem, I created a dictionary that stored the Q(X) of every number until Q(N). That is useful, because the actual problem you need to solve is a query of a lot of numbers, not just one. So, you start in Q(1) and you fill the dictionary until Q(N), which is the answer.
But Q(N - 1) + 1 is not always the correct answer for Q(N) (otherwise this would be very easy). You also need to check the factoring movement. Because of this, you need to find out all possible factorizations of N and test all of them (which I do by checking the dictionary). That is where I’m having a lot of difficulties.
How do you find all the possible factorizations of a number N that are a pair? I don’t have a good solution for this. My current implementation does the following: starting at 2, until the square root of N, I try dividing N. If the division results in an integer, I check the dictionary to see the Q(X) of the highest of the factors. This is a brute force approach, and I’m certain I can find a better way to do it, using sets and prime factorization. But I’m a noob at those areas.
So, an initial take to try and solve the problem is to find a way to get all the factors of a number N that consist of two integers, in an efficient manner. That would be way better than my current implementation.
Another question is: if I’m trying to find the Q(N), is it necessary for me to have the Q(X) of all numbers between 1 and N – 1, as I’m currently guessing? If it is not necessary, how do I know when or where I can stop looking? I hypothesized that perhaps numbers that have integer square roots would always get the optimal solution by going to their square roots (which would mean we can limit the N - 1 search to the closest integer with an integer square root). But that proved to be incorrect in my tests. I keep wondering about this, but I don’t have any more leads to try.
Anyway, that’s the problem. I can get the right solutions to the problem already, but I’m not meeting the time requirements, so my algorithm can certainly be optimized. I can post my actual spaghetti code, if you all want to see it, but the gist of my thoughts are up there.
Hopefully my train of thought above is understandable. I have almost no academic background in STEM, so I don’t know how to be precise and formal about my thoughts, nor do I know the actual right notations.
Anyone wants to chime in on this?
Posts: 9,706
Threads: 69
Joined: Dec 2010
(May 17th, 2020, 17:29)Quagma Blast Wrote: Your random civilizations are:
BRAZIL
or
KONGO
Post in this thread, or send me a PM, confirming which of these civs you would like to play; or declare that you will reroll and get a different set of two from which you must pick.
Thanks, Quagma Blast
Well, it's CARNAVAL time, friends.
O que é que a baiana tem? O que é que a baiana tem?
A pipa do vovô não sobe mais
A pipa do vovô não sobe mais
Apesar de fazer muita força
O vovô foi passado pra trás!
Lets get this party started!!
May 17th, 2020, 23:14
(This post was last modified: May 17th, 2020, 23:15 by El Grillo.)
Posts: 2,941
Threads: 12
Joined: Apr 2015
Interesting question Ichabod, let me take a stab at it.
The fact that we can only work through factorization makes me think that a greedy approach that tries to maximize each step down won't work, since it's easy to fall into traps. Also, these kinds of problems typically don't ask you to load in big dictionaries. The problem is categorized under queues in the linked website, but have you tried a list-based approach to see if that might be fast enough?
|