save_results = function()
	if Results_filename == nil then return end
	print('saving to '..Results_filename)
	local f, err = App.open_for_writing(Results_filename)
	if err then error(err) end
	for _,result in ipairs(Global_state.results) do
		f:write(('%s beat %s\n'):format(result[1], result[2]))
	end
	f:close()
end