Skip to content

Instantly share code, notes, and snippets.

class Image
def initialize (data)
@data = data
end
#write a method that loops through the existing 2D array and finds the
#location of the existing ones. The location of the the existing ones
#needs to be stored into memory so they can be iterated over and the
#exiting cells around them can be altered.
@PaleoGuy2012
PaleoGuy2012 / fido.rb
Last active March 7, 2018 01:03
Quiz #3
class Dog
attr_accessor :name, :breed
def initialize(name, breed)
@name= name
@breed= breed
end
def to_s
"#{name} is a #{breed}."
** need to add piece_moved?(boolean) to schema in "pieces" table. **
class Pawn < Piece
def valid_move?(new_x, new_y)
return false if is_obstructed?(new_x.to_i, new_y.to_i)
return false if square_occupied?(new_x.to_i, new_y.to_i)
return true if pawn_capture?(new_x.to_i, new_y.to_i)
return true if move_two_squares_ok?(new_x.to_i, new_y.to_i) && !square_occupied?(new_x.to_i, new_y.to_i)
end