1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Flip Calc - Calculates the probability of culture flips

Discussion in 'Civ3 - Utility Programs' started by anarres, May 12, 2003.

  1. anarres

    anarres anarchist revolutionary

    Joined:
    Apr 22, 2002
    Messages:
    6,069
    Location:
    www.civ3duelzone.com
    Edit: I will always have the latest version linked in to the first post so you don't have to go looking through the thread for it...

    Please note that Version 1.5 contains a significant change to the distance formula, you should update to this version straight away.

    Version 1.5




    'Distance' dialog:


    Change list:

    - Changed distance formula from:

    to: max(x,y) + 0.5*min(x,y)

    1.4 (22nd June):
    - Added a 'Minimum Garrison' field.
    - Made the whole form dynamic. If all fields have valid values the calculations will be done automatically. If any fields are invalid 'n/a' is displayed, click 'Calculate' to see which one.
    - Culture numbers now can be decimals instead of just whole numbers, this is so you can enter a ratio in like 2.5 : 1.
    - Distance dialog box now keeps it's data when you close and re-open it.

    1.3 (15th May)
    - fixed some annoying bugs

    1.2 (15th May)
    - added new form to allow better entry of distance
    - changed icon

    1.1 (14th May)
    - Added error checking
    - Added cumalative probability of flip

    1.0 (13th May)
    - First version
    --------------------------------------------------------------------------------

    Taken from the FAQ:
    • According to this, the factor D is a crucial scaling variable that will enable us to work out the exact chance of a culture flip, since all other factors are known. 'D' should really be written 'n*d', where 'd' is the actual ratio of distance to capitals, and 'n' is the scaling factor.

      P=[(F+T)*Cc*H*(Cte/Cty) - G]/n*d

      My ultimate goal is to produce a 'Flip Calculator', an in-game tool that will allow you to select a city and give you the chance of it flipping to each civ.

      The exact culture score of an opponent is a slight spoiler, as is the existing culture of a city you capture, so in honesty a 'Flip Calculator' would not be 'pure' (usable in GOTM and tourney) if it gained this information in game. You could still have a manual entry for these which would allow a non-spoiler version, and you could estimate the relative culture ratio fairly accurately.

      Does anyone know what the value of 'n' is? If not I will run some scenarios to determine it, it shouldn't be difficult, just a little time consuming.
     
  2. DaveMcW

    DaveMcW Chieftain

    Joined:
    Oct 8, 2002
    Messages:
    6,489
  3. anarres

    anarres anarchist revolutionary

    Joined:
    Apr 22, 2002
    Messages:
    6,069
    Location:
    www.civ3duelzone.com
    Yay! Thanks DaveMcW! [dance]

    I *knew* I'd seen it somewhere. ;)

    Looking at the original Apolyton thread 'n' (as it is in my forumula) is definitely 2000, and 'd' (in my formula) is the ratio of distance to capitals, capped between 0.25 and 4.

    hehe, calc ahoy!

    My first attempt will be a windows app with manual fields to enter the variables in. The second will hopefully integrate with civ and allow you to dynamically select a city to evaluate.
     
  4. wilbill

    wilbill That Old Time Religion

    Joined:
    Nov 18, 2002
    Messages:
    2,513
    Location:
    North Carolina
    Good luck with the project, Anarres. I've developed a pretty good "feel" for when there's a danger of flipping and am not wrong often, but it still happens.
     
  5. Chieftess

    Chieftess Moderator Retired Moderator

    Joined:
    Feb 10, 2002
    Messages:
    24,160
    Location:
    Baltimore
    Drat, there goes another attempt for me to create a civ related program. :p (atleast Visual Basic is the quick way...)

    Thread moved and title changed.
     
  6. anarres

    anarres anarchist revolutionary

    Joined:
    Apr 22, 2002
    Messages:
    6,069
    Location:
    www.civ3duelzone.com
    Thanks CT! :love:

    I probably will do the first version in VB, just to get it done quickly. ;)

    For the second version that ties in with civ I am fairly sure that I will need to use C++ to properly access the memory stack.
     
  7. Chieftess

    Chieftess Moderator Retired Moderator

    Joined:
    Feb 10, 2002
    Messages:
    24,160
    Location:
    Baltimore
    I've been trying to write a dialog-based app in C++ for ages, with no success (very little tutorials. Never learned it in college... Ask Sirp. ;)). I can do it in C++ too. (besides, I'm sure someone's going to find out how to access the cities in the save before I do...)

    Well, neither Borland nor Visual C++ want to link correctly... :wallbash:
     
  8. anarres

    anarres anarchist revolutionary

    Joined:
    Apr 22, 2002
    Messages:
    6,069
    Location:
    www.civ3duelzone.com
    I can do C++, I just use VB for utils with graphical interfaces.

    To give meaningful data the latest version will have to work on the active memory itself, reading the values as the game is playing. Having to save a file and check it will be far to cumbersome. I know this is possible, SpiderZord is writing a GOTM logging utility that does it. :)
     
  9. Chieftess

    Chieftess Moderator Retired Moderator

    Joined:
    Feb 10, 2002
    Messages:
    24,160
    Location:
    Baltimore
    And here it is. I'll be moving this to the Utilities forum next. ;)

    Chieftess' Civ3 Culture Calc

    Note: It's **VERY** crude (and thus, **VERY** beta), since I'm still trying to figure out how to work MS Visual C++. (anyone have any sites for dialog programming?)

    As for the active memory, I have NO idea how to even use that, or even have a DirectX program within a DirectX program. I can't even program DirectX well...
     
  10. zulu9812

    zulu9812 The Newbie Nightmare

    Joined:
    Jan 29, 2002
    Messages:
    6,389
    Location:
    Athens of the North
  11. Chieftess

    Chieftess Moderator Retired Moderator

    Joined:
    Feb 10, 2002
    Messages:
    24,160
    Location:
    Baltimore
    I figured you were coming with your wrong forum animation. ;)


    anyway, the thread with my version of it is here.
     
  12. Plexus

    Plexus Architeuthidae puericomedentis

    Joined:
    Dec 29, 2001
    Messages:
    7,010
    Location:
    S. Calif., U.S.A.
    I know yer name! :evil:

    Nice program, ct.
     
  13. Chieftess

    Chieftess Moderator Retired Moderator

    Joined:
    Feb 10, 2002
    Messages:
    24,160
    Location:
    Baltimore
    Now all I need is Spycatcher's name and then... :mwaha: (running gamecatcher between anarchywrksbest and spycatcher34).

    Well, let's get this thing back on topic.
     
  14. anarres

    anarres anarchist revolutionary

    Joined:
    Apr 22, 2002
    Messages:
    6,069
    Location:
    www.civ3duelzone.com
    :cry:

    So can I pick this up or have you claimed it for yourself CT??
     
  15. Chieftess

    Chieftess Moderator Retired Moderator

    Joined:
    Feb 10, 2002
    Messages:
    24,160
    Location:
    Baltimore
    You can pick it up. There can always be 2 versions. :)

    Medium or supersized?
     
  16. anarres

    anarres anarchist revolutionary

    Joined:
    Apr 22, 2002
    Messages:
    6,069
    Location:
    www.civ3duelzone.com
    Well, here is my version 1.

    Note: There is no error checking on any of the fields yet. The calculations seem to be fine, and it even remembers to cap the distance ratio for you if you enter in a value outside the 0.25 to 4 range.

    Negative values for the flip chance should read 0.00%, stupid formatting on my part...

    If you use it please post any bugs here.

    The next version will have full error checking in, and it will allow a decent input system for the distance ratio (should have NW-SE distances for both human and AI).

    Please also note that it was written in VB6 for development speed. ;)
     

    Attached Files:

  17. anarres

    anarres anarchist revolutionary

    Joined:
    Apr 22, 2002
    Messages:
    6,069
    Location:
    www.civ3duelzone.com
    Here is a screenie:

     
  18. Moulton

    Moulton Monarch

    Joined:
    Nov 21, 2001
    Messages:
    810
    Location:
    Kentucky
    Anarres -- could not find yours to download....

    I still believe that the final datum is the Jokers-Wild random chance of flipping, no matter what else is happening. I have taken to leaving only one unit in a city once the resistance is quelled.
     
  19. anarres

    anarres anarchist revolutionary

    Joined:
    Apr 22, 2002
    Messages:
    6,069
    Location:
    www.civ3duelzone.com
    Moulton, the file is *attached* to post 16. (3 up from here).

    Please post comment/feedback. I guess CT will get the popular vote, but it would be nice if *someone* found a use for mine. ;)


    Edit: I also linked the attachment in to the first post, that can act as a pointer to the latest version...
     
  20. Moulton

    Moulton Monarch

    Joined:
    Nov 21, 2001
    Messages:
    810
    Location:
    Kentucky
    Thanks, I will try both. Wish I had thought of it :(
     

Share This Page