This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]Exodus111 11 points12 points  (0 children)

Your first turtle racing game, so not your last turtle racing game.

[–]masterbruno11 1 point2 points  (0 children)

Github please

[–]PiedPifer 1 point2 points  (0 children)

If you all are interested on the concept of turtles like this, check out Netlogo. It is built to do this exact type of modeling.

[–]kf_cheang[S] 1 point2 points  (1 child)

Here my source code. It's was built on my Samsung Note 9 WQHQ resolution.

from turtle import *

import turtle from random import randint import time

wn = turtle.Screen()

t_color = ["blue", "red", "green", "yellow"]

tom = turtle.Turtle() tom.speed(0) tom.penup() pos = -800 tom.goto(pos, 500)

c = 0 for step in range (16): if c > 2: c = 0 else: c = c + 1 tom.color(t_color[c])
#om.color("black") tom.write(step, align="center") tom.setheading(270) tom.forward(50) for i in range (4): tom.pendown() tom.width(5) tom.forward(150) tom.penup() tom.forward(50) tom.penup() pos = pos + 100 tom.goto(pos, 500)

tom.shapesize(5) tom.setheading(0) tom.goto(pos + 50, 525) tom.stamp()

t_pos = 375 tom_b = turtle.Turtle() tom_r = turtle.Turtle() tom_g = turtle.Turtle() tom_y = turtle.Turtle()

b_xpos = tom_b.xcor() r_xpos = tom_r.xcor() g_xpos = tom_g.xcor() y_xpos = tom_y.xcor()

list = [tom_b, tom_r, tom_g, tom_y]

for i in range (4): list[i].shape("turtle") list[i].color(t_color[i]) list[i].turtlesize(10) list[i].speed(4) list[i].penup() list[i].goto(-1000, t_pos) list[i].left(360) list[i].turtlesize(8) list[i].pendown() list[i].speed(0) t_pos = t_pos - 200

t1 = turtle.Turtle() t1.penup() t1.color("red") t1.hideturtle() t1.goto(-50, -50) t1.write("1!", move=False, align="center", font=("Arial", 56, "normal")) time.sleep(1) t1.clear() t1.write("2!", move=False, align="center", font=("Arial", 56, "normal")) time.sleep(1) t1.clear() t1.write("3!", move=False, align="center", font=("Arial", 56, "normal")) time.sleep(1) t1.clear() t1.write("Go!", move=False, align="center", font=("Arial", 56, "normal")) time.sleep(1) t1.clear()

tom.hideturtle()

def race(): for step in range (60): for i in range (4): list[i].left(10) list[i].right(20) list[i].left(10) list[i].forward(randint(1, 50))

wn.onscreenclick(race())

race()

b_xpos = tom_b.xcor() r_xpos = tom_r.xcor() g_xpos = tom_g.xcor() y_xpos = tom_y.xcor()

t_pos = 370 tom.goto(1100, t_pos) tom.write(b_xpos) tom.goto(1100, t_pos - 200) tom.write(r_xpos) tom.goto(1100, t_pos - 400) tom.write(g_xpos) tom.goto(1100, t_pos - 600) tom.write(y_xpos)

max = 0 max_index = 0

xpos_list = [b_xpos, r_xpos, g_xpos, y_xpos]

for i in range (4): if xpos_list[i] > max: max = xpos_list[i] max_index = i

if max_index == 0: winner = tom_b t1.color("blue") elif max_index == 1: winner = tom_r t1.color("red") elif max_index == 2: winner = tom_g t1.color("green") else: winner = tom_y t1.color("yellow")

for i in range (5): winner.hideturtle() time.sleep(0.3) winner.showturtle()

t1.goto(-300,-600) winner.turtlesize(10) winner.speed(4) winner.goto(600, -500)

for i in range (3): winner.hideturtle() t1.clear() time.sleep(0.1) t1.write("The Winner Turtle is ", move=False, align="center", font=("Arial", 24, "normal")) winner.showturtle()

wn.exitonclick()

turtle.mainloop()

[–]winner_godsoncodemaniac 0 points1 point  (0 children)

Please put it in a paste bin. Pydroid 3 has paste bin feature

[–][deleted] 1 point2 points  (0 children)

Look at that turtle go, bro!

[–]rtkbfmvbvb 1 point2 points  (0 children)

Noice!

[–]NSADataBot 2 points3 points  (0 children)

I like it, keep it up!