Printing Multi-dimensional Arrays
By Akshata Dupare 1. I troductio 2. Mai class a d mai method 3. Create a other method for stri gArray 4. A other way to pri t arrays 5. Fa
seen from Russia
seen from Germany
seen from Israel
seen from Israel
seen from Russia
seen from Israel
seen from United States
seen from United States
seen from China
seen from United States
seen from United States

seen from United States
seen from China
seen from United States
seen from United Kingdom
seen from Spain

seen from Argentina

seen from Malaysia
seen from United States
seen from Germany
Printing Multi-dimensional Arrays
By Akshata Dupare 1. I troductio 2. Mai class a d mai method 3. Create a other method for stri gArray 4. A other way to pri t arrays 5. Fa

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Week 2, Day 2: Chess (My Favorite Game, Coincidentally)
Today we began to build a chess game. Anyone who knows me, knows that I'm nuts for chess. I'm enjoying this assignment a bunch. My partner Mark and I really wanted to make the code modular and well-organized. The past two days, we haven't been learning new concepts so much as honing our programming style. Assignments like Minesweeper and Chess really force us to consider how domain objects relate to each other, and it gives us great practice in decomposing methods and grouping inherited functionality.
Learned a cool trick with parallel assignment today: you can define multiple variables on a single line to point to multiple items in an array.
diapers = ["huggies","pampers"] my_diaper, your_diaper = diapers
In the snippet above, I'd be wearing huggies, and you pampers.
Another great thing to do is to overwrite the [ ] method when constantly dealing with multi-dimensional arrays.
def [ ] (position) Â self[position[0]][position[1]] end
Now instead of asking for a position by querying two nested arrays, you can just pass in a single array and let the [ ] function take care of separating your request and delegating it to the sub arrays.
You'd pass it like this.
location_of_my_pacifier = [["SF", "CA"], ["SOMA", "160 Folsom"]]
pacifier_thief = Thief.new(location = ["SF", "160 Folsom"])
puts "Run away! Don't take my binkie!" if pacifier_thief.location ==Â pacifier[location_of_my_pacifier]
I hope to refactor our code a bit with Mark and add in these ideas as we continue building our chess game tomorrow. This project is our first to span multiple days and is shaping up to be pretty beastly. I'm cognizant, though, that it'll be nothing compared to what we'll put out in a few weeks time.