Tuesday, May 17, 2022

TournamentCompare v0.007 - The microsoft alternative

 After getting a standard user set up (so I'm not directly touching the admin account), the first step is to set up a new Power Platform environment to keep all the development tables and apps away from the default instance. I'm also tempted to have a Dev / Test / Prod environment too. Yep, may as well go full lifecyccle management from the get-go (It'll be in Dev for a significant chunk of time anyway).

Hmm, apparently the tenant doesn't have enough space for the database. Sure enough, database capacity is 0 of 0, No space allocated. Might see if  I can create the environment without the dataverse database and make afterwards. Hmm nope, still complaining about capacity constraints. Tried signing up for the developer plan for power apps, but it just took me to the same environment. Looks like Microsoft confirms that the developer plan cannot create environments. Oh well.

The next alternative is to create separate databases in the dataverse of the default instance and hopefully link them to separate solutions. Actually without environments the standard solution export / import isn't going to work. Possibly just use DevOps and branching?

Setting up DevOps it looks like my personal account had got there first to register VRBones. Since my personal account is also set up as a developer for Visual Studio, it probably makes sense to leave it there, so I just added the organisation admin and standard user to the mix and made a new TournamentCompare project. 

Upon looking into the DevOps integration it looks to be only with VS Team Services account. Ok, it looks like I'll just need to build out the app in default and keep it lightweight before deciding whether lifecycle management will help to push out anything.  

Tournament Template files created pretty quickly. Next step is to check the model-driven app and especially the self-referenced heirarchy.



Tuesday, May 03, 2022

Microsoft 365 and Power Apps development

Inspired by my new job at Best Practice, I have been looking at Microsoft 365 Dataverse and model-driven power apps as a potential replacement for TournamentCompare development (and possibly others). 

Although it looked like you could sign up for a free community / developer plan, it didn't like my hotmail address. Digging deeper it looked like all I had to do was have a custom domain, so I set up a dev account on tournamentcompare.com, but it still rejected stating it needed a O365 tenant (had expected such, otherwise it would have created all the back end anyway). 

It turns out what I REALLY need is a developer tenant for the entire Microsoft 365 suite, which comes with 25 sample E5 licenses and a 3 month extendable trial window. Super impressed with this offering and goes along the lines of Visual Studio being offered for free too. 

Initially it offered a sample userbase and SharePoint site for a trial, but since I had used the admin tools before I decided to go with the custom install and eschew the trial data, even though it warned on a possible 2 day setup timeframe. Luckily it was provisioned within a minute and sure enough, all the admin controls are available. 

Checking SharePoint and it has a boilerplate communication-style site already set up and admin back end ready to go. 

Jumping straight over to Power Apps and although it took a little to process, it was also provisioned and looks to be ready for development. Excellent, don't need the developer plan (kinda makes sense since I am already inside a dev plan for the entire tenant).

Popping over to Azure Active Directory and, as expected by now, it is also provisioned on a Premium P2 license. This will also allow a great sandbox for testing some of the potential dev opportunities at work (PIM springs to mind).

Overall super happy with the offering.

  

Wednesday, February 02, 2022

TournamentCompare v0.006 - The resurrection

 Now that I have some time to blow the dust off parked projects, TournamentCompare is back in active development. Since almost 7 years have passed, there has a been a pretty steep relearn and upgrade path to get back into the swing of things. 

Visual Studio 2022
Previously development had been exclusively on the laptop with a full install of VS2012, whereas with the community edition generally available I wanted to move it all over to my main PC. Most of the code came across, but the project had issues reconnecting the local files to the new version of SQLExpress. Rather than tackle the upgrade I assumed the laptop would make an easier upgrade path and, as I was taking it to Andrew's, would be required anyway. Over the course of the resurrection I bounced several times between old-but-working versions and the draw of a shinier interface with more integration. 

NuGet Package Management
On the laptop I was able to easily get the original project cloned and compiled under VS2022, but when I went to test a database field update, the scaffolding options for generating the controller and view failed due to requiring EF 6.4.4. After an hour struggling to upgrade 6.1.1 to 6.4.4 using the NuGet package manager (continually downloaded a 0kb package) I gave up and went back to the old code and VS2012 to at least confirm everything was actually working. As package management would definitely be needed eventually I returned after calming down and it was likely an artifact of storing the data on Google Drive. I didn't have much confidence in the cloned package so I looked to regenerate the project again from scratch. 

.NET Framework
When building a brand new project, the package management issues disappeared, but generating the EDMX and controllers from the SQL database seemed to be completely missing. It turns out that a new MVC project using default settings builds only on .NET Core and all the solutions I found for scaffolding out the model-controller & view were definitely NOT what I'd call helpful. To get a new project with .NET Framework elements needed additional components installed into VS 2022, but once up and running it quickly generated the model, controllers and views as expected. 

Bootstrap
I had re-read some of the initial blog posts and recalled the struggles with enumerated types. Instead of repeating the coding upgrades to maintain data-first capability, I revisited the initial clone of the code on my main PC and resolved most of the database upgrade and connection issues. NuGet was also working to deliver Entity Framework 6.4.4, but failed to clean up the old version properly (restart VS needed). Feeling confident I upgraded all other components and promptly broke the compile with bootstrap giving unexpected object errors. Looking into it, Bootstrap 3.x to bootstrap 5.x is just too big a jump, so chose just to downgrade. 

So after a couple of days it feels like I have revisited and relearned most of the foibles with Entity Framework and MVC to set off and actually make progress

ToDo:

 - Get Github integrated so I can develop on PC or laptop
 - Confirm everything is able to be published to Azure SQL & Azure apps
 - Build a few more tournament templates
 - Generate sample tournaments rather than record every single tournament instance when calculating bias. 
 - Generate bias using running methods for averages, std deviations and other aggregators.  



  


Monday, October 05, 2020

Bo'ness Dynasty Pt3 - King Maine McCinaed 'the reveler' of Lothian


(This is an AAR for Crusader Kings III. Year 867 start with the Earl of Fife - renamed to the Bo'ness Dynasty.)
Pt1 - High Chieftan Drystan
Pt2 - High Chieftan Cinaed of Lothian

Trained as an adequate bargainer, Maine made is name as the life of the party. A dear friend to vassals, foreign rulers and wandering knights, Maine's feasts brought many to Edinburgh and most stayed to add their sword or skills to the glory of Lothian. Under Maine's rule the Bo'ness line strengthened in number and power with most finding desirable matches around the banquet table and landed titles flowing from continued expansion throughout Ireland, England, Norway and Denmark.  

Although the Bo'ness family tree grew greatly, Maine himself had only one daughter, Anna, through his early years. Maine's dearest held the family hopes of alliance with France together with early betrothals to Armagnac, but by the time the marriage proposal came to fruition Aquitaine had split from Francia, taking Armagnac with them. Adding to the strife, the Bouchard rulers were swayed to Messalianism, a new heretical offshoot of the Christian faith. For this they were hounded and purged through holy war, leaving Anna stranded without a husband. Before Maine could bring her home, Anna's elderly father-in-law, Duke Bouchard, forced another marriage to the young genius, dashing hopes of future children and alliances. This would not do. Maine plotted to bring her home through any means to keep the Bo'ness heir safe. Soon Duke Bouchard died to mysterious circumstances.

With Maine approaching 40 and still no male heir to the throne, the marriage to 'Anna the wise' was annulled under suspicion of infidelity. Maine's 2nd wife, Alix de Trainel (also gifted with a marvellous intellect) soon lifted to become a magnanimous host of the ever more impressive feasts crowding the halls of Edinburgh. 2 more daughters graced the family line, but concerns were finally laid to rest when Adam, heir to the Lothian throne, was born with Maine over 45. Alix continued to have children, leaving 8 to share the heritage left behind by the time Maine died.

With lineage secured, Maine's final years were devoted to becoming a King in his own right. The kingdom of Alba had flourished in large part to the growing power base of Lothian, but increases in land and levees for Maine also meant increases to his leige. Coupled with King Cinaed V's tight relationship to the Bavarian King, he held a dominant position fielding almost 14,000 men at the height of his power. Another concern was the tanistry elective process limiting kingdom candidates to only those of the Ailpin house; it couldn't be ousted by Bo'ness candidates no matter their standing. An exit strategy had to be found. 

Maine's opening came with the mysterious death of King Cinaed V to a spider bite, succeeding to King Conchenn. While the new liege had lower prestige and less alliances, he could still field 8,000 souls if needed. Maine's troops had grown to over 6,000, but was unsure how the generally reliable family alliances would hold since all swore fealty to Alba as well. With additional alliances garnered through his children to Wessex and as far-flung as Florence, Maine pressed for independence alone as Conchenn returned from raiding Ireland. The Lothian elite were also bolstered by mercenary warbands to field over 17,000 once raised. As Alba's levees returned to their lands, the Retinue of Hengist and other warbands tore into Gowrie, demolishing the standing army and laying siege the capital. Unable to recall Lothian levees, King Conchernn's army depleted to a measly 4,800 that even his own mercenary hires could not recover from. After the first month the campaign had largely been won, leaving only a few harried skirmishes and sieges to seal independence.

Shortly after breaking the shackles of Alba, the Kingdom of Lothian was announced with all lands from Edinburgh to York under rule as well as holdings in Ireland, Norway, Denmark and the Netherlands. As the embarrassment of Alba's sudden fall from dominance over the northern realms sunk in, King Conchernn switched primary titles to the Kingdom of Norway to signify where his power base now lay. Alba is no more.    

Maine's drunken excesses finally took their toll as the obese king revelled his last feast. King Adam may be young, but has his own destiny and domain to lead now.  







Sunday, September 20, 2020

Bo'ness Dynasty Pt2 - High Chieftan Cinaed of Lothian

(This is an AAR for Crusader Kings III. Year 867 start with the single title of Earl of Fife and the start of the Bo'ness Dynasty.)


Cinaed took up the mantle of patron to the Bo'ness line amidst the turmoil of Viking battles for Scotland (Alba) and Northern England. With internal bickering between sons of Ivar the Boneless, other nations descended onto the confusion to tear out a piece for themselves. Cinaed helped himself to most of Lothian to surround his new capital at Edinburgh. Other regions of Ireland and Northumbria also came under the control of the Duke of Moray to add to Alba's dominance of the northern lands. 

In between local skirmishes and clams on the mainland, Cinaed also strengthened his presence on the Nordic coastline to completely supplant the Danes all the way to the Finnish peninsula as well as all mountain passes over into Swedish lands. 

Mercia moved in on Danes holding York to put even more pressure on established viking conquests. Cinaed also saw the opportunity to move in and take the prized capital of York, but missed the opportunity to compliment it with the fertile lowlands around Leeds, with the West Riding capital ceding to Mercia. Spoils were split on the Lancastrian coast as well with Cinaed holding Westmorland and the rest falling to an expanding Mercia. 

All was not happy families within the Alban Kingdom as easy Danish targets dried up. Strife started with the Earl of Lennox declaring rightful ownership of the Irish lands of Oriel, held by Cnes Bo'ness along with her norwegian estates in Traendalog. Mormaer Tadg from Atholl supported the claim to add vastly superior numbers to the equation and tore through the local Oriel defenses. With no formal alliance to assist, Cinaed changed tack and found an avenue to claim Lennox itself through somewhat dubious heraldry. He pressed the claim immediately and swept through the midland holding with ease and pushed into Atholl while their forces were preoccupied overseas on the nordic coast. As they pinned Cnes's troops into a final pitched battle, word reached Flaithbertach Neill that his domain is no more and, as a landless lord, his claim to Oriel is no longer valid.

Even though a few more petty claims over Danish lands rounded out the Cinaed's reign as one of expansion, the internal fractures of Alba hinted at an independent future for the Bo'ness line. 




Sunday, September 13, 2020

Bo'ness Dynasty Pt1 - High Chieftain Drystan

 (This is an AAR for Crusader Kings III. Year 867 start with the Earl of Fife - renamed to the Bo'ness Dynasty.)


Drystan is the earliest known landholder for the Bon'ess Dynasty. Although there is no record of his early life or even how he came to hold the Mormaerdom (Earldom) of Fife, Drystan is likely to have come from Gaelic tribal lands between Edinburg and Linlithgow during the time of viking raids and great upheaval.  

Under the Kingship of Causantin II of Alba, Drystan had relative independence and sought a path to take over Edinburg to claim his homeland. With Ivar the Boneless raiding from the west and Jorvik pushing up from York, Drytan's meagre army could not hold claim for long on the Lothian capital, and eventually fell to Danish hands along with Northumbria. Disheartened, Drystan looked to Linlithgow instead. 

Both Sterling and Linlithgow were held by fellow vassal MacMuirdach. Although internal fighting was not unheard of, MacMuirdach held double the lands and could command almost 1000 tribesmen. Through marriage of Drystan's youngest son into the line of Prince Rhodri 'the great' of Gwynedd, the alliance yielded almost 2000 men to call upon and press the homeland claim. Stirling would fall 5 years later.

With Danish kings vying for Ireland, a small window of opportunity opened to allow Drystan to pinch Oriel from one of the smaller invaders. Alba also allied with Meath to control the top of Ireland until Bjorn 'Ironsides' headed west and dominated. 

Alba turned back to the mainland and forced claims on Strathearn's heart, taking Glasgow from the independent Kingdom. Drystan followed in on the weakened Cumbrians to pick up Kyle and surrounds, leaving Carrick and Galloway to fall soon after to Ivar the Boneless, giving continuous land from east to west across Scotland.

As a more established Earl and finding favour with Moray, Drystan continued tussels with smaller independent Danes on the Nordic coastline, gaining foothold in Bjorgvin and pushing north all the way round to Raumsdale. Enough land was gained to usurp the Vestlond title and elevate Drystan to High Chieftan. 

As an ill-fated holy war between Alba and The Isles was drawing to a close, Ivar the Boneless succumbed to injury and left his nation shattered between siblings. With Lothian falling to Jarl Godfrid separate to The Isles, Drystan pounced on the opportunity to take entire duchy in one bold claim. Calling on all allies and additional mercenaries the weakened Danes fell to a 4,500 strong army, but before the final sieges ran their course Drystan succumbed to old age. His dream of ruling from Edinburgh came 3 months later for the Bo'ness line. 



Tuesday, June 16, 2020

Nothing can stop a cheater?

A recent discussion on the Capitalism Lab forums led to the issue of optimising vs exploiting vs cheating in single player games. Below is a response to this quote:

While I think there is room for exploitation, in the end this comes down to the desire of the player for fair game - nothing can stop a cheater from cheating. - JasonLJ on BankingDLC


As a starting point, the simplest way to define cheating is operating outside the rules. In a computer game the rules are set by the designer and embedded into the simulation. In general this also means that you can interpret cheating as "operating outside the simulation", given the provision that if there are unintended consequences (bugs, etc) the designer can rectify them to clarify / enforce the rules.

On top of the simulation rules there can also be additional "house rules" where players in corporate or individually agree to abide by different rules to achieve a different goal to that which the designer intended. This can be anything from custom mods, scenarios, competitions, the obligatory "one city challenge" in Civ, to someone choosing to only buy and sell purple items. In this case it is the responsibility of the agreeing parties to enforce the rules and if this cannot be done absolutely through the simulation (Eg: turning off all imports at a port for a tougher CapLap challenge) then a level of trust that all players are "playing fair" starts to exist. Note that most sports and even collaborative play operate in this space.

Saying "nothing can stop a cheater" isn't quite right. The simulation space can be hardened against attacks from outside of the simulation, and within the simulation it is almost completely possible to stop cheating by encoding the rules into the simulation.

Now from the other side:
Within the simulation, the aim is to optimise play to maximize whatever the winning criteria is defined to be. In a competitive sense this is the heart and soul of the challenge and the main striving factor. To achieve greater and greater optimization requires deeper and deeper understanding of the rules (and therefore the simulation) and the skills needed to execute optimal play.

This still holds true for "house rules" games, although if there are rules that need to be enforced from outside the simulation, the line between "breaking the rules" and "optimal play" is not as clear cut and opens a window for debate about what is or isn't "fair play".

With JasonLJ's comment:
Cons
- Could be exploited by some players to bankrupt AI competitor banks. However, this is a matter of "willingness to cheat" not "capability to cheat" - even if deposit cap was 20%, players who wanted to use the same trick to cause a liquidity crisis with AI firms could still do so.

There are 2 different angles to view the question of cheating (not sure which one Jason is using, but both are worth discussing anyway):
- If Jason is referring to "tricking" the AI because they don't know how to handle it, then Jason is expressing the fact that any other player wouldn't fall for that, or, more officially, the AI is not playing like a real company would in the real world. Jason is expressing a desire to play with a house rule of "only do what would work in the real world", therefore taking advantage of a dumb AI would be cheating. Unfortunately since CapLab is actually trying to simulate the real world, there is some legitimacy in thinking that the game you are playing is operating under the same rules as the real world, however this isn't the case; the game's rules are enforced by the simulation. That said the designer should, as much as possible, encapsulate the desirable rules from the real world and embed into the simulation to enhance the simulation's relevance to people with this particular house rule. In the scenario above, making the AI aware of their liquidity risk exposure would remove this element of cheating from those expecting the "real world" house rule regardless of any changes to the deposit cap.

- But what if the AI knew about liquidity risk exposure and still got itself into a vulnerable position? Would it then be Ok to punish them? What if the the player got into a vulnerable position, would/should the AI bankrupt them? If Jason was thinking that the ethical choice of intentionally bankrupting someone is available in the game but classified as cheating, then he is putting a new house rule in effect; "Don't bankrupt opponents". Once again the designer COULD choose whether this rule is enforced in the simulation through some sort or anti-competitive behaviour legislation and enforcement (as would likely happen in the real world).

Although it sounds like I'm advocating a wild-west anything-goes-inside-the-simulation approach, it's more the opposite that the designer has the LUXURY of controlling exactly what is or is not simulated, what rules are or are not enforced, what ethical choices do or do not appear, and what learnings the player can take away from the game to apply to the real world. Ideally all players uptake the rules as intended, obviating the need for house rules and potentially divergent views on how to play the game.


Onto the game-breaking strategy:
As mentioned I generally play single-player games until I "break" them by discovering a strategy that guarantees a win, because all that is left is to execute the strategy over and over again. What I REALLY enjoy are complex games where the balance allows a variety of strategies packed full of interesting choices along the way. CapLab is one of those games and I've been playing on and off since the original Capitalism. When I started using the land pre-purchase strategy it felt wonky, but somewhat believable since it seemed to simulate the land-developer mindset. After investigating exactly what was going on and finding the edge cases (especially infinite money generators) it seems FAR more likely that this is unintended and would be classified as a bug or at least needing clarification / enforcement of the intended rules. If so, I look forward to a new version with many more optimising challenges ahead.

Tuesday, August 13, 2019

TournamentCompare v0.005 prep

A recent Math binge has brought me back to predicting confidence levels in the montecarlo method approach to assessing what the bias is in a tournament. Previously I had kept a running total of averages as 1000's of randomly seeded tournaments rolled by, but it looks like I can also keep a running standard deviation. Once I have both the sample standard deviation and the number of tournaments sampled, I should be able to calculate the 95% confidence interval for the trial. Hopefully I can blow the dust off the old code and get it running again.  

Sunday, December 02, 2018

14.5

Although I missed an excellent opportunity to hit Burners after work for 30+Kn, Sunday was almost ideal for Burners with a full tide at 4pm and winds above 20Kn. First session felt good, but not as special as 2 weeks ago and I greeted a 13.1m peak height with a knowing nod. At least it's the Burners record by a fair way.

Francis came down for a late session and I'd recovered enough to hit it once again. Unfortunately the wind was down a few knots and it really felt the heights weren't there. Luckily a strong surge for about 2 mins launched me unexpectedly up above the trees. A few more boosts through the surge saw me up over 14.5m! another PB!

Of the 4 boosts during the surge, the most telling was the 2nd one of only 12.1m where I distinctly remember being pulled off my edge in the leadup. Although I was still riding fully powered, it's the first sign that I might be getting close to the peak wind performance of the kite. The next jump I'd held my edge better and that's what registered the 14.5 monster. 15m is definitely on the cards, but going past that will need better technique.    

Sunday, November 18, 2018

Woo rank #1

After an excellent demo over a year ago, I have had my sights set on an Ozone Edge v9 as my next potential kite. The problem had been that the 10m Edge that I tested felt like it provided the power of my 14m Bandit, yet nimble like my 10m Bandit. Do I get one kite that replaces both? I wasn't willing to give up on the Bandits that soon. Fast forward a good 9 months and the Bandit's had their fair share of running repairs that kept them out of the sky. It finally feels like the maintenance is going to be costing more than replacement. The last piece to fall was a bit of a discount through Wardy.

The first session was great. 10.1m jump off a pretty average session (maybe 18Kn winds) at Elliott. I'd settled on a slightly larger 11m Edge to mainly knock out the 14m Bandit and keep just a bit more sail up in the sky for boosting in the standard 20kn range, and it immediately felt like it was going to bring in the height department.

Unfortunately the next few outings were in lighter winds, and it wasn't as good at the low range as expected. Admittedly I was sometimes the only one out on the 11 when others on 12's and 14's were parking, but it didn't quite have the bottom end of the 14 Bandit as I'd hoped.

18th November was the weekend I was waiting for; steady 20+Kn winds with a full tide to really push the kite into boost mode. After 2 hours on the water I came in and downloaded the woo stats hoping for at least a new personal best. C'mon, 10.5 metres! 12 possibly? The reading floored me. 13.7 metres! a new PB by over 3.5m. Maybe an outlier? Nope, analysis of the session showed several boosts over 12m and the 11 over 11m badge. YES!

As it happened the day was also the QLD boosting comp down in Brisbane. I kept refreshing to see the boosts come in and was pleasantly surprised that they maxed out at 11m. WINNING! Granted I wasn't at the event to share the exact conditions and had over 2 hours to put in a good one, but it looked from the reports to be close enough to give me hope I'm in the right ballpark. Maybe February's Wind Slasher and state freestyle titles might have a boost off?

The day rolled into night and I stayed above the rest. More due to WA missing out on their normal 25+ winds than anything else kept me and David (boosting at Lake Weyba just down the coast) out in front to claim my first (and probably only) daily win on the woo charts:


Another notable improvement was my overall rank. previously a 10.2m still had me in the bottom 33% of all Woo owners, but moving to 13.7m put me right up into the top 20%. There must be a massive bubble of people about the 11-12m mark, which likely means that there's a typical peak jump on standard equipment at that mark. The Edge is certainly the catalyst for going bigger as my technique hasn't changed much in the past 2 years. 

Also notable was that I still has the Edge fully powered all session. I'm pretty sure I can hold down another 5Kn, which means going higher is definitely possible.