10
Monty & Randy– the dynamic Ultimate Tic Tac Toe duo Niclas Jern njern Co-Founder @ www.walkbase.com

Aaalto ES CodeIt 2013 - Ultimate Tic-tac-toe submission slides

  • Upload
    njern

  • View
    374

  • Download
    1

Embed Size (px)

DESCRIPTION

The slides I used when presenting Monty - my submission for the CodeIt 2013 Ultimate Tic-tac-toe challenge.

Citation preview

Page 1: Aaalto ES CodeIt 2013 - Ultimate Tic-tac-toe submission slides

Monty & Randy– the dynamic Ultimate Tic Tac Toe duo

Niclas Jern

njern

Co-Founder @ www.walkbase.com

Page 2: Aaalto ES CodeIt 2013 - Ultimate Tic-tac-toe submission slides

Tools used

Page 3: Aaalto ES CodeIt 2013 - Ultimate Tic-tac-toe submission slides

The challenge• There are 8 sexdecillion 837 quindecillion 965 quattuordecillion 761

tredecillion 661 duodecillion 276 undecillion 634 decillion 907 nonillion 936 octillion 847 septillion 827 sextillion 420 quintillion 932 quadrillion

210 trillion 688 billion possible ways to play UTTT – If you can express save game in 100 bytes, you have approximately 21 million

billion billion billion truckloads of 16 gig USB sticks with game data

• The AI has limited execution time• You can only upload the code (no training

data)

Page 4: Aaalto ES CodeIt 2013 - Ultimate Tic-tac-toe submission slides

Solutions #1• Use a Monte Carlo Search Tree (MCST) based

bot (Monty) and his assistant (Randy)– “Stupid” in the beginning, but grows smarter the

further into the game you get (smaller search space)

– Playing against Randy (RandomBot) – wins 100%– Against itself – ties 80%, wins 13%/7%– Improves linearly with execution time

Page 5: Aaalto ES CodeIt 2013 - Ultimate Tic-tac-toe submission slides

Solutions #2• Pick a language based on speed /

HackerRank execution time.– C/C++ is fast, but only gets two seconds– Python gets 16 seconds, but is quite slow– Java is fast, but warming up the JVM eats into

it’s five seconds.– Golang gets a generous six seconds and is

comparable to C/C++

Page 6: Aaalto ES CodeIt 2013 - Ultimate Tic-tac-toe submission slides

Solutions #2• Ruthlessly benchmark and optimize:– Slowest function is checking which

moves are available.• With optimization, checking an empty board

(worst case) went from 15000 nanoseconds (initial version) to 4000 nanoseconds (final version) on i7 laptop.

Page 7: Aaalto ES CodeIt 2013 - Ultimate Tic-tac-toe submission slides

Solutions #3 (not implemented)

• Idea: save successful search trees– Add CBR (Case-based reasoning)– Augment generated search trees with saved

ones for fun & profit– Using real game history would be more realistic

than simulating random games with Randy

Page 8: Aaalto ES CodeIt 2013 - Ultimate Tic-tac-toe submission slides

Thoughts about “Code it”• A lot of fun–Would love to participate again!– Good mix of algorithmic and more

dynamic challenges.

Page 9: Aaalto ES CodeIt 2013 - Ultimate Tic-tac-toe submission slides

Thoughts about “Code it”• Good reason to sit down and learn

new algorithms, tools and techniques– The S.W Sloan point-in-poly algorithm

(too slow for Polygon challenge )–MCST (Monty)– Probability mapping (Battleship)

Page 10: Aaalto ES CodeIt 2013 - Ultimate Tic-tac-toe submission slides

Thank you• And hope to see you again during the

next Code It!