• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python turtle.right函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中turtle.right函数的典型用法代码示例。如果您正苦于以下问题:Python right函数的具体用法?Python right怎么用?Python right使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了right函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: alpha_beta_helper

def alpha_beta_helper():
	global state, root, alpha_time
	initialize()
	print("PLEASE WAIT!!!")
	root = TreeNode(-1000)
	time1 = time.time()
	alpha_beta(root, 1, state)
	init_screen()
	drawLine()
	drawGrid()
	drawColumns()
	drawRows()
	caliberate()
	col = root.ans
	row = -1
	turtle.onscreenclick(goto)
	for i in range(4):
		if state[i][col] == 0:
			row = i
			break
	state[row][col] = 1
	drawDot(row, col, 1)
	var = (int)(input("Enter 1 to continue playing or 0 to stop."))
	time2 = time.time()
	alpha_time = time2-time1
	if(var == 1):
		turtle.clear()
		turtle.goto(0, 0)
		turtle.penup()
		turtle.right(270)
		alpha_beta_helper()
	else:
		write_analysis(3)
开发者ID:krnbatra,项目名称:AI-Assignments,代码行数:33,代码来源:assign2.py


示例2: initBannerCanvas

def initBannerCanvas( numChars, numLines ):
    """
    Set up the drawing canvas to draw a banner numChars wide and numLines high.
    The coordinate system used assumes all characters are 20x20 and there
    are 10-point spaces between them.
    Postcondition: The turtle's starting position is at the bottom left
    corner of where the first character should be displayed.
    """
    # This setup function uses pixels for dimensions.
    # It creates the visible size of the canvas.
    canvas_height = 80 * numLines 
    canvas_width = 80 * numChars 
    turtle.setup( canvas_width, canvas_height )

    # This setup function establishes the coordinate system the
    # program perceives. It is set to match the planned number
    # of characters.
    height = 30 
    width = 30  * numChars
    margin = 5 # Add a bit to remove the problem with window decorations.
    turtle.setworldcoordinates(
        -margin+1, -margin+1, width + margin, numLines*height + margin )

    turtle.reset()
    turtle.up()
    turtle.setheading( 90 )
    turtle.forward( ( numLines - 1 ) * 30 )
    turtle.right( 90 )
    turtle.pensize( 2 * scale)
开发者ID:jonobrien,项目名称:School_Backups,代码行数:29,代码来源:spell_out.py


示例3: hang

def hang():
	turtle.speed(0)
	if stage[0]==0:
		go_to(-300,0,0)
		turtle.forward(600)
		go_to(-100,0, 90)
		turtle.forward(200)
		turtle.right(90)
		turtle.forward(100)
		turtle.right(90)
		turtle.forward(25)
	elif stage[0]==1:
		go_to(0, 150, 0)
		turtle.circle(12.5)
	elif stage[0]==2:
		go_to(0,150, -90)
		turtle.forward(50)
	elif stage[0]==3:
		go_to(0,140, -45)
		turtle.forward(25)
		go_to(0,140, -135)
		turtle.forward(25)
	elif stage[0]==4:
		go_to(0,100, -45)
		turtle.forward(25)
		go_to(0,100, -135)
		turtle.forward(25)
	stage[0]+=1
	return 0
开发者ID:BCasaleiro,项目名称:Hangman,代码行数:29,代码来源:hangman.py


示例4: draw_star

def draw_star(size, color):

    turtle.pendown()
    turtle.begin_fill()
    turtle.color(1,1,1)
    turtle.forward(2.5) 
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.forward(2.5)
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.forward(2.5)
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.forward(2.5)
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.forward(2.5)
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.end_fill()
    turtle.penup()
开发者ID:mukasama,项目名称:portfolio,代码行数:27,代码来源:Project++04.py


示例5: draw_fractal4

def draw_fractal4(turtle, size):
	for i in range(1,5):
		for i in range(1,3):
			draw_fractal3(turtle, size)
			turtle.forward(size * 27)
		turtle.forward(size * 27)
		turtle.right(90)
开发者ID:csgray,项目名称:IPND_lesson_3,代码行数:7,代码来源:sierpinski_carpet.py


示例6: demo

def demo():
    turtle.forward(100)
    turtle.left(120)
    turtle.forward(80)
    turtle.right(90)
    turtle.forward(80)
    turtle.exitonclick()
开发者ID:PurplePenguin4102,项目名称:stuff,代码行数:7,代码来源:turtle1.py


示例7: star

def star( x, y, scale, fill, color ):
	'''draws a star given location, scale, and color'''
	goto( x, y )
	
	if fill == "True":
		'''if the scale is 1, and fill == True
			then this function will draw a star 
			with its left point at (x,y) and
			will have star ray lengths of 50
			and filled with the color given'''
		t.begin_fill()
		t.color(color)
		for i in range(10):
			t.forward(50*scale)
			t.right(108)
			t.forward(50*scale)
			t.left(144)
		t.end_fill()
	else: 
		'''if the scale is 1, and fill == False
			then this function will draw a star 
			with its left point at (x,y) and
			will have star ray lengths of 50
			and with no color fill'''
		t.begin_fill()
		for i in range(10):
			t.forward(50*scale)
			t.right(108)
			t.forward(50*scale)
			t.left(144)
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:30,代码来源:better_shapelib.py


