Featured post

Textbook: Writing for Statistics and Data Science

If you are looking for my textbook Writing for Statistics and Data Science here it is for free in the Open Educational Resource Commons. Wri...

Monday, 17 July 2017

Chess Variants - 960 and Really Bad Chess

Fischer chess, or chess 960, is like queen’s chess which is the standard Orthodox game we know, except in 960, the starting position of the pieces in the back rank is random. It can be played live with a standard chess set, or online through Jocly or Lichess.

There are restrictions on the starting arrangements such as that the king must be between the rooks and that one bishop must be on each colour of square. All the restrictions leave 960 legal arrangements out of 8!/(2!2!2!1!1!) or 5040 unique ways to arrange two rooks, two knights, two bishops, one king and one queen. Both players are given the same arrangements using the files or columns on the board not mirrored for each player's perspective chosen at random.
 
As far as chess variants go, ‘960’ it's pretty close to Queen’s chess in that it is played with the the same number and types of pieces the same 8 by 8 board and that aside from difference in starting Arrangements no other rule changes are imposed.  The restrictions even ensure that castling in either direction is possible.

If chess 960 is chess done with poetic license then Really Bad Chess (RBC) is done with artistic transgression.  In Really Bad Chess, by Zach Gage (http://reallybadchess.com/presskit/ ) and available on Android and Apple, play is done on an 8 by 8 board with one king and a collection of pawns,  knights, bishops, rooks, and queens arranged into ranks per team. That's about all I can say for certain about the starting state of a Really Bad Chess game.

The pieces each player receives are random, really random. The average piece tends to be more powerful than they would be in a game of Queen’s chess.  At the lowest ranks/difficulties, players typically start with three or four queens as well as a front rank comprised mostly of bishops. At those same lower difficulties the opponent AI would have a much less impressive collection of pieces.

That's one big difference between 960 and RBC: the players are each given their own random set.  When playing against humans, both are treated to a random high-powered arsenal. In ranked mode, games are against the AI and the difference in power is determined by the difficulty setting. At rank/difficulty 0 the player starts with a massive material advantage over the computer. At  100, this advantage is reversed. At 50, both players are given equally strong pieces although the pieces are still different for each player and they are still more powerful on average than in Queen’s chess. For example each player could have two queens and roughly six knights. 

Every win in ranked play against the AI increases the difference of the next ranked game. Every loss does the opposite. The AI itself gets no smarter which may be to simplify the concept of difficulty, and it keeps the game reasonably fast because AI does not think to Greater depth at high levels.
This is the first variant I've played where I'm not absolute trash and I have the proof:

  

The AI tends to strongly value putting you in check and will needlessly sacrifice pieces to do so sometimes. This strategy works well and it partially sidesteps the issue of uneven material value. For example, in difficulties less than 50 even trades for pieces are desirable. At difficulties above 50 they are not. But these material advantages are most important in the endgame. I have played several matches above-50 where I have overcome the material disadvantage and then some only to be checkmated in the mid-game. For example, this game, in which I played as white:


There is an undo button that allows you to take back one move against an artificial intelligence. The button only works to a depth of one move, and it can only be done so many times. Undo uses can be recovered or stockpiled by either watching video ads (5 per view), or direct purchase ($1.40 per 100). 100 undo uses are bundled with the premium version of the game. The premium version settings are well worth the $4 if you're going to play 10 or more matches. The default color scheme is hideous but you can change it with premium.

One minor complaint is that the term ‘rank’ is used instead of ‘difficulty’. Rank goes up as you win when logically such a number should decrease. Rank 1 typically means ‘the best’, but not here.
A bigger problem is that pawns are always promoted to queens when promoted. This is usually what I want but cases do exist when another piece is better and the extra decision step isn't that cumbersome.

It's a lot of fun to go on a power trip and play matches with a lot more non-pawn pieces than I would otherwise have. It speeds the game up to the point of absurdity where 50% to 70% of pieces are moved to capture another piece.

The undo button and the wide set of possible scenarios in Really Bad Chess has been a fun tool for a casual player like me to practice tactics, however impossible they would be in a real game. I'm a little worried that games like this are teaching me to play chess incorrectly which will make it harder to develop skill in the standard game. However I've never played chess seriously and I'm in my thirties so the opportunity cost doesn’t seem too steep.

Really Bad Chess is really good at making puzzles as well. It has daily and weekly puzzles which are just matches with preset pieces.

Wednesday, 12 July 2017

Annual Report to Stakeholders 2016-17

Executive Summary (informally, the ‘TL;DR’):

Accomplishments this year felt like a natural extension of the previous year. The amount of writing dedicated to teaching five courses does not reflect the proportion of this year's effort that went towards that.

For reference, last year's report is found here 


Personal:

Gabriela and I have the start of a family going; she has moved in and we have a chihuahua-poodle puppy. People that are impressed that Einstein did all that he did with a family of five children are probably the same people that have never seen a dog like this.


Education (Learning):

I have read extensively on the craft of scientific writing. Among the most useful books have been 'The Chicago Guide to Communicating Science' and 'The Copy Editor's Handbook' for my own learning and various IELTS and TOEFL test preparation guides for teaching preparation. There are many books on academic writing, few books on scientific writing, and apparently none on statistical writing.

Between a ten-day trip to Brazil, and many conversations with Gabriela and her Brazilian friends,, I can call myself an intermediate learner of Portuguese. I also finished all the Portuguese lessons on Duolingo, and got this nifty trophy!




Although I haven't obtained any more SAS certifications, I did gain more depth as a necessity to teaching Stat 342.

I read several books on chess and chess variants. This was in order to answer the personal question 'why is our current set of rules, also called Queen's Chess, the canonical set of rules and not some other iteration?'. So far, the best answer I have the same answer for why words are spelled the way they are, or why the US uses the imperial measurement system: That's what the most popular set of rules were at the time they were frozen by their widespread, reproducible use.

I took the test to be on Jeopardy! To study for this, I played at home, read trivia books, and played the mobile version of the game until I was in the top 200 of 40,000+ players. Only 4% of test takers are contacted for an interview, and I was among the remaining 96%.


Education (Teaching):

Including this summer, I have taught five courses: Stat 305, Stat 342, Stat 201 (twice), and Stat 203. All courses except 342 were service courses, and all courses except 203 were new to me. My ratings are now collectively only slightly above average, but my applause record is still perfect at 5/5 (and one missing due to snowstorm).

In the last 12 months, about 700 students have had me as a lecturer.

Earlier this summer, I gave a series of 5 two-hour seminars on R programming for the graduate students and faculty in the department. The topics of the seminars were vectorization, optimization, scraping and cleaning text data, imputation, and using GGplot, respectively.

I also gave an invited lecture (over video conferencing) to Kevin Kniffin's sports science class at Cornell University. I gave a presentation of data mining tools to the SFU Sports Analytics Club.


In the next year, I will be teaching 203, 305, and 342 again. The notes for 305, and especially 203, are robust, but 342 needs work. Stat 342 is the SAS programming course, and I want to give it more depth this time around.

The other course for next year, Stat 300, is statistical writing, for which I've made extensive preparations.



Research:

The hockey pace paper that Rajitha, Tim, I wrote was accepted and we did a round of suggested revisions and some other improvements. Kevin Kniffin and Christian Hilbricht (of Cornell University) and I co-authored a paper on the timeout in hockey. I wrote my first solo paper on goalie fatigue in hockey. I also submitted the network analysis work from the thesis to ArXiV.

I updated the previously mentioned hockey research on the overtime loss rule at the Cascadia Sports Conference in Vancouver in September with recent years of data, as well as additional depth on shot count. However, the results were less significant than expected, meaning that teams are playing closer , there were negative results.

I networked in person with some potential collaborators at the University of Campinas in Brazil.



Publishing and Service:

I have started writing a coursepack / textbook on statistical writing. So far, along with material from the blog, I've made
- A test based on IELTS to see if the book and course are appropriate for you.
- An assignment on writing scientific questions
- An assignment, complete with example, to write a shortened paper for general interest
- A collection of example 'microconsults', based on my answers to statistics questions on online forums.
- Two reading comprehension assignments based on reproducibility and on undergrad research (in addition to the four such assignments previously posted on the blog)


2 papers were refereed for the Open Journal of Statistics.

7 papers were copy-edited for the Canadian Journal of Statistics.

20 blog posts were made and kept, not including this one. This is down from last year's 26, but the length of the posts are trending longer, and popularity of the blog itself is trending higher. The post on the Jeopardy analysis has more than 1300 views as of writing this.

3 students' theses were helped toward completion through copy-editing, coding, and/or consulting.


Game Design:

Not my accomplishment, but I funded (solo, not crowd) the creation of a mobile game by a friend. It's still in pre-alpha, but he's making a lot of progress.


Saturday, 8 July 2017

Chess Variant - Wave Chess

Wave chess is a variant of chess meant to be played over multiple games.


Each player starts the match with x1 and x2 'waves' respectively. They start the match by first playing a game of standard, orthodox Queen's Chess. In each game after the first, the loser starts with all their pieces and all their clock time, but with one fewer wave in reserve. The winner of the previous game plays with the pieces and time they had remaining after the previous game, but the winner does not lose a wave.

Each remaining winner's piece can be placed in any space that it could legally start at. For example, a player with one remaining rook can choose either corner to start that rook in. They can also place their remaining pawns anywhere in the front rank.

A player is considered to have lost or won a previous game regardless of whether they have lost by forfeit or checkmate. The loser of the previous game becomes the white player.


In a draw, both players lose a wave and begin their next game with all pieces and time, and the previous game's white player becomes the black player.


This variant extends the idea of material odds handicapping. In a single game, one common handicap is to forfeit one or more pieces at the beginning of the game. In wave chess, smaller incremental handicaps are possible by forfeiting pieces only for a player's first wave. Also, larger handicaps are possible by giving one player more waves.


The wave mechanic also reduces the incentive of forfeiting. A player from a lost position may still want to continue a game in order to reduce their opponent's material for the next game.


After the first non-draw game, subsequent draws become less likely because one player will start with a material advantage.  I would expect that matches between strong, evenly matched opponents would start with one side beating the other with only a few pieces in the end game, followed by alternations between short games where the winner of the previous game manages to take a few pieces before being mated, and normal length games where the previous winner starts only a few pieces behind.


I would also expect that matches between badly mismatched players would result in the weaker player throwing wave after wave at the stronger player, which could make the game more exciting for both players. How many waves does it a take for a 1400-rated player to take down a single wave of a world class chess AI like Stockfish? How many waves of novice players, or randomly selected moves, can you withstand against?


One possible compromise between Queen's Chess and Wave Chess is to allow a winning player to regain x points of material between games. 

As there are thousands of variants out there, it's plausible this has been done before. If someone reading this knows of a similar concept, I would love to know so I can send a link to it and give credit.

Saturday, 24 June 2017

R Seminar on programming with vectors

This is the first of five seminars that was given at Simon Fraser University. I've included this one in the blog because it makes for, hopefully, an excellent tutorial for intermediate users of R.


Inside:

- Vector operations
- Building a matrix
- Matrix operations
- Arrays, data frames, and data tables
- Indices
- For loops
- For loops on indices
- Apply functions
- Binding
- The permutation test – two sample t
- User-defined functions
- The replicate() function
- The by() function
- The combn() function - Permutation Test - All Combinations
- Synthesis – permutation test for ANOVA



Thursday, 22 June 2017

Assorted Sports Questions

These are some problems I'd like to posit to the sports analytics community, as food for thought and future research starters.

The scheduling of 31 teams (NHL Ice Hockey)


What scheduling problems, will arise in the national hockey league by having a prime number of teams? It must restrict their options for the number of games in a season, at the very least.

Are there even any other major leagues with odd numbers of teams? Leagues without a divisional structure such as Barclay's Premier League in soccer could get away with it, but they have the complications of Champion's League promotion and of relegation to deal with.

It's not just about creating a set of pairings so that every team has the same number of home and away games as well as games against same-division and same-conference opponents. There is also scheduling to consider, in that the limited number of weekend nights are preferable for business purposes, and that teams must be able to physically be in the same location at the same time, presumably with a rest buffer. There were already issues with the 30-team, 82-schedule because of injury risk (and greater injury consequence in terms of games missed). Adding a team will compound this, and the forced asymmetry of a prime number of teams reduces the flexibility of the schedule to account for weekends and rest.

As an aside, look to Balanced Incomplete Block Designs as a basis for designing team schedules.


Ratings for Sports Officials (All Sports)

In baseball, the location of the pitch as it crosses home plate is recorded for every throw, so people can tell where each umpire considers the strike zone to be, and the level of consistency of that zone.

What ways are there to evaluate the accuracy and consistency of officials in other sports? Tracking live decisions vs after the fact decisions from recordings?  Could you do it as a 'deviation from superhuman AI' metric like how professional chess players are sometimes rated? For example, we could probably existing trackers (which are 2D for players and 3D for the ball) in NBA basketball to check the level of enforcement of traveling.

What are the ethical and behaviour implications of tracking and reporting officials' performance statistics like we do with players? Will officials lose focus on the game if they are also concerned with their stats? Would there be sufficient value to sports to do this?




Playoff Match Draft (All Sports, NHL Hockey example)

Instead of having first-round playoff match-ups determined solely by seed, matches should be determined by draft. Take the national hockey league (please). The NHL is split into two conferences of 15 and 16 teams respectively. In each conference, the 1st seed team plays the 8th seed team (Ignoring wild card complications), the 2nd seed team plays the 7th, 3rd plays 6th, and 4th plays 5th. If a team's skill were one-dimensional, this setup makes sense and the team that does best in the regular season is rewarded with the best chance to advance by playing against the weakest qualifying team.

Reality is messier. This setup occasionally leads to teams being punished for playing well in the regular season by being played against a team that they do particular poor against in the first round the playoffs.

Imagine a playoff draft instead. The eight teams in each conference qualify for the playoffs as before, but instead the top seeded team CHOOSES their opponent from the other seven qualifying teams. Then, the top seeded team among the remaining 6 chooses their opponent from the remaining 5 and so on. By default, teams could always select the lowest seeded available opponent, which leads to the same 1-8, 2-7, 3-6, and 4-5 pairings as the current setup. However, doing very well (3rd or better) in the regular season earns you some discretion if there's an opponent that counters you that you would like to avoid.

There would be absolutely no reason for a team to covet a lower position over a higher one. There would be no implication of strategically losing games at the end of the season, because there would be no conceivable reward in it.

A playoff draft also adds the potential for dramatic scenarios. If a team choose anyone other than the default lowest seed opponent, that implies a lot of confidence in being able to beat that opponent specifically. A lot of bragging rights come from a draftee beating their drafter. Would a team draft a stronger but less physical team to reduce their injury risk for the 2nd round, if it happens.

Would a team deliberately develop a reputation for being physical in the hopes of being drafted later against a weaker team?


Home Team Advantage (MLB Baseball)

Is batting last in baseball really an advantage? Sure, the team who bats last has more information when they do bat, which can provide a strategic advantage. However, that information advantage is nothing like it is T20 or One-Day cricket, in which each team only bats once, and teams still opt to bat first sometimes. Also, in baseball, batting last means always pitching for 9 innings in non-tied games; that's on average 6% more pitching than the other team needs to do. Is the information in the current game worth the extra pitching fatigue from the next game?

In Major League Baseball, games are usually played in 3 or 4 game series between opponents. The home team is given the supposed advantage of batting last for all of those games. Would it be a greater advantage to bat first for the first 1 or 2 games? Even if it did, would it be 'better' to increase the home team advantage?


Designated Hitters (MLB Baseball)

What would happen if the catcher didn't have to bat, and was also replaced with a designated hitter like the American league pitcher? Would that speed up the game, or is the time to change gear minimal? Would it lead to more hits by pitch because of the reduced opportunity for retaliation?

Does there need to be 9 players in a batting lineup, or can the designated hitter simply be removed in favour of an 8-player lineup? What second-order effects to the typical roster would there be by eliminating the designated hitter?