Question: In python: raspberry pi please Fun 0 ( 2 points ) . Two LEDs: LED _ R ( red ) and LED _ G (

In python: raspberry pi please
Fun 0(2 points). Two LEDs: LED_R (red) and LED_G (green); four push buttons: A_R, A_G, B_R, B_G; five LEDs (all yellow) labelled and positioned in an array as follows: [AAA AA AB BB BBB]. It is necessary that you put the components on your breadboard in the following order, from left to right:
\table[[A_R A_G,AAA AA AB BB BBB,LED_R LED_G,B_R B_G],[(player A buttons),(yellow LEDs),(red and green LEDs),(player B buttons)]]
The game has two players: Player A plays with buttons AR(for red) and AG(for green), and player B plays with buttons B_R (for red) and B_G (for green). Moreover, the left and right directions in the LED array are assigned to players A and B, respectively. Initially, the LED array status is [00100], and throughout the game one and only one light out of the five yellow LEDs is on at a time.
Fun 1(2 points). The program randomly turns one of the two LEDs, LED_R or LED_G, on while the other one remains off.
Players A and B push the corresponding buttons, AR and BR for LED_R, and AG and BG for LED_G. Whoever pushes the associated button earlier will get one point, which means that the 'on' yellow LED in the LED array [AAA AAABBBBBB shifts one step in favor of that player, as follows:
Fun 2(3 points). If player A pushes the associated button earlier, then:
Fun 3(3 points). If player B pushes the associated button earlier, then:
Fun 4(2 points). After 2(sec) delay, either LED_R or LEG_G randomly turn on again and the game resumes unless the GAME-OVER scenario occurs. LED_G turn on, simultaneously, which means that the game is over and player A or B, respectively, is the winner. Then, after 5(sec) delay, a new game starts and either LED_R or LEG_G randomly turn on again.
Fun 6(2 points). Program runs smoothly without any bugs for an arbitrary large number of steps.
Hint. In order to randomly turn on LED_R or LED_G, you need to randomly generate 0 or 1 as follows: Python program to randomly generate a 0 or 1
import random r=r andom. choice ([0,1])
print (r)
In python: raspberry pi please Fun 0 ( 2 points )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!