Sha256: e66ab81c4f6f3841c4256007c084849e28c20c34c2611fdbbd0cd96377256ffe
Contents?: true
Size: 778 Bytes
Versions: 1
Compression:
Stored size: 778 Bytes
Contents
module Linotype class Strategy LETTERPRESS_FAN_HEURISTIC = ->(move) do move.score[:covered] + move.score[:defended] + move.score[:edges] + move.score[:corners] end MAX_SIX_LETTERS = ->(move) do move.word.length <= 6 ? move.word.length + move.score[:covered] : 0 end MAX_FIVE_LETTERS = ->(move) do move.word.length <= 5 ? move.word.length + move.score[:covered] : 0 end MAX_THREE_LETTERS = ->(move) do move.word.length <= 3 ? move.word.length + move.score[:covered] : 0 end attr_accessor :scoring_algorithm def initialize(scoring_algorithm) self.scoring_algorithm = scoring_algorithm end def score(move) scoring_algorithm.call move end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
linotype-0.0.4 | lib/linotype/strategy.rb |