def __init__(self, maze_file_name):
     rows_in_maze = 0
     columns_in_maze = 0
     self.maze_list = []
     maze_file = open(maze_file_name,'r')
     rows_in_maze = 0
     for line in maze_file:
         row_list = []
         col = 0
         for ch in line[:-1]:
             row_list.append(ch)
             if ch == 'S':
                 self.start_row = rows_in_maze
                 self.start_col = col
             col = col + 1
         rows_in_maze = rows_in_maze + 1
         self.maze_list.append(row_list) 
         columns_in_maze = len(row_list)
     self.rows_in_maze = rows_in_maze
     self.columns_in_maze = columns_in_maze
     self.x_translate = - columns_in_maze / 2
     self.y_translate = rows_in_maze / 2
     self.t = turtle(shape = 'turtle')
     setup(width = 600, height = 600)
     setworldcoordinates(- (columns_in_maze - 1) / 2 - .5, - (rows_in_maze - 1) / 2 - .5, (columns_in_maze - 1) / 2 + .5,    (rows_in_maze - 1) / 2 + .5) 
    def __init__(self):  #initialization upon creation
        #message type initialziation
        self.turtle_pose = Pose()
        self.turtle = turtle()
        self.turtles = turtle_array()
        self.name_dict = {}  #name_dict: name<->index
        self.turtle_change = True
        self.vel_sub = rospy.Subscriber('drive', TwistStamped,
                                        self.drive_callback)
        self.change_pub = rospy.Publisher('change', Int8, queue_size=1)

        self.pose_server = rospy.Service('setpose', setpose, self.set_pose)
        self.pose_server = rospy.Service('setcolor', setcolor, self.set_color)
        self.pose_server = rospy.Service('addturtle', addturtle,
                                         self.add_turtle)
        self.pose_server = rospy.Service('removeturtle', removeturtle,
                                         self.remove_turtle)
__author__ = 'cclif'

from turtle import *
canvas = Screen()
canvas.setup(400, 400)
t = turtle()
for x in range(4):
    t.circle(100)
    t.left(90)

canvas.exitonclick()
Example #4
0
from turtle import *