示例8: draw_tree

def draw_tree(depth, height, branches, leafs, angle):
    """
    Draws the tree using recursion
    :pre: pos(0,0), heading east, up
    :post: pos(0,0), heading east, up
    :param depth: number of layers of sub branches (recursion depth)
    :param height: height of tree
    :param branches: number of branches
    :param leafs: number of leafs
    :param angle: angle between branches
    :return: None
    """
    if depth == 0:
        leafs = random.randint(0, leafs)
        draw_leaf(leafs)
        t.down()
        pass

    else:
        t.color('brown')
        t.forward(height)
        for i in range(1, branches+1):
            t.left(90 - i * angle)
            #random branches
            branches = random.randint(branches-1,branches+5)
            draw_tree(depth - 1, height * HEIGHT_FACTOR, branches, leafs, angle)
            t.right(90 - i * angle)
            #random angle
            angle = random.randint(angle-1, angle+1)
            if depth == 1:
                break
        t.color('brown')
        t.backward(height)
开发者ID:AnushaBalusu,项目名称:PythonCodes,代码行数:33,代码来源:enhanced_tree.py


示例9: draw_leaf

def draw_leaf(no_of_leafs):
    """
    Draws leafs at the end of branch. Min 0 and max = no_of_leafs
    :pre: pos(0,0), heading east, up
    :post: pos(0,0), heading east, up
    :param no_of_leafs: maximum number of leads drawn
    :return: None
    """
    for i in range(no_of_leafs):
        # draws random poylgon from triangle to hexagon
        sides = random.randint(3, 6)
        color = random.choice(COLORS)
        size = 10
        angle = 360/sides
        t.left(90 - i * angle)
        t.right(90)
        t.begin_fill()
        t.down()
        t.color(color)
        for _ in range(sides):
            t.forward(size)
            t.left(angle)
        t.left(90)
        t.up()
        t.end_fill()
        t.right(90 - i * angle)

    global LEAF_COUNTER
    LEAF_COUNTER += 1
开发者ID:AnushaBalusu,项目名称:PythonCodes,代码行数:29,代码来源:enhanced_tree.py


示例10: drawMyTree

def drawMyTree(trunk):
    """
    Draws the tree of type MyTree
    :pre: (relative) pos (0,0), heading (north), up
    :post: (relative) pos (0,0), heading (north), up
    :return: height of tree
    """
    drawTrunk(trunk)
    turtle.right(60)
    turtle.forward(30)
    turtle.left(60)
    turtle.forward(60)
    turtle.left(60)
    turtle.forward(30)
    turtle.left(60)
    turtle.forward(30)
    turtle.left(60)
    turtle.forward(60)
    turtle.left(60)
    turtle.forward(30)
    turtle.right(60)
    turtle.forward(trunk)
    turtle.left(90)
    height = trunk + (30 * (3 ** 0.5) + 60)
    return height
开发者ID:RIT-2015,项目名称:CPS,代码行数:25,代码来源:new_draw.py


示例11: robber_move

def robber_move(turtle):
    fifty_fifty = random.randrange(0, 2)
    if fifty_fifty == 0:
        turtle.right(90)
    else:
        turtle.left(90)
    turtle.forward(10)
开发者ID:guardhunt,项目名称:all_projects,代码行数:7,代码来源:Cop+Robber+Game.py


示例12: drawFins

def drawFins(size):
    
    turtle.fillcolor("red")    
    turtle.setheading(90)
    turtle.begin_fill()
    turtle.forward(0.2*size)
    turtle.left(120)
    turtle.forward(0.6*size) 
    turtle.right(120)
    turtle.forward(0.3*size) 
    turtle.right(40)
    turtle.forward(0.8*size)
    turtle.end_fill()    
    
    turtle.setheading(0)
    
    turtle.begin_fill()

    turtle.penup()
    turtle.forward(size)
    turtle.pendown()
    turtle.begin_fill()
    turtle.right(50)
    turtle.forward(0.8*size) 
    turtle.right(40)
    turtle.forward(0.3*size) 
    turtle.right(120)
    turtle.forward(0.6*size)
    turtle.end_fill()
开发者ID:rckc,项目名称:CoderDojoUWA2016,代码行数:29,代码来源:Peter+-+Space+Rocket.py


示例13: drawS

def drawS(length):
    """
    Draw English character 'S'
    :pre: (relative) pos (X,Y), heading (east), up
    :post: (relative) pos (X+length,Y), heading (east), up
    :return: None
    """
    turtle.up()
    turtle.left(90)
    turtle.forward(length)
    turtle.right(90)
    turtle.down()
    turtle.forward(length)
    turtle.right(180)
    turtle.forward(length)
    turtle.left(90)
    turtle.forward(length / 2)
    turtle.left(90)
    turtle.forward(length)
    turtle.right(90)
    turtle.forward(length / 2)
    turtle.right(90)
    turtle.forward(length)
    turtle.right(180)
    turtle.forward(length)
    turtle.up()
开发者ID:deepaksharma36,项目名称:Python-Assignements,代码行数:26,代码来源:typography.py


示例14: y_tree

def y_tree(length = 200):
    """
    This function receives a length and draws a tree according to the length
    in an angle 60 between the branches always reducing the next length by
    0.6. The drawing ends when the length is smaller than 10
    :param length: The length of the branch to draw, default 200
    :return: None
    """
    ANGLE_BETWEEN_BRANCHES = 60
    LENGTH_REDUCTION = 0.6
    MIN_LENGTH = 10


    if length <= MIN_LENGTH:
        return
    else:
        turtle.forward(length)                  # draws the branch
        turtle.left(ANGLE_BETWEEN_BRANCHES / 2)
        y_tree(LENGTH_REDUCTION * length)       # draws the left branch

        turtle.right(ANGLE_BETWEEN_BRANCHES)
        y_tree(LENGTH_REDUCTION * length)       # draws the right branch

        turtle.left(ANGLE_BETWEEN_BRANCHES / 2)
        turtle.backward(length)                 # returns back to draw next
开发者ID:Metushelah,项目名称:Python_Intro2cs_exercises,代码行数:25,代码来源:y_tree.py


示例15: plano2d

def plano2d():
  turtle.penup()

  for i in range(13):
    y = 264 - (44 *i)
    turtle.penup()
    turtle.setposition(-264,y)
    turtle.pendown()
    turtle.forward(528)
  
  turtle.right(90)

  for i in range(13):
    x = -264 + (44*i)
    turtle.penup()
    turtle.setposition(x,264)
    turtle.pendown()
    turtle.forward(528)
  
  turtle.penup()
  turtle.home()
  turtle.pendown()
  turtle.color("blue")         
  turtle.pensize(3)

  for i in range(4):
    grados = 90 * (i+1)
    turtle.home()
    turtle.left(grados)
    turtle.forward(264) 
开发者ID:joenco,项目名称:compiladorg,代码行数:30,代码来源:figuras.py


示例16: draw_square_and_circle

def draw_square_and_circle():
    window = turtle.Screen()
    window.bgcolor("red")
    
    count = 0
    while count < 4:
        turtle.position()
        turtle.forward(100)
        turtle.right(90)
        count = count + 1
    
    angie = turtle.Turtle()
    angie.shape("arrow")
    angie.color("blue")
    angie.circle(100)
    
    todd = turtle.Turtle()
    todd.shape("arrow")
    todd.color("green")
    
    todd_count = 0
    whilte todd_count < 3:
        todd.forward(300)
        todd.left(120)
        todd_count = todd_count + 1
开发者ID:Aliciawyse,项目名称:intro-programming-nanodegree,代码行数:25,代码来源:classes_notes.py


示例17: shape

def shape(length,sides):
	if sides < 3:
		sides =3
	angle = 360/sides
	for i in range(sides):
		t.forward(length)
		t.right(angle)
开发者ID:doraithodla,项目名称:Pyteach,代码行数:7,代码来源:tutil.py


示例18: f

def f(l, n):
	t.up()
	t.goto( - l / 2, l / 3 )
	t.down()
	for i in rang(3):
		vk(l, n)
		t.right(120)
开发者ID:richardjuan,项目名称:nmt,代码行数:7,代码来源:vonKoch.py


示例19: treeType

def treeType(type):
    """
    This function draws a tree randomly
    :param type: type is any integer between 1-3
    :pre: pos (0,0), heading (east), up
    :post: pos (100,0), heading (east), up
    :return: wood used to make the tree
    """
    global maxheight
    randvalue = 0
    if type == 1:
        randvalue = random.randint(50, 200)
        makeTrunk(randvalue)
        makePolygon(3, 50)
    if type == 2:
        randvalue = random.randint(50, 150)
        makeTrunk(randvalue)
        makePolygon(4, 50)
    if type == 3:
        randvalue = random.randint(50, 150)
        makeTrunk(randvalue)
        makePolygon(0, 25)

    t.right(90)
    t.forward(randvalue)
    t.left(90)
    t.forward(100)
    if randvalue + 50 > maxheight:
        maxheight = randvalue + 50
    return randvalue
开发者ID:lokesh91a,项目名称:Python-Codes,代码行数:30,代码来源:forest.py


示例20: circle

def circle(r, n, angle):
	turtle.seth(angle)
	a = 2*r*sin(pi/n)
	phi = 180*(1-2/n)
	for i in range(int(n/2)+1):
		turtle.forward(a)
		turtle.right(180-phi)
开发者ID:gunther-on-fire,项目名称:boris-the-parselmouth,代码行数:7,代码来源:spring.py



注:本文中的turtle.right函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python turtle.rt函数代码示例发布时间:2022-05-27
下一篇:
Python turtle.reset函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap