Requesting following features

you realise that the 0 and 500 are gameturns not years :p
Code:
def getGameMonth(iTurn):
    getTurnMonthForGame(iTurn, Game.getStartYear(), Game.getCalendar(), Game.getGameSpeedType())

how doesn't the fix make sense? I don't understand... give me a counter example because I have tested it for example when given year -500:2 it returns -6001 which is what I expect. when given
395:2 it returns 4741 which is what I expect...

the function's fix is saying that if the year is negative remove months instead of adding this is because months in bc years are further away from 0 (which is minused of course) but is the year is postive then add months as normal
 
you realise that the 0 and 500 are gameturns not years :p
No, they're not. You're calling the getGameMonth() function and thus you end up with a range of months corresponding to turns, not years. While you're checking the values against turns. It makes no sense, at least not to me. But you should fix it or prove me wrong by testing it, instead of trying to explain any of it. There is no need.

how doesn't the fix make sense? I don't understand... give me a counter example because I have tested it for example when given year -500:2 it returns -6001 which is what I expect. when given
395:2 it returns 4741 which is what I expect...
This is just too hard to explain, so I'm not even gonna get bogged down with the semantics of it. Sorry.

the function's fix is saying that if the year is negative remove months instead of adding this is because months in bc years are further away from 0 (which is minused of course) but is the year is postive then add months as normal
No, this is false math. I can't explain why, but you should never subtract the month from the year * 12. This is where I fail, but since I've already done this I can tell you for sure that this is so.

It would be ten times easier to simply do the code for you than to 1. explain why your's isn't gonna work or 2. try to fix your code.

But I'm confident you'll be able to fix this on your own. Because I did, and my math skills are really weak.
 
notice the getGameMonth function calls TurnMonthForGame I just couldn't think of a good name... it is the same as your getDateForTurn(iTurn) :p so it gives the months for the turns 1 and 500 :rolleyes:

So I was right in the beginning :p of course in ad years december is closest to the next year so december 2011 is closest to Janurary 2012. But in BC years the logic is entirely reversed (in a way) where December 2011 BC would be closest to January 2010 BC. opps :mischief:

but I still cant understand why it won't work... I have tested the logic... the checkDate("395:1") is completely and utterly equal to 395 * 12 which is that year in months... I need you to explain because for me nothing can go wrong (unless I made a mistake with the actual civ4 references...)

January 0 AD will be month 0 and this is what the function tells me...

>>> convertMonth("0:1")
0
 
ok.. from actually thinking about it I realise there is one wrong thing... instead of this for minus dates:

month = dateYear + dateMonth

which is completly wrong (however I was on the right tracks but but somewhat confused) it should be:

dateMonth = int(date[2])

as if you go forward 4 months from the year 1 BC then the code says month -9, this is untrue and should be month -8 so no -1 is needed..
 
Sorry, but the math is just too confusing to me. I don't know how to explain it. I might just make my own version for you to use as a back-up if you fail in fixing your's. Because I already have everything I need for it.
 
wait a minute! I have an idea of how to test if our methods are the same... later when I am back with civ4 And I have tested mine, give me your code and I will make python compare the 2 and see if they return the same answers :p

If my friend is back I will check with him to see if he agrees with my logic (he got an A* in the recent maths exams, and is a C++ programmer so the perfect person to prove me wrong (as he often does :p))
 
This is how I would solve it:
Spoiler :
Code:
def isDate(date):
        tDate = date.partition(":")
        iMonthDate = int(tDate[0]) * 12 + int(tDate[2]) - 1
        iGameTurn = Game.getGameTurn()
        return ( getDateForTurn(iGameTurn + 1) >= iMonthDate
                 and getDateForTurn(iGameTurn) < iMonthDate )

def getDateForTurn(iTurn):
        return getTurnMonthForGame(iTurn, Game.getStartYear(), Game.getCalendar(), Game.getGameSpeedType())
No, I'm not gonna argue about it. Just try it if you fail with sorting your own version out. If mine isn't working, then I'm wrong. As simple as that.
 
If my friend is back I will check with him to see if he agrees with my logic (he got an A* in the recent maths exams, and is a C++ programmer so the perfect person to prove he wrong (as he often does :p))
Key here is how the month game turns are setup within the game, so I couldn't care less what a mathematician has to say about my logic. :rolleyes:

Just try it - in-game - and that will give you all the proof you ever need. As far as I'm concerned I've already proven my point one year ago, so I feel no need to "prove" anything further.
 
I thought you said earlier:
This of course doesn't compute, so we have to subtract 1 (turning it to a 0-11 interval) before adding to the year * 12 value.

I don't see that in the code... confused...

not sure I quite understand this bit:
Code:
        return ( getDateForTurn(iGameTurn + 1) >= iMonthDate
                 and getDateForTurn(iGameTurn) < iMonthDate )
 
I don't see that in the code... confused...
Oops! :blush: (Updated.)

not sure I quite understand this bit:
Yeah, I totally get that. But this is key and I doubt that you will get it working without this expression or something very similar to it. I spent a lot of time on getting this logic to work but I lack the vocabulary to explain how exactly it works. But it should only fire when the target date has been reached, and never again after that. I'm actually very proud of this particular expression, as someone pretty much told me it couldn't be done! :p
 
hmmm it is a strange expression :p to me it means this:

