Last edit: @pjha in <!error getting other user for D7SC58AD8> 2 years ago - Slack Archive

{lua}function calc_width_top_floor (level, size)
	local i
	local j
	local width

	width = 3
	i = 0
	while size - level > i do
		j = i + 3
		while j > 0 do
			width = width + 2
			j = j - 1
		end
		width = width + (2 * (i / 2 + 2))
		i = i + 1
	end
	return width
end

function calc_space_top_floot (level, size)
	local i
	local j
	local space

	space = (2 * (size + 1) + calc_width_top_floor(1, size)) / 2 - 1
	i = 0
	while size - level > i do
		j = i + 3
		while j > 0 do
			space = space - 1
			j = j - 1
		end
		space = space + (-2 - i / 2)
		i = i + 1
	end
	return space
end
print(calc_space_top_floot(4, 5))

History

Revision: 2479 by @pjha in <!error getting other user for D7SC58AD8> 2 years agoSlack Archive

{lua}function calc_width_top_floor (level, size)
	local i
	local j
	local width

	width = 3
	i = 0
	while size - level > i do
		j = i + 3
		while j > 0 do
			width = width + 2
			j = j - 1
		end
		width = width + (2 * (i / 2 + 2))
		i = i + 1
	end
	return width
end

function calc_space_top_floot (level, size)
	local i
	local j
	local space

	space = (2 * (size + 1) + calc_width_top_floor(1, size)) / 2 - 1
	i = 0
	while size - level > i do
		j = i + 3
		while j > 0 do
			space = space - 1
			j = j - 1
		end
		space = space + (-2 - i / 2)
		i = i + 1
	end
	return space
end
print(calc_space_top_floot(4, 5))

Revision: 2478 by @pjha in <!error getting other user for D7SC58AD8> 2 years agoSlack Archive

{lua}function calc_space_top_floot (level, size)
	local i
	local j
	local space

	space = (2 * (size + 1) + calc_width_top_floor(1, size)) / 2 - 1
	i = 0
	while size - level > i do
		j = i + 3
		while j > 0 do
			space = space - 1
			j = j - 1
		end
		space = space + (-2 - i / 2)
		i = i + 1
	end
	return space
end
print(calc_space_top_floot(3, 5))

Revision: 2477 by @pjha in <!error getting other user for D7SC58AD8> 2 years agoSlack Archive

{lua}function calc_width_top_floor (level, size)
	local i
	local j
	local width

	width = 3
	i = 0
	while size - level > i do
		j = i + 3
		while j > 0 do
			width = width + 2
			j = j - 1
		end
		width = width + (2 * (i / 2 + 2))
		i = i + 1
	end
	return width
end
print(calc_width_top_floor(4, 5))