Jump to content

  • Log In with Google      Sign In   
  • Create Account


Alistair Sheehy Hutton

Member Since 02 Jul 2013
Offline Last Active Nov 06 2013 04:07 AM

Posts I've Made

In Topic: Efficient Implementation of Monte Carlo Player for Card Game

03 September 2013 - 03:11 AM

Finally having my first free weekend in a few months I'm almost done with my C implementation.  The data structures I've come up with aren't that fancy or complicated but are pretty efficient.  Once I got out of the mental dead end of the "deck of cards" actually behaving like a deck of cards with a 'top of deck' and the like I've been able to arrange the cards such that I need very few operations to save the current state and randomise the game state for the Monte Carlo playouts..

 

As you'd expect it's blazingly fast compared to my Python implementation, on the order of several hundred times speed up, possibly more.  Once I'm done with this I'll be interested to go back to the Python code and implement the same data structures in Python - once I'm no longer allocating and freeing memory all over the place I wonder how fast I can get the Python code to run.


In Topic: can i predict future data using a data history?

06 August 2013 - 10:13 AM

I am genuinely proud of myself for starting as "stupid" as possible.  I started with a single variable per team and worked my way up.


In Topic: can i predict future data using a data history?

05 August 2013 - 07:38 AM

Google for "time series analysis" and "data compression": Both things involve finding patterns in a stream of data.

Of course different kinds of data call for different techniques. Like in most other realms, there is no silver bullet.

 

And don't try to second guess what complexity of solution you will need - start simple and work your way up as needed.  I did some work predicting results of rugby matches and a linear sum of 6 variables (3 per team) was enough to get results comparable with the bookmakers.


In Topic: Efficient Implementation of Monte Carlo Player for Card Game

08 July 2013 - 02:16 PM

Programming this in Python is already a problem because performance matters for Monte Carlo techniques. Do you know C++?

 

I've done C and C++, although given how long since I've last used them in anger I would hesitate to say that I am proficient in either.  This may be a good project to reacquaint myself with the language.


In Topic: Efficient Implementation of Monte Carlo Player for Card Game

08 July 2013 - 01:04 AM

Thanks for your responses, would have replied sooner but had problem logging back into the site.

 

I had profiled my code before posting and had spotted a few obvious inefficiencies, for example due to stupidity on my part I was shuffling the deck twice when performing a play through of the Monte Carlo player and still building up logging strings despite not printing them out.  Now that I have knocked out the (to me) obvious the largest amount of time by far is spent in random.shuffle().  Briscola is a trick taking game (normally 2 players) where players have a hand of three cards and  each round play 1 card then draw one card blind from the common deck.  So correct me if I'm wrong but each play through by the Monte Carlo player requires shuffling all the unseen cards to get a new ordering of the deck.  That's unavoidable correct?  I'm using Python so the shuffling algorithm is linear time and efficiently executed so I can't see much speed up there.

 

I think I might just have too many "speed of writing code vs speed of code execution" trade-offs in my Python programming style for this task - I should maybe do this in another language to force me to think about it differently.

 

PRE-EDIT:  Actually, writing this post has made me think critically about the code - I may have spotted another couple of gross inefficiencies.  I'll let you know how it goes.


PARTNERS