フロントエンドプレイアブル
This commit is contained in:
36
check_units.rb
Normal file
36
check_units.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
def get_units_from_gs(gs)
|
||||
return {} if gs.nil?
|
||||
# powers[power_name]['units'] に入っていると想定
|
||||
units = {}
|
||||
if gs['powers'].is_a?(Hash)
|
||||
gs['powers'].each do |power, data|
|
||||
units[power] = data['units']
|
||||
end
|
||||
end
|
||||
units
|
||||
end
|
||||
|
||||
t1 = Turn.find_by(number: 1)
|
||||
t2 = Turn.find_by(number: 2)
|
||||
|
||||
puts "--- Turn 1 (SPRING 1901 MOVEMENT) Units ---"
|
||||
u1 = get_units_from_gs(t1&.game_state)
|
||||
puts u1.inspect
|
||||
|
||||
puts "\n--- Turn 2 (FALL 1901 MOVEMENT) Units ---"
|
||||
if t2
|
||||
u2 = get_units_from_gs(t2.game_state)
|
||||
puts u2.inspect
|
||||
|
||||
puts "\nDifference detected?"
|
||||
if u1 == u2
|
||||
puts "NO CHANGE in unit positions!"
|
||||
else
|
||||
puts "Unit positions HAVE CHANGED."
|
||||
end
|
||||
|
||||
puts "\nTurn 1 Orders stored in DB:"
|
||||
puts t1.orders.inspect
|
||||
else
|
||||
puts "Turn 2 not found."
|
||||
end
|
||||
Reference in New Issue
Block a user