~srpablo/ScrabbleCheat

718cb768a910f2ba7ca6cd1d2aae0e342849bf0a — Pablo Meier 5 years ago 2191e42 master
fix indent, fix boundary condition, fix file parser
2 files changed, 11 insertions(+), 12 deletions(-)

M code/clients/curses/lib/file_parser.rb
M code/server/src/board.erl
M code/clients/curses/lib/file_parser.rb => code/clients/curses/lib/file_parser.rb +2 -2
@@ 101,12 101,12 @@ class FileParser


    def is_upcase(str)
        ascii = str[0]
        ascii = str[0].ord
        ascii >= 65 && ascii <= 90
    end

    def is_downcase(str)
        ascii = str[0]
        ascii = str[0].ord
        ascii >= 97 && ascii <= 122
    end
end

M code/server/src/board.erl => code/server/src/board.erl +9 -10
@@ 15,7 15,6 @@
-import(gaddag, [get_branch/2]).
-import(followstruct, [make_followstruct/5]).
-import(move, [new_move/0]).
-import(lists, [flatten/1]).

-export([place_bonus_on_board/4,
         place_letter_on_board/5,


@@ 371,14 370,14 @@ subsequence_check([Fst|Rst], Gaddag) ->
                _Else ->
                    throw_badboard("Invalid word found on board.")
            end;
        {true, true} ->
            Rst
        {true, true} -> Rst
    end.

go_forwards([], _) -> [];
go_forwards(Tiles, Gaddag) ->
    Top = hd(Tiles),
    case tile:is_occupied(Top) of
       true ->
        true ->
            Letter = tile:get_tile_letter(Top),
            case gaddag:has_branch(Letter, Gaddag) of
                true -> 


@@ 387,12 386,12 @@ go_forwards(Tiles, Gaddag) ->
                false ->
                    throw_badboard("Invalid word found on board")
            end;
       false -> 
           case gaddag:is_terminator(Gaddag) of
               true -> Tiles;
               false -> throw_badboard("Error with the board: Row or col ends with invalid word.")
           end
     end.
        false ->
            case gaddag:is_terminator(Gaddag) of
                true -> Tiles;
                false -> throw_badboard("Error with the board: Row or col ends with invalid word.")
            end
    end.


throw_badboard(Str) ->