Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 I need help with a traffic signal project I have for a class
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
codinghelpwanted




PostPosted: Wed May 28, 2014 4:56 pm   Post subject: I need help with a traffic signal project I have for a class

What is it you are trying to achieve?
I am trying to achieve the coding for the project.

What is the problem you are having?
The problem I am having is that I don't know how to code and I can fail my course If I don't get it working.
I am will to pay someone to get the code working. But it also needs a left turn signal with another led and its proper code.


Describe what you have tried to solve this problem
I have worked on some part of the code.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:


var winID : int
winID := Window.Open ("graphics:maxx,maxy")
var x1, y1, clr1 : int
for : 1 .. 20
x1 := Rand.Int (0, maxx)
y1 := Rand.Int (0, maxy)
end for
cls
locatexy (150, 250)
put "Press any key start this program "
locatexy (150, 230)
var ch : char := getchar
Window.Close (winID)
var winID2 : int
winID2 := Window.Open ("graphics:900,680")
delay (1000)
View.Set ("graphics:750;550")
drawfillbox (0, 0, 640, 480, green)

View.Set ("graphics:640;480")
drawfillbox (0,0,640,480,green)

%Road (Black)
drawfillbox (0,130,640,350,7)
drawfillbox (200,0,450,480,7)

%Road Lines
drawfillbox (0,280,30,290,0)
drawfillbox (0,200,30,210,0)
drawfillbox (40,280,70,290,0)
drawfillbox (40,200,70,210,0)
drawfillbox (80,280,110,290,0)
drawfillbox (80,200,110,210,0)
drawfillbox (120,280,150,290,0)
drawfillbox (120,200,150,210,0)
drawfillbox (160,280,190,290,0)
drawfillbox (160,200,190,210,0)

drawfillbox (460,280,490,290,0)
drawfillbox (460,200,490,210,0)
drawfillbox (500,280,530,290,0)
drawfillbox (500,200,530,210,0)
drawfillbox (540,280,570,290,0)
drawfillbox (540,200,570,210,0)
drawfillbox (580,280,610,290,0)
drawfillbox (580,200,610,210,0)
drawfillbox (620,280,650,290,0)
drawfillbox (620,200,650,210,0)

drawfillbox (370,0,380,30,0)
drawfillbox (280,0,290,30,0)
drawfillbox (370,40,380,70,0)
drawfillbox (280,40,290,70,0)
drawfillbox (370,80,380,110,0)
drawfillbox (280,80,290,110,0)
drawfillbox (370,360,380,390,0)
drawfillbox (280,360,290,390,0)
drawfillbox (370,400,380,430,0)
drawfillbox (280,400,290,430,0)
drawfillbox (370,440,380,470,0)
drawfillbox (280,440,290,470,0)

%Side Walk
drawfillbox (0,96,199,129,darkgrey)
drawfillbox (166,0,199,129,darkgrey)
drawfillbox (0,100,195,125,grey)
drawfillbox (170,0,195,125,grey)

drawfillbox (0,351,199,385,darkgrey)
drawfillbox (166,355,199,480,darkgrey)
drawfillbox (0,355,195,380,grey)
drawfillbox (170,355,195,480,grey)

drawfillbox (451,100,645,129,darkgrey)
drawfillbox (451,0,485,125,darkgrey)
drawfillbox (455,100,640,125,grey)
drawfillbox (455,0,480,125,grey)

drawfillbox (451,351,645,385,darkgrey)
drawfillbox (451,355,485,480,darkgrey)
drawfillbox (455,355,640,380,grey)
drawfillbox (455,355,480,480,grey)

%Traffic Light
%middle left
drawfillbox (90,220,200,270,43)
drawfilloval (110,245,15,15,7)
drawfilloval (145,245,15,15,7)
drawfilloval (180,245,15,15,7)
%middle right
drawfillbox (450,220,560,270,43)
drawfilloval (470,245,15,15,7)
drawfilloval (505,245,15,15,7)
drawfilloval (540,245,15,15,7)
%middle bottom
drawfillbox (305,20,355,130,43)
drawfilloval (330,40,15,15,7)
drawfilloval (330,75,15,15,7)
drawfilloval (330,110,15,15,7)
%middle top
drawfillbox (305,345,355,455,43)
drawfilloval (330,365,15,15,7)
drawfilloval (330,400,15,15,7)
drawfilloval (330,435,15,15,7)

%parallelput (Green)
var Green : int := 1
var Yellow : int := 2
var Red : int := 5
var status : int
status := Green


%Green light
drawfilloval (330,365,15,15,green)
%Yellow Light
drawfilloval (330,400,15,15,7)
%Red Light
drawfilloval (330,435,15,15,7)


%statements on changing lights
if status = Green then
drawfilloval (330,365,15,15,7)
delay (5000)
parallelput (Yellow)
status := Yellow
drawfilloval (473, 385, 10, 10, Yellow)
elsif status = Yellow then
delay (2000)
parallelput (Red)
status := Red
drawfilloval (473, 410, 10, 10, Red)
elsif status = Red then
delay (5000)
parallelput (Green)
status := Green
drawfilloval (473, 360, 10, 10, Green)
end if



Please specify what version of Turing you are using
4.1
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed May 28, 2014 9:21 pm   Post subject: Re: I need help with a traffic signal project I have for a class

codinghelpwanted @ Wed May 28, 2014 4:56 pm wrote:

The problem I am having is that I don't know how to code

The solution is pretty straight forward -- learn. You have years of experience learning different things, don't you? An excellent place to start is the Turing Walkthrough. Start at the top, and work you way through the topics. You can just read the material you are already familiar with to refresh your knowledge, but working through some examples would be really helpful for new chapters.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: