Conquer Club

Greasemonkey Script Assault Odds

Archival storage to keep things organized and uncluttered. Can't find what you need? Search for old topics here.

Moderator: Tech Team

Forum rules
Please read the Community Guidelines before posting.

Greasemonkey Script Assault Odds

Postby chipv on Fri Apr 10, 2009 4:52 pm

Conquer Club Assault Odds

From a great idea from Foxglove - full credit for thinking out of the box.

Note There is a quick link to this post next to the Assault Odds text in the left menu.
(It's the current version number but will jump to this page when you click on it.)


User Guide
Assault Odds User Guide

Requirements
You must be running Firefox with Greasemonkey installed.
Full instructions for Firefox and Greasemonkey from scratch: viewtopic.php?f=527&t=139337

No facility for autologin is yet implemented so you do need to be logged in or you can use the
Auto-login script

Installation
Click on this link (with Firefox and Greasemonkey installed)
Conquer Club Assault Odds
Click on Install and that's it.
Google Chrome users can now use this script - click on viewtopic.php?f=59&t=73696#p2137958 to see how to install.
Once installed you will see this on your active games pages.

Image

What does it do

Assault odds is a tool that quickly calculates precise odds for attacking a sequence of territories on any map.
It has been deliberately designed to be faster than other similar calculators and it will also handle larger numbers of armies.
It consists of a Quick calculator and a Pathfinder
You can show/hide these windows on your games page by using the options in the left menu.

Quick Calculator

Image

Type in attacking army number and a sequence of defending army numbers to get the odds of the attacker winning.
Separate defending army numbers with commas.
e.g. Attacking 10 and Defending 3,2 will calculate odds of a 10 army attacking first a 3 then a 2
The results are saved for future use on the page.
This means that if you have very large numbers to calculate and even Assault Odds can't handle it in one go,
then do a calc for roughly half all the armies. Assault Odds re-uses old calcs making subsequent calcs very fast
and allows for bigger numbers to be calculated.
Currently if you refresh the page this data is lost, but the calcs are very quick for most numbers anyway.
Click on the Add Calc button to add more quick calcs for different routes.
The total will show the product of all quick calcs (so the overall odds of succeeding in all attacks).

Multiple Attackers

Image

You can add attacking territories with commas if you want to attack the first defending territory from more than one place.

Tips

  • Do the biggest calculation first. This saves the calcs and will make subsequent calcs practically instantaneous.
  • Do a big calc just before you take your turn. Then you can calc as you go at speed without waiting for calcs.

Pathfinder

Image
This is a sequence of dropdowns allowing you to plot a path on the map and work out odds at each step.
The dropdowns only show valid bordering territories and bombard spots. (A player cannot attack themselves for example).
You can add deployed armies to the first attacking territory selected.
Enter the number of armies to deploy and click anywhere away from the deploy box.
The first territory number will change accordingly.
Note you can choose any player to work out odds for, not just yourself.

Pathfinder During A Turn
Use the refresh button to recalculate path odds during a turn.
If the path is now invalid, the path will be cleared.

Statistics

Image

Further odds on each number of attacking armies surviving can be found by switching the Statistics option on.
In the above example,
There is a 12% chance that exactly 4 attacking armies will survive an 8v4 assault.
There is a 48.2% chance that at least 6 attackers survive.
There is always a 100% chance that at least 1 army survives (since one has to be reserved for advancing).

Statistics are displayed for multiple attackers also.

For multiple quick calcs, at present, only the last calc statistics is shown.

Display Options

Image
You can choose format of odds - decimal or percentage
You can also choose which windows to show on the page.
Statistics enables the display and calculation of odds of surviving attackers.
Last edited by Dako on Tue Jul 17, 2012 2:35 am, edited 3 times in total.
Reason: Added user guide to post
User avatar
Captain chipv
 
Posts: 2750
Joined: Mon Apr 28, 2008 5:30 pm

Re: NEW: Assault Odds

Postby chipv on Fri Apr 10, 2009 5:29 pm

Thread unlocked, welcoming comments now please.
User avatar
Captain chipv
 
Posts: 2750
Joined: Mon Apr 28, 2008 5:30 pm

Re: NEW: Assault Odds

Postby Woodruff on Fri Apr 10, 2009 5:32 pm

chipv wrote:Thread unlocked, welcoming comments now please.


I presume this does not take into account hidden territories, to include the pathfinding function?
User avatar
Corporal 1st Class Woodruff
 
Posts: 5093
Joined: Sat Jan 05, 2008 9:15 am

Re: NEW: Assault Odds

Postby chipv on Fri Apr 10, 2009 5:34 pm

Woodruff wrote:
chipv wrote:Thread unlocked, welcoming comments now please.


I presume this does not take into account hidden territories, to include the pathfinding function?


Of course not.
User avatar
Captain chipv
 
Posts: 2750
Joined: Mon Apr 28, 2008 5:30 pm

Re: NEW: Assault Odds

Postby The Fuzzy Pengui on Fri Apr 10, 2009 5:35 pm

I love it! Installed it just now, can't wait to try it out! :)

A question about an addition (though I'm not sure how feasible it would be); would you be able to add "Eliminate <x> player from game" and it would find your odds of eliminating the player from the game (not necessarily the path, but percentage for all the armies), or should we just use the Pathfinder option and do it for each path you would have to take?
Gilligan wrote:I'M SO GOOD AT THIS GAME
My stepmom locked the bathroom door
So I opened the lock with my shoelace
User avatar
Corporal 1st Class The Fuzzy Pengui
 
Posts: 2271
Joined: Mon Nov 27, 2006 6:52 pm
Location: Ohio

Re: NEW: Assault Odds

Postby The Fuzzy Pengui on Fri Apr 10, 2009 5:53 pm

For some reason when I add armies to be deployed, it completely screws up the amount of armies on each territory (in the pathfinder). In one case, in an Aussie game, it completely took away the option for me to deploy on a specific territory (even though I owned it).
Gilligan wrote:I'M SO GOOD AT THIS GAME
My stepmom locked the bathroom door
So I opened the lock with my shoelace
User avatar
Corporal 1st Class The Fuzzy Pengui
 
Posts: 2271
Joined: Mon Nov 27, 2006 6:52 pm
Location: Ohio

Re: NEW: Assault Odds

Postby Woodruff on Fri Apr 10, 2009 5:56 pm

chipv wrote:
Woodruff wrote:
chipv wrote:Thread unlocked, welcoming comments now please.


I presume this does not take into account hidden territories, to include the pathfinding function?


Of course not.


I presumed not, of course...but as a former programmer, I know how easy it can be to overlook what are the most obvious things sometimes (not that I've EVER done that, of course).
User avatar
Corporal 1st Class Woodruff
 
Posts: 5093
Joined: Sat Jan 05, 2008 9:15 am

Re: NEW: Assault Odds

Postby chipv on Fri Apr 10, 2009 5:57 pm

The Fuzzy Pengui wrote:For some reason when I add armies to be deployed, it completely screws up the amount of armies on each territory (in the pathfinder). In one case, in an Aussie game, it completely took away the option for me to deploy on a specific territory (even though I owned it).


Gawd, I've tested this to death - was this in the middle of a turn (that's new code)?
User avatar
Captain chipv
 
Posts: 2750
Joined: Mon Apr 28, 2008 5:30 pm

Re: NEW: Assault Odds

Postby chipv on Fri Apr 10, 2009 5:58 pm

The Fuzzy Pengui wrote:I love it! Installed it just now, can't wait to try it out! :)

A question about an addition (though I'm not sure how feasible it would be); would you be able to add "Eliminate <x> player from game" and it would find your odds of eliminating the player from the game (not necessarily the path, but percentage for all the armies), or should we just use the Pathfinder option and do it for each path you would have to take?


Good idea, I don't see why not!
User avatar
Captain chipv
 
Posts: 2750
Joined: Mon Apr 28, 2008 5:30 pm

Re: NEW: Assault Odds

Postby The Fuzzy Pengui on Fri Apr 10, 2009 6:00 pm

chipv wrote:
The Fuzzy Pengui wrote:For some reason when I add armies to be deployed, it completely screws up the amount of armies on each territory (in the pathfinder). In one case, in an Aussie game, it completely took away the option for me to deploy on a specific territory (even though I owned it).


Gawd, I've tested this to death - was this in the middle of a turn (that's new code)?

I tried it both during the middle of a turn and before I started my turn in a different game.

What it appeared to do, when I wasn't actively in a turn, was take the amount of armies I set to "deploy" and subtract it from the actual amount that was already there (taking it down to 1). Then, once the amount of armies was at 1, it would add the amount of armies deployed.

Example: I had 4 on a territory and typed in 3 to deploy. It changed the 4 to a 1. So I changed the deploy amount to 10 just to see what would happen, and it changed the 1 to an 11.
Gilligan wrote:I'M SO GOOD AT THIS GAME
My stepmom locked the bathroom door
So I opened the lock with my shoelace
User avatar
Corporal 1st Class The Fuzzy Pengui
 
Posts: 2271
Joined: Mon Nov 27, 2006 6:52 pm
Location: Ohio

Re: NEW: Assault Odds

Postby chipv on Fri Apr 10, 2009 6:04 pm

When you enter a number in the deploy box, you need to click away from it and the numbers should change automatically.

it is working fine for me still, how are you doing this exactly and in which game?
User avatar
Captain chipv
 
Posts: 2750
Joined: Mon Apr 28, 2008 5:30 pm

Re: NEW: Assault Odds

Postby sailorseal on Fri Apr 10, 2009 6:04 pm

So cool! Nice job!
User avatar
Cook sailorseal
 
Posts: 2735
Joined: Sun May 25, 2008 1:49 pm
Location: conquerclub.com

Re: NEW: Assault Odds

Postby The Fuzzy Pengui on Fri Apr 10, 2009 6:07 pm

chipv wrote:When you enter a number in the deploy box, you need to click away from it and the numbers should change automatically.

it is working fine for me still, how are you doing this exactly and in which game?

That's exactly how I'm trying it. Typing in the number and clicking away from the text box. The numbers change automatically, but to the wrong number. I tried it in Game 4567481 when pretending to deploy on Andrews.

And SA-WEET! About adding the % to eliminate player from game. :)
Gilligan wrote:I'M SO GOOD AT THIS GAME
My stepmom locked the bathroom door
So I opened the lock with my shoelace
User avatar
Corporal 1st Class The Fuzzy Pengui
 
Posts: 2271
Joined: Mon Nov 27, 2006 6:52 pm
Location: Ohio

Re: NEW: Assault Odds

Postby chipv on Fri Apr 10, 2009 6:36 pm

Ok problem fixed, how annoying, introduced that at the last minute.

Download new version by clicking on Latest Version Installed under Assault Odds menu.
User avatar
Captain chipv
 
Posts: 2750
Joined: Mon Apr 28, 2008 5:30 pm

Re: NEW: Assault Odds

Postby The Fuzzy Pengui on Fri Apr 10, 2009 6:42 pm

chipv wrote:Ok problem fixed, how annoying, introduced that at the last minute.

Download new version by clicking on Latest Version Installed under Assault Odds menu.

Working now. Thanks mate. :)
Gilligan wrote:I'M SO GOOD AT THIS GAME
My stepmom locked the bathroom door
So I opened the lock with my shoelace
User avatar
Corporal 1st Class The Fuzzy Pengui
 
Posts: 2271
Joined: Mon Nov 27, 2006 6:52 pm
Location: Ohio

Re: NEW: Assault Odds

Postby whitestazn88 on Fri Apr 10, 2009 6:44 pm

looks very interesting, though i'll wait before installing to see how others like it
Lieutenant whitestazn88
 
Posts: 3128
Joined: Mon Feb 05, 2007 2:59 pm
Location: behind you

Re: NEW: Assault Odds

Postby Timminz on Fri Apr 10, 2009 6:52 pm

Seems to work well now. If you made it possible to have multiple, separate calculators above each other, I would never need to use gambit again.
User avatar
Captain Timminz
 
Posts: 5579
Joined: Tue Feb 27, 2007 1:05 pm
Location: At the store

Re: NEW: Assault Odds

Postby chipv on Fri Apr 10, 2009 6:53 pm

Just gonna let some steam off.

I'm furious! Introduced a bug at the last moment. Fixed now as I said earlier but very annoying that people had to encounter it.

End of rant.
User avatar
Captain chipv
 
Posts: 2750
Joined: Mon Apr 28, 2008 5:30 pm

Re: NEW: Assault Odds

Postby chipv on Fri Apr 10, 2009 6:54 pm

Timminz wrote:Seems to work well now. If you made it possible to have multiple, separate calculators above each other, I would never need to use gambit again.


