This file contains 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
// Place your key bindings in this file to override the defaults | |
[ | |
// New file uses cmd+n and a new folder uses cmd+shift+n (or ctrl). | |
{ | |
"key": "cmd+n", | |
"command": "explorer.newFile", | |
"when": "explorerViewletFocus" | |
}, | |
{ | |
"key": "cmd+enter", |
This file contains 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
+---------+ +--------+ +-----------+ +-------------+ | |
| Tooling | | GitHub | | 3rd Party | | Your Server | | |
+---------+ +--------+ +-----------+ +-------------+ | |
| | | | | |
| Create Deployment | | | | |
|--------------------->| | | | |
| | | | | |
| Deployment Created | | | | |
|<---------------------| | | | |
| | | | |
This file contains 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
def move(state) | |
head = state[:you][:body][0] | |
neck = state[:you][:body][1] | |
moves = ['up', 'down', 'left', 'right'] | |
moves.each do |move| | |
coord = move_as_coord(move, head) | |
if !off_board(state, coord) && !coord_equal(coord, neck) | |
return { move: move } | |
end |
This file contains 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
def coord_equal(a, b) | |
a[:x] === b[:x] && a[:y] === b[:y] | |
end |
This file contains 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
def move(state) | |
head = state[:you][:body][0] | |
moves = ['up', 'down', 'left', 'right'] | |
moves.each do |move| | |
coord = move_as_coord(move, head) | |
unless off_board(state, coord) | |
return { move: move } | |
end | |
end |
This file contains 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
def off_board(state, coord) | |
return true if coord[:x] < 0 | |
return true if coord[:y] < 0 | |
return true if coord[:y] >= state[:board][:height] | |
return true if coord[:x] >= state[:board][:height] | |
return false # If it makes it here we are ok. | |
end |
This file contains 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
def move(state) | |
head = state[:you][:body][0] | |
moves = ['up', 'down', 'left', 'right'] | |
moves.each do |move| | |
coord = move_as_coord(move, head) | |
# We now know where this is going to be! | |
end | |
end |
This file contains 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
def move_as_coord(move, head) | |
case move | |
when 'up' | |
return {x: head[:x], y: head[:y]-1} | |
when 'down' | |
return {x: head[:x], y: head[:y]+1} | |
when 'left' | |
return {x: head[:x]-1, y: head[:y]} | |
when 'right' | |
return {x: head[:x]+1, y: head[:y]} |
This file contains 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
def move(state) | |
head = state[:you][:body][0] | |
... | |
end |
This file contains 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
def move(state) | |
puts state | |
{ move: 'right' } | |
end |
NewerOlder