Tuesday, 9 August 2016

Improvements to the Magic Darts Wagon Wheel

you may well have read my last post about what I was reluctantly calling a Magic Darts Wagon Wheel. If not, do that quickly now.



Anyway, if you read all the way to the end and read the comments, you'll have seen a nice suggestion from Michael Bench-Capon, in which he proposes making the first dart in a bed contribute more opacity than later darts in a bed. And he even comes up with a way of doing this using fractions and powers of things (yes, mathematicians, that's a simplification!).

Anyway, I thought this suggestion was excellent and I tried to implement it and the following few simple bullet points sum up what happened:
  • I struggled for a bit, not really knowing exactly how to do it;
  • I played around with some trial and error numbers;
  • I thought of concocting a formula which meant that for a specified number of darts (based on number of legs to win, like I initially had), you would reach 95% opacity;
  • I came up with something like 0.05 = n^x, where n is my parameter to be defined and x is my specified number of darts;
  • it's 0.05 transparency because opacity is one minus transparency;
  • I want to find n so I needed the xth root of 0.05
  • I realised that I didn't know how to find an xth root of something so I googled it and it turns out you just do ^1/x, which is very handy;
  • so I came out with something like 0.05^(1-/x) as my n;
  • I then substitute what I used to have as my number of darts for maximum transparency depending on bed type for x, so e.g. it's twice legs to win for missed doubles;
  • this gives me a paramter for each bed type which I called z;
  • then to generate the transparency I just need z^y, where y is the number of darts in the bed;
  • UPDATE: And this actually really helped tidy up the code as well because I could get rid of a "case" thingy I had in there which I had needed to check if the max no. of darts had been exceeded and just go to a super simple transparency = z^y;
  • happy days.
This is the result, using this match between Canada and New Zealand.

I think this really does create a better overall animation than with the previous method, though of course I'm still at a very early testing phase. Still fone-tuning, if you will. Thanks again though to my contributer and please everyone feel free to comment etc. and make further excellent suggestions. Half-hearted remarks or even exclamations would also be appreciated.

PS: I'm also still on the lookout for new name suggestions. Still not wholly happy with Magic Darts Wagon Wheel.

Monday, 8 August 2016

Magic Darts Wagon Wheel

The title "magic darts wagon wheel" isn't particularly satsifying. It includes two important words: "magic" and "darts", but referring to something that looks like a dartboard as a wagon wheel is maybe a little odd. Particularly considering the fact that it looks like a dartboard because it's a diagram of a dartboard. Wagon wheel just happens to be a term from sports broadcasting (cricket), which is why it is even being used here as the working title for my latest invention.

If it's displaying properly, here's the magic darts wagon wheel of Germany against India from the 2015 World Cup of Darts.

In case it isn't evident what's happening, I'll explain it in a few simple bullet-points:
  • the dartboards start white (actually coloured as normal but 100% transparent;
  • the beds that get hit (singles affect both beds irrespective of which is hit) get a little bit less transparent for each dart that hits them;
  • there are a few settings which mean that the type of bed being hit (single, double, treble etc.) is considered when determining the impact on opacity of a dart in that bed;
  • this is because you are probably hitting far fewer doubles that singles (for example) so if I want them registering on the magic darts wagon wheel, then I need to do that;
  • missed doubles (which hit nothing) are registered as black just outside the double;
  • I have these parameters easily editable – at the moment you enter the number of legs needed to win in the match and it gives you some suggested parameters - this may yet be fine-tuned based on results of testing;
  • the boards update automatically when you enter the beds hit, then I save an image of both boards after each visit to a board;
  • these are then strung together in a GIF making the animation of the whole match.
As you may well agree, this is pretty nice. Even a casual observer will see that India hit too many single 20s and too many treble 1s and never really hit any doubles.

There are a few things that I could still improve like:
  • tidying up the drawn dartboard. It's a little jaggy in places;
  • tidying up the programming for saving the image - it works but there is an approx. 1.5 second delay which could maybe be shortened with neater programming;
  • possibly add a scoreboard to the grapic, though as there is currently no entry of "double to win leg", this would require additional data entry (or something else like actually calculating the score based on the beds hit, which possibly wouldn't be impossible, but isn't currently included at all);
  • possible alteration to the means of data entry. Currently I have a grid and I add 1 to the appropriate cell but I could set up something where you enter the three beds hit, e.g. T20, T20, 20 and then it sources from there. Not sure if that would actually be easier though. Am considering something with dropdown menus;
  • other improvements based on testing and/or user feedback.

Please do comment and/or make suggestions for improvements. And, as with my darts wave, covered in previous posts on this blog, please do credit me if using the magic darts wagon wheel for your own darts matches, Twitter feeds or television broadcasts. Thanks.

Also as a little tip, for the latest news and updates, be sure to follow @herrbench on Twitter (that's me by the way) as that's where I'm often posting stuff like this in more reduced form, but including the nice graphics. And it's very handy to retweet stuff on Twitter so feel free to do that as well.