Skip to content

Commit

Permalink
Works on Pi
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam committed Nov 20, 2017
1 parent 85ae7b0 commit c3149d3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/ruby/constrained_towers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def move
@stacks[ConstrainedTowers.find_adjacent_stack flip, source, @stacks].push @stacks[source].pop
end

def binary
ternary
end

def ternary
ConstrainedTowers.ternarise @count, @discs
end
Expand Down
6 changes: 6 additions & 0 deletions lib/ruby/towers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ def little_bit value, matrix, offset, side
for i in (row..row + 2) do
matrix[i][column] = 1
end
when 2
for i in (row..row + 2) do
matrix[i][column] = 1
end
matrix[row][column - 1] = 1
matrix[row + 2][column + 1] = 1
end
end

Expand Down
2 changes: 1 addition & 1 deletion towers
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TowersSolver < Thor
desc "phat", "solve the towers against the pHAT's webserver"
def phat
while true do
towers = Towers.new 5
towers = ConstrainedTowers.new 5
until towers.solved do
hit_phat towers
towers.move
Expand Down

0 comments on commit c3149d3

Please sign in to comment.