This is zero problem - did you mean the quick calcs?
User avatar
Captain chipv
 
Posts: 2750
Joined: Mon Apr 28, 2008 5:30 pm

Re: NEW: Assault Odds

Postby Timminz on Fri Apr 10, 2009 6:58 pm

chipv wrote:
Timminz wrote:Seems to work well now. If you made it possible to have multiple, separate calculators above each other, I would never need to use gambit again.


This is zero problem - did you mean the quick calcs?

Yes.
User avatar
Captain Timminz
 
Posts: 5579
Joined: Tue Feb 27, 2007 1:05 pm
Location: At the store

Re: NEW: Assault Odds

Postby chipv on Fri Apr 10, 2009 7:05 pm

How many? Or maybe a button to add more calc bars?
User avatar
Captain chipv
 
Posts: 2750
Joined: Mon Apr 28, 2008 5:30 pm

Re: NEW: Assault Odds

Postby Timminz on Fri Apr 10, 2009 7:07 pm

chipv wrote:How many? Or maybe a button to add more calc bars?

The button would be ideal. Normally one is plenty, but sometimes I use 5, or 6.
User avatar
Captain Timminz
 
Posts: 5579
Joined: Tue Feb 27, 2007 1:05 pm
Location: At the store

Re: NEW: Assault Odds

Postby chipv on Fri Apr 10, 2009 7:18 pm

Ok so how do you want them to work.

Separate odds or a combined product or both?
User avatar
Captain chipv
 
Posts: 2750
Joined: Mon Apr 28, 2008 5:30 pm

Re: NEW: Assault Odds

Postby Timminz on Fri Apr 10, 2009 7:19 pm

with large numbers (4 digits) I get
A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.

but,it makes it through eventually, which is better than I can say for Gambit.

edit- Combined odds would be cool
User avatar
Captain Timminz
 
Posts: 5579
Joined: Tue Feb 27, 2007 1:05 pm
Location: At the store

Re: NEW: Assault Odds

Postby chipv on Fri Apr 10, 2009 7:22 pm

Timminz wrote:with large numbers (4 digits) I get
A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.

but,it makes it through eventually, which is better than I can say for Gambit.

edit- Combined odds would be cool


Solution to the first problem - run smaller numbers. Then run the larger ones again.
Assault odds saves old calcs in a format so it can re-use them for larger calcs.
You will notice the speed difference.

ok to combined odds, leave it with me.
User avatar
Captain chipv
 
Posts: 2750
Joined: Mon Apr 28, 2008 5:30 pm

Next

Return to Tool Archives

Who is online

Users browsing this forum: No registered users