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

Username:   Password: 
 RegisterRegister   
 Traffic Intersection
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
hamza.swag




PostPosted: Thu May 01, 2014 10:28 pm   Post subject: Traffic Intersection

How do i do left turn signal either as a flashing green mode and pedestrian walk / do not walk signals.
Please help me ...
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Thu May 01, 2014 10:31 pm   Post subject: RE:Traffic Intersection

Have you tried anything?
hamza.swag




PostPosted: Thu May 01, 2014 10:40 pm   Post subject: RE:Traffic Intersection

I don't know how to do that.
Its summative project and i have been trying for this for past week but still i dont get it
Tony




PostPosted: Thu May 01, 2014 10:58 pm   Post subject: Re: RE:Traffic Intersection

hamza.swag @ Thu May 01, 2014 10:40 pm wrote:
i have been trying for this for past week

What have you tried during that week?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
hamza.swag




PostPosted: Fri May 02, 2014 12:51 am   Post subject: RE:Traffic Intersection

I am new to this turing programming so i don't know properly ...
I did pretty good job in hardware assignment and now i have to write the code of the hardware assignment in turing and now i have to write the code of pedestrial signals and flashing green mode
Tony




PostPosted: Fri May 02, 2014 1:49 am   Post subject: RE:Traffic Intersection

it sounds like you are looking for parallelput (read the linked documentation for examples); but it's really hard to say, since you are not saying what you've been doing so far.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
hamza.swag




PostPosted: Fri May 02, 2014 2:56 pm   Post subject: RE:Traffic Intersection

Now, Can you help me to make pedestrial signals and not walk signals
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
Tony




PostPosted: Fri May 02, 2014 3:27 pm   Post subject: RE:Traffic Intersection

Quote:

var Green : int := 1
var Yellow : int := 2
var Red : int := 5

Have you tested out the wiring for Red? Seems that it would also set the bit for Green.

Once you have your traffic lights, pedestrian signs are just... more lights (imagine a traffic light with 4th and 5th colours).

green = 1
yellow = 2
red = 4
walk = 8
dont_walk = 16
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
hamza.swag




PostPosted: Fri May 02, 2014 3:36 pm   Post subject: RE:Traffic Intersection

then how can i make a signal for left and right turns?
And can you help me to add pedestrial code and left and right signal code in my code please
Tony




PostPosted: Fri May 02, 2014 4:28 pm   Post subject: RE:Traffic Intersection

See parallelput -- you get 8 distinct pins to wire up.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
hamza.swag




PostPosted: Fri May 02, 2014 9:46 pm   Post subject: RE:Traffic Intersection

can you write me a program for that please
Insectoid




PostPosted: Fri May 02, 2014 10:13 pm   Post subject: RE:Traffic Intersection

Nope.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: