22 lines
648 B
Ruby
22 lines
648 B
Ruby
client = GameApiClient.new
|
|
turn1 = Turn.find_by(number: 1)
|
|
|
|
if turn1
|
|
puts "Calling api_calculate_process..."
|
|
res = client.api_calculate_process(turn1.game_state, turn1.orders || {})
|
|
|
|
if res
|
|
File.write('api_process_response.json', JSON.pretty_generate(res))
|
|
puts "Saved full response to api_process_response.json"
|
|
|
|
# また、現在のTurn 2のgame_stateの中身も確認
|
|
t2 = Turn.find_by(number: 2)
|
|
if t2
|
|
File.write('db_turn2_game_state.json', JSON.pretty_generate(t2.game_state))
|
|
puts "Saved Turn 2 game_state from DB to db_turn2_game_state.json"
|
|
end
|
|
else
|
|
puts "Process failed."
|
|
end
|
|
end
|