scoreTurtle = turtle()
myScreen = scoreTurtle.getscreen()
scoreTurtle.penup()
scoreTurtle.goto(myScreen.window_width() / 2 - 200, myScreen.window_width()/2-5
scoreTurtle.hideturte()
s

Example #5
0
def wholeShebang(n, Graphic):
    if Graphic == False:
        return fullThing(n)
    else:
        turtle(n)
Example #6
0
import turtle
p=turtle()

p.rt(90)
p.fd(200)
p.lt(90)
p.circle(200)
p.lt(90)

i=0
while i<36:

p.rt(85)
p.fd(34.86)
p.rt(180)
p.fd(34.86)
p.rt(95)

p.rt(80)
p.fd(69.46)
p.rt(180)
p.fd(69.46)
p.rt(100)

p.rt(75)
p.fd(103.53)
p.rt(180)
p.fd(103.53)
p.rt(105)

p.rt(70)
Example #7
0
from turtle import *
import math

# Name your Turtle.
crush = Turtle()
color = input("What color would you like?")
sides = input("How many sides do you want")
steps = input("How big would you like the shape?")
# Set Up your screen and starting position.
setup(500, 300)
xpos = 0
ypos = 0
crush.setposition(xpos, ypos)

### Write your code below:
crush.pencolor(color)
crush.pendown()


def turtle(steps, sides):
    crush.begin_fill()
    crush.fillcolor(color)
    for shape in range(int(sides)):
        crush.forward(int(steps))
        crush.left(360 / int(sides))
    crush.end_fill()


turtle(steps, sides)
exitonclick()
Example #8
0
#https://www.geeksforgeeks.org/turtle-programming-python/
from turtle import *  #Inside_Out
t = turtle()
t.color("#1A1A1A")
t.pensize(10)
t.speed(1)

turtle.setposition(0, 0)
t.circle(50)

t.penup()
t.setposition(-110, 0)
t.pendown()
t.color("#0000FF")
t.circle(50)

t.penup()
t.setposition(60, -60)
t.pendown()
t.color("#06FC24")
t.circle(50)

t.penup()
t.setposition(-60, -60)
t.pendown()
t.color("#F5FF00")
t.circle(50)

t.penup()
t.setposition(110, 0)
t.pendown()
def main():
    turtle(8)
Example #10
0
import turtle
#def pieChart(flist):
    COL = ['red','yellow','blue','green','purple']
    total = 0
    flist = [1,4,5,6,7]
    for i in range(0,5):
        total += flist[i]
    print(total)
    r = 200

    pie = turtle()
    pie.penup()
    pie.sety(-r)
    pie.pendown()
    for i in range(0,5):
        for frac in flist:
            pie.fillcolor(COL[i])
            pie.begin_fill()
            pie.circle(r, frac * 360 /total)
            pos = pie.position()
            pie.goto(0,0)
            pie.end_fill()
            pie.setposition(position)

pie.hideturtle()
Example #11
0
from mc import *
from turtle import *

mc = Minecraft()

t = new turtle()

mc.postToChat("Hello world!")

playerPos = mc.player.getPos()
mc.setBlock(playerPos.x,playerPos.y-1,playerPos.z,MUSHROOM_RED)

# length = 2*2*2*2
# mc.setBlocks(playerPos.x,playerPos.y,playerPos.z,
#             playerPos.x+length-1,playerPos.y+length-1,playerPos.z+length-1,MUSHROOM_RED)


t.penblock(GOLD_BLOCK)
t.go(50)
t.right(90)
t.go(50)
t.right(90)
t.go(50)
t.right(90)
t.go(50)
Example #12
0
def setup(bot):
    bot.add_cog(turtle(bot))
Example #13
0
from turtle import *

boogie = turtle() 

boogie.color("pink")
boogie.pensize(7)
boogie.speed(9)
boogie.shape("turtle")

moveforrw
Example #14
0
import turtle

my_turtle = turtle.Turtle()
my_turtle.speed(0)


def turtle(lenth, angle):
    for i in range(4):
        my_turtle.forward(lenth)
        my_turtle.left(angle)


for i in range(100):
    turtle(100, 90)
    my_turtle.right(11)
Example #15
0
        turtle.fd(25)


def correct(turtle, word_dict, guess):
    total_guessed = 0
    for pos, c in word_dict.items():
        if (c == guess):
            turtle.pu()
            turtle.goto(pos[0], pos[1])
            turtle.write(c, True, align="center", font=("Arial", 30, "normal"))
            total_guessed += 1
    return total_guessed


print("Welcome to Hangman !!")
hangman = turtle(-250, -50, "black")
word = turtle(50, -50, "green")
init(hangman)
word_dict = take_word(word)

incorrect_guesses = 0
correct_guess = 0
guesses = []
while (correct_guess < len(word_dict.keys()) and incorrect_guesses < 6):
    print(guesses)
    character = input("Enter a character to guess ")
    if (len(character) != 1):
        print("Please enter only one character to guess")
        continue

    if (character in guesses):
 def __init__(self, isTurned):
     self.isTurned = isTurned
     self.stopped = False
     self.T = turtle()
Example #17
0
from turtle import *


def turtle(x, y, r, linec, fillc):
    setpos(x, y)
    color(linec, fillc)
    begin_fill()
    while True:
        forward(r)
        left(110)
        if abs(pos() - (x, y)) < 1:
            break
    end_fill()


from turtle import *

shape('turtle')
turtle(100, 100, 300, 'green', 'lightgreen')
#turtle(-100,-100,350)
done()
Example #18
0
from turtle import *

bob = turtle()
color('blue', 'red')
bob.pu()
bob.goto(0,0)
bob.pd()
begin_fill()
forward(55)
left(90)
forward(110)

done()
Example #19
0
for i in range(2,10):   #2~9단까지 반복
    for k in range(1,10):   # 각 단의 뒷자리 숫자 1~9까지 반복
        print(f'{i} X {k} = {i*k}') #구구단 형식 출력
    print()             # 각 단이 끝나면 한 줄 띄우려고 작성


--
# 터틀 그래픽스 모듈로 그림 그리기

    <형식>
    import turtle
    또는
    import turtle as t  # t라는 별칭, turtle 대신 쓸수 있음


    거북이 모양 : arrow(화살표), triangle(삼각형), circle(원), blank(빈칸), turtle(거북이)
                  생략하면 기본 화살표 모양

--
ex) 사각형 그리기

import turtle as t # 별칭 t를 가진 터틀 라이브러리는 불러온다.

t.shape('turtle')       #마우스(화살표)  모양을 turtle로 바꾸겟다.

for i in range(4):      # 4번 반복하겠다.
    t.right(90)         # 오른쪽으로 90도 회전
    t.forward(100)      # 이동. 100px
                        # 사각형이 그려짐
--
from turtle import *

Turtle = new turtle()
Example #21
0
from turtle import *


def turtle():
    for i in range(3):
        print("Hello world")


turtle()
# 터틀 그래픽스 모듈로 그림 그리기

import turtle
또는
import turtle as t --> 별칭을 t로 정함

거북이 모양 : arrow(큰 화살표), triangle(삼각형), circle(원), blank(빈칸), turtle(거북이), 생략하면 기본화살표 

앞으로 이동 : forward, fd
뒤로 이동 : backward, bk, back
왼쪽으로 회전 : left, lt
오른쪽으로 회전 : right, rt


ex)
import turtle as t
t.shape('turtle') # 거북이 모양
t.right(90)       # 오른쪽으로 90도 
t.forward(100)    # 앞으로 100픽셀 
t.right(90)     
t.forward(100)


ex) 사각형 그리기

import turtle as t

t.shape('arrow')  # 화살표모양
t.fd(100)         # 앞으로 100픽셀
t.rt(90)          # 오른쪽으로 90도
t.fd(100)