Ruby Newbie struggling with 2D arrays in basic games

Hello,

I’m new to programming and ruby and have recently been trying to build
basic console and gosu games. I consistently struggle when it comes to
implementing game_play logic with regards to 2-d arrays. Whether it be
making sure the correct piece is put in the correct spot or determining
the winner.

I’m open to suggestions (book, online practice resources,etc) on how
to really master 2d arrays and the different ways to extract data and
manipulate them within a game.
Thanks

Chris

You don’t have 2d Arrays in Ruby, but you have Arrays-of-Arrays.

I don’t know what exactly you want to do with your 2d Arrays, but an
alternative would be the class Matrix, which is part of the Ruby
standard library
(http://ruby-doc.org/stdlib-2.3.0/libdoc/matrix/rdoc/index.html).

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs