Thanks for the input (both of you!), it'll definitely live in its own module with all important access methods (neighbous_of for instance) so that it'd be easy to exchange. When I do it I'll probably start with tuples and then once the basic monte carlo tree search runs exchange the underlying data type, benchmark and share :)
Tobi On 09/09/2016 04:11 PM, José Valim wrote: > On top of my head I would try either tuples with tuples or a flat > map where you would use the row+col to compute the map key. Ideally you > would abstract all of the board operations on its own module so if later > you need to change its internal representation, the rest of the code > would be fine. > > > > > *José Valim* > www.plataformatec.com.br <http://www.plataformatec.com.br/> > Skype: jv.ptec > Founder and Director of R&D > > On Fri, Sep 9, 2016 at 3:40 PM, Tobias Pfeiffer <prag...@gmail.com > <mailto:prag...@gmail.com>> wrote: > > Hey everyone, > > I'm thinking about doing my (fourth...) Go(-game) AI implementation in > Elixir for fun, learning and profit. It needs to be as fast as possible > to be good, and one of the cornerstones of course is the game > board/state and many simulations will be run. > > A game board is special because... > > * has a set size (19x19 for instance), which can also be "unfolded" to > be one dimensional (just 361 fields) > * needs random access (you often check a field and its surrounding > fields, or many of them) > * is usually updated less than read (you move/set one piece but usually > do more checks before that) > * for Go specifically each board field can only have 3 different values > (empty, black, white) > > Lists are out due to the random access/update change. Now it seems like > my choices sort of boil down to... > > * Tuples > * Binaries > * Maps? > > Does anyone have any recommendations/experience/tips which data type > might be best suited to what I'm describing or what data type I might be > missing or ignoring. > > Cheers + thanks in advance! > Tobi > -- > http://www.pragtob.info/ > > -- > You received this message because you are subscribed to the Google > Groups "elixir-lang-talk" group. > To unsubscribe from this group and stop receiving emails from it, > send an email to elixir-lang-talk+unsubscr...@googlegroups.com > <mailto:elixir-lang-talk%2bunsubscr...@googlegroups.com>. > To view this discussion on the web visit > > https://groups.google.com/d/msgid/elixir-lang-talk/cb55a6c4-f6c0-7ce7-7d0f-a654ebe4f855%40gmail.com > > <https://groups.google.com/d/msgid/elixir-lang-talk/cb55a6c4-f6c0-7ce7-7d0f-a654ebe4f855%40gmail.com>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > > -- > You received this message because you are subscribed to the Google > Groups "elixir-lang-talk" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to elixir-lang-talk+unsubscr...@googlegroups.com > <mailto:elixir-lang-talk+unsubscr...@googlegroups.com>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-talk/CAGnRm4%2BZp53jLnCYz5csGU_%3D%2BCfmtWFg7YKSP_jOqnptW%2Bpnfg%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-talk/CAGnRm4%2BZp53jLnCYz5csGU_%3D%2BCfmtWFg7YKSP_jOqnptW%2Bpnfg%40mail.gmail.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout. -- http://www.pragtob.info/ -- You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-talk+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/973f3006-7506-afc8-f820-d74623f7b291%40gmail.com. For more options, visit https://groups.google.com/d/optout.