26 lines
590 B
Ruby
26 lines
590 B
Ruby
client = GameApiClient.new
|
|
turn1 = Turn.find_by(number: 1)
|
|
|
|
if turn1
|
|
puts "Processing Turn 1..."
|
|
res = client.api_calculate_process(turn1.game_state, turn1.orders || {})
|
|
|
|
if res
|
|
new_gs = res['game_state']
|
|
puts "Phase: #{new_gs&.dig('phase')}"
|
|
|
|
puts "Rendering new state..."
|
|
svg = client.api_render(new_gs, orders: nil)
|
|
|
|
if svg
|
|
File.write('test_render_turn2.svg', svg)
|
|
puts "Saved SVG to test_render_turn2.svg"
|
|
puts "SVG Sample: #{svg[0..100]}..."
|
|
else
|
|
puts "Render failed."
|
|
end
|
|
else
|
|
puts "Process failed."
|
|
end
|
|
end
|