if iMonthDate is less than or equal to the next turns month and the current turns month is less than it return true.... what would be wrong with getDateforTurn == iMonthDate? how does it prove incorrect? (actually I just clicked... this allows for reference to months in the middle the two values that would therefore be otherwise invalid... but why would the code be calling such dates? surely my definitions would always be the right date :p and I take it that this code works on the same 1 turn after principle? (therefore it could be changed to:
Code:
 getDateForTurn(iGameTurn) >= iMonthDate
                 and getDateForTurn(iGameTurn[B] - 1[/B]) < iMonthDate )
))
 
also do you realise that apart from the final statement and my line checking to see if the given date is actually valid... our codes are exactly the same :p

I still don't quite understand the BC years and how they work (my grandad was trying to confuse me with the fact that not only did the BC years never exist (because back then they worked from the founding of the city of rome and therefore they never considered themselves to live before christ as he hadn't happened yet) but that they only had 10 months :p) but I'm sure it will become clear eventually :rolleyes:
 
This subject is just too confusing to me. I have other stuff to do right now. Good luck with it!
 
I will do full testing on both methods with a dummy event tonight... I am very intrigued :p

and don't say you don't have the vocabulary! I find that non native speakers acutally use words that we don't even learn :p it's like they are better at our own language than we are :p I think your english is great (sometimes I actually have to wonder if you are actually english or not where my only assumption is "sweden" in your location box ;))
 
and don't say you don't have the vocabulary! I find that non native speakers acutally use words that we don't even learn :p it's like they are better at our own language than we are :p I think your english is great (sometimes I actually have to wonder if you are actually english or not where my only assumption is "sweden" in your location box ;))
I mean, I'm not at all versed in the technical/mathematical geek-lingo required to explain something like this. Also, I don't fully understand all of it myself, so it would be hard to explain to someone else. My struggle with math is actually one of the reasons I never picked up programming in my childhood. Otherwise I would have been a real programmer by now, for real, since I was very much into programming early on. I only picked up it again some 18 months ago, after more than a 20 year hiatus... And the math is still my nemesis. :mad:

English is actually only my third language, while Swedish is my second one. Yes, I'm an immigrant living in Sweden. Besides math, grammar is actually my other weak area of knowledge. I simply don't know any, which makes learning languages (not computer languages, thankfully!) extremely difficult. I once tried to study Swedish at college, but it simply wasn't possible at that level. Even though I'm a versed scribe and Swedish is the only language I would claim to master, at any level. Grammar is simply a huge white spot in my education. :p
 
so whats your first lanuage?! :p if you hate maths you would have hated to see my page long rearraning of the equations that give the total number of all numbers in a sequence (for example the sequance from 1 to 10 added up is 1 + 2 + 3 + 4 and so on) to make one that gives the amount of x needed to go from an amount of something to the other (actually needed this for a program :p) for example how much is the difference from the total of 1 to 10 and 1 - 14 :p it took me 6 attempts :lol: in the end I got from the rather complex:

((a + b + c) / 2) * (a + b + c + 1) - (((b + c)/2) * (b + c + 1)) - d

to

(a**2 + a)/2 + a(b+c) - d

much better :p

in any case just think: if you didn't give up on programming then you might have never done civ4 programming :p and that would be a disaster!!! (I for one would not be a programmer at all :p)
 
I'm actually from Finland, originally. The language isn't anything like Swedish or English or any other Germanic language. Which makes things that much harder for me!

Yeah, all that math makes my stomach turn. :p Please put that away before you poke someone's eye out with it.
 
:p I am still trying to work out how the 1 difference in our programs (the end) makes that much difference? surely it only applies should the dates not exist along the game's calendar? in which case I would only be using a valid date (I have a program that tells me all the possible dates I can have :p) and not any old random one...

I guess I will have to see later...
 
You'll figure it out yet. Something else you need help with during this weekend or the coming week?
 
probably... well while I was away from the mere mention of a computer I tried to reorganize the modevents into classes on paper (:lol:) didn't get very far as I forgot the class syntax and had no means to find it :rolleyes: but I thought about it for a while and really couldn't think how it would be advantageous to use the subclasses for each event... there really isn't any specialk methods needed or any sort of need for it... Any ideas on how to make the most of classes for this instance?

Also the big one is still the senate feature :mischief: which I acutally need to look back into to actually remember what I was even doing :p if possible you could do some of that...

Untill I get back home and attempt the Restriction code I can't tell if I actually understand what to do :p

other than that, I can't be sure :lol:
Spoiler :

just stuff to go home...
Code:
def isDate(date):
    date = convertMonth(date)
    if 0 <= (date%12) < 12 and getDateForTurn(0) < date < getDateForTurn(500): return date == getDateForTurn(Game.getGameTurn())
    else: print "Invalid Date supplied!"

def convertMonth(date):
    date = date.partition(":")
    dateYear = int(date[0]) * 12
    dateMonth = int(date[2]) -1
    month = dateYear + dateMonth
    return month

date = "395:1"

def getDateForTurn(iTurn):
    getTurnMonthForGame(iTurn, Game.getStartYear(), Game.getCalendar(), Game.getGameSpeedType())

    
def isDate2(date):
        tDate = date.partition(":")
        iMonthDate = int(tDate[0]) * 12 + int(tDate[2]) - 1
        iGameTurn = Game.getGameTurn()
        return ( getDateForTurn(iGameTurn + 1) >= iMonthDate
                 and getDateForTurn(iGameTurn) < iMonthDate )
 
Back
Top Bottom