Skip to content

Commit d97a329

Browse files
fix score
1 parent e2ac2f7 commit d97a329

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

tool/rlc/test/examples/space_hulk/board.rl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ ent Board:
146146
let x = self.units.get(0).x
147147
let y = self.units.get(0).y
148148
let original_distance = manhattan_distance(22, 2, 5, 13)
149-
let current_distance = manhattan_distance(x.value, 22, y.value, 5)
149+
let current_distance = manhattan_distance(x.value, 21, y.value, 4)
150150
if original_distance > current_distance:
151-
return 0.9 - (float(current_distance) / 30.0) + (float(self.gsc_killed.value) / 10.0)
151+
return (0.9 - (float(current_distance) / 30.0)) + (float(self.gsc_killed.value) / 10.0)
152152
if original_distance < current_distance:
153-
return -0.4 - (float(current_distance) / 30.0) + (float(self.gsc_killed.value) / 10.0)
153+
return (-0.4 - (float(current_distance) / 30.0)) + (float(self.gsc_killed.value) / 10.0)
154154
return + (float(self.gsc_killed.value) / 10.0)
155155

156156
fun manhattan_distance(Int x1, Int x2, Int y1, Int y2) -> Int:

tool/rlc/test/examples/space_hulk/main.rl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,12 @@ fun gen_printer_parser():
138138

139139
fun main() -> Int:
140140
let state = play()
141-
print_indented(state)
141+
let x : UnitArgType
142+
x = 0
143+
let gs : UnitArgType
144+
gs = 1
145+
let m : DirectionArgType
146+
m.value = Direction::right.value
142147
state.shoot(x, gs)
143148
state.quit()
144149
state.quit()
@@ -244,7 +249,9 @@ fun main() -> Int:
244249
state.end_move()
245250
state.quit()
246251
state.quit()
252+
print_indented(state)
247253
state.board.pretty_print_board()
254+
print(state.board.score())
248255
return int(state.is_done()) - 1
249256

250257
fun test_enumerate() -> Bool:

0 commit comments

Comments
 (0)