 		painter.drawBendRails start, start.compound(@exitTransform()), @flip
 		super painter, start
 
+	clone: (newsection) ->
+		result = new Bend(@)
+		result.setSection newsection
+		result
+
 class Split extends Piece
 	setSection: (section) ->
 		@connections.B =


	_sectionStartingIndex: (section) ->
		result=0
		for idx in [0...@_sections.indexOf(section)]
			do (idx) =>
				result+=@_sections[idx]._pieces.length
		result

	_index: (piece) ->

		painter.drawStraight start, @.size
		painter.drawStraightRails start, @.size
		super painter, start

	clone: (newsection) ->
		result = new Straight(@)
		result.setSection newsection
		result

class Bend extends Piece
	setSection: (section) ->
