Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
082d675
draw tiles method written
rileslovesyall Oct 15, 2015
5716a3e
initialize method looks good
TammyHer Oct 15, 2015
51c4e37
initialize method looks good
TammyHer Oct 15, 2015
996df3f
commit to merge
rileslovesyall Oct 16, 2015
05dfd1f
commit to merge
rileslovesyall Oct 16, 2015
be603bb
cleaned up ends
rileslovesyall Oct 16, 2015
c7e7d18
commit to merge
TammyHer Oct 16, 2015
cbdc50f
Trying to sync up our damn files
rileslovesyall Oct 16, 2015
1597e22
commit to merge
TammyHer Oct 16, 2015
f66ba5b
draw tiles method passed all tests
rileslovesyall Oct 16, 2015
c4f931b
made tiles_array
TammyHer Oct 16, 2015
5229d01
made tiles_array
TammyHer Oct 16, 2015
d851726
writing specs for tiles remaining
rileslovesyall Oct 16, 2015
ec2331e
Adding spec for tiles reminaing
rileslovesyall Oct 16, 2015
06b0427
fixed spec file merge errors
rileslovesyall Oct 16, 2015
e505965
tiles looks good
TammyHer Oct 16, 2015
b9ae676
Merge branch 'rrsth/master' of github.com:rileyrileyrose/Scrabble int…
TammyHer Oct 16, 2015
4f17082
tiles remaining method passing test
rileslovesyall Oct 16, 2015
458e4d9
Merge branch 'rrsth/master' of github.com:rileyrileyrose/Scrabble int…
rileslovesyall Oct 16, 2015
9f43848
finish optional , with errors
TammyHer Oct 16, 2015
60800e6
finish optional , with errors
TammyHer Oct 16, 2015
b9a9e79
Fixed broken tilebag lib and specs
rileslovesyall Oct 16, 2015
b8df122
finish optional , with errors
TammyHer Oct 16, 2015
098028d
Merge branch 'rrsth/master' of github.com:rileyrileyrose/Scrabble int…
TammyHer Oct 16, 2015
7e1bf7d
tried to make matching code because git is merging weird aaahhh
rileslovesyall Oct 16, 2015
1233d86
Matching files, thanks to slack, no thanks to git
rileslovesyall Oct 16, 2015
c001bb3
Created Dictionary files, building spec skeleton
rileslovesyall Oct 16, 2015
ed44479
new filesfot board
TammyHer Oct 16, 2015
3d3bba5
Dictionary initialize test passing
rileslovesyall Oct 16, 2015
d75dd8b
Dictionary is_valid? test passing. Add word test written and failed.
rileslovesyall Oct 16, 2015
0542752
add_word method passing all tests
rileslovesyall Oct 16, 2015
198c1ed
board class with initialize
TammyHer Oct 16, 2015
2cecc16
Dictionary files rewritten to read from txt dictionary file. Dictiona…
rileslovesyall Oct 16, 2015
f026550
initialize board - no errors
TammyHer Oct 16, 2015
bece491
can't go on anymore
TammyHer Oct 16, 2015
d019001
finished wave 3
TammyHer Oct 16, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions lib/board.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
module Scrabble
MAX_LENGTH = 15
class Board
attr_accessor :board

def initialize
@board = []
initialize_board
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of a separate method to encapsulate the @board initialization functionality! It might be a good idea to move the @board = [] line into the initialize_board method, as that method assumes that @board is empty already.

end


def placed_word(word, col, row, direction)
word.length times do |n|
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we doing the work in this method word.length times?

if direction == :horizontal
if horizonal_available?(word, col, row) #return true even if one of the letters located
placed_word_horizontal(word, col, row) #check if there's a letter- and use the right amount of letters the user needs
else
puts "There is no place on the board"
break
end
elsif direction == :vertical
if vertical_available?(word, col, row)
placed_word_vertical(word, col, row)
else
puts "There is no place on the board"
break
end
else
raise ArgumentError, "No direction"
end
end
end

def initialize_board
15.times do |row|
15.times do |col|
@board[row]||= []
@board[row].push("*")
end
end
end

#
# def horizonal_available? (word, col, row) #boolen method
# count = 0
# while @board[col][row]!= nil
# if @board[col][row]!= "*"
# if @board[col][row] == wo
# raise ArgumentError, "Out og board limits"
#
# end

def placed_word_horizontal(word, col, row)
end

def vertical_available?(word, col, row) #boolen method
end

def placed_word_vertical(word, col, row)
end








end
end
16 changes: 16 additions & 0 deletions lib/dictionary.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@


module Scrabble
class Dictionary_Class

def is_valid?(word)
raise ArgumentError if word.class != String
File.open('./lib/dictionary.txt') do |file|
file.any? do |line|
line.include?(word)
end
end
end

end
end
Loading