forked from AdaGold/scrabble
-
Notifications
You must be signed in to change notification settings - Fork 12
Wave 3 and optionals #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rileslovesyall
wants to merge
36
commits into
Ada-C4:rrsth/master
Choose a base branch
from
rileslovesyall:rrsth/master
base: rrsth/master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 5716a3e
initialize method looks good
TammyHer 51c4e37
initialize method looks good
TammyHer 996df3f
commit to merge
rileslovesyall 05dfd1f
commit to merge
rileslovesyall be603bb
cleaned up ends
rileslovesyall c7e7d18
commit to merge
TammyHer cbdc50f
Trying to sync up our damn files
rileslovesyall 1597e22
commit to merge
TammyHer f66ba5b
draw tiles method passed all tests
rileslovesyall c4f931b
made tiles_array
TammyHer 5229d01
made tiles_array
TammyHer d851726
writing specs for tiles remaining
rileslovesyall ec2331e
Adding spec for tiles reminaing
rileslovesyall 06b0427
fixed spec file merge errors
rileslovesyall e505965
tiles looks good
TammyHer b9ae676
Merge branch 'rrsth/master' of github.com:rileyrileyrose/Scrabble int…
TammyHer 4f17082
tiles remaining method passing test
rileslovesyall 458e4d9
Merge branch 'rrsth/master' of github.com:rileyrileyrose/Scrabble int…
rileslovesyall 9f43848
finish optional , with errors
TammyHer 60800e6
finish optional , with errors
TammyHer b9a9e79
Fixed broken tilebag lib and specs
rileslovesyall b8df122
finish optional , with errors
TammyHer 098028d
Merge branch 'rrsth/master' of github.com:rileyrileyrose/Scrabble int…
TammyHer 7e1bf7d
tried to make matching code because git is merging weird aaahhh
rileslovesyall 1233d86
Matching files, thanks to slack, no thanks to git
rileslovesyall c001bb3
Created Dictionary files, building spec skeleton
rileslovesyall ed44479
new filesfot board
TammyHer 3d3bba5
Dictionary initialize test passing
rileslovesyall d75dd8b
Dictionary is_valid? test passing. Add word test written and failed.
rileslovesyall 0542752
add_word method passing all tests
rileslovesyall 198c1ed
board class with initialize
TammyHer 2cecc16
Dictionary files rewritten to read from txt dictionary file. Dictiona…
rileslovesyall f026550
initialize board - no errors
TammyHer bece491
can't go on anymore
TammyHer d019001
finished wave 3
TammyHer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| end | ||
|
|
||
|
|
||
| def placed_word(word, col, row, direction) | ||
| word.length times do |n| | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we doing the work in this method |
||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
@boardinitialization functionality! It might be a good idea to move the@board = []line into theinitialize_boardmethod, as that method assumes that@boardis empty already.