codenjoy-client 0.1.004 → 0.1.005
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codenjoy/client/version.rb +1 -1
- data/lib/codenjoy/game_base_client.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e477261e4162dccd520d1b326aa2b4a76ddd1bf46e00f6b7f97077c0777b34f
|
4
|
+
data.tar.gz: 44b029ca63757250811b068d2b3683f20929f8a83f3796426e7f8ed7fe49f10c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 982339bf4a042480c94f532cf5760412f6f6395afafafd9474c025059cf674d0bd461fbb1ee3aa84f4430577d6c57e5a7cf9f6ea9adce936f9a4d0135e653439
|
7
|
+
data.tar.gz: 455064e8834253c0ae9d739aeb1a4717a980c7398c29c1258c16846da60651f877db362d7f2add4dab30e0f316d6463363b05a2ab9311dd70bb025da026a267a
|
@@ -2,6 +2,7 @@
|
|
2
2
|
require "bundler/setup"
|
3
3
|
require "codenjoy/client"
|
4
4
|
require "codenjoy/games/battlecity/board"
|
5
|
+
require "codenjoy/games/tetris/board"
|
5
6
|
|
6
7
|
class YourSolver
|
7
8
|
# UP: 'up', // you can move
|
@@ -18,7 +19,7 @@ class YourSolver
|
|
18
19
|
#
|
19
20
|
#######################################################################
|
20
21
|
|
21
|
-
return '
|
22
|
+
return 'down'
|
22
23
|
end
|
23
24
|
|
24
25
|
end
|
@@ -26,17 +27,18 @@ end
|
|
26
27
|
game = Codenjoy::Client::Game.new
|
27
28
|
# board = Codenjoy::Client::Games::Battlecity::Board.new
|
28
29
|
board = Codenjoy::Client::Games::Tetris::Board.new
|
29
|
-
|
30
|
+
solver = YourSolver.new
|
30
31
|
url = "https://dojorena.io/codenjoy-contest/board/player/70xewv6o7ddy9yphm1u0?code=2603484461919438773&gameName=battlecity"
|
31
32
|
count = 0
|
32
33
|
|
33
34
|
|
35
|
+
|
34
36
|
game.play(url) do |ws, msg|
|
35
37
|
json = msg[6..-1].force_encoding('UTF-8')
|
36
38
|
board.process(json)
|
37
39
|
puts board.to_s
|
38
40
|
|
39
|
-
ws.send(
|
41
|
+
ws.send solver.get_answer(board)
|
40
42
|
p count
|
41
43
|
count += 1
|
42
44
|
end
|