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 Skype: jv.ptec Founder and Director of R&D On Fri, Sep 9, 2016 at 3:40 PM, Tobias Pfeiffer <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. > To view this discussion on the web visit 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. > -- 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/CAGnRm4%2BZp53jLnCYz5csGU_%3D%2BCfmtWFg7YKSP_jOqnptW%2Bpnfg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.