I need help to fix or create a motion sensor program and other stuff

Greetings everyone, I would really need a hand with my project, can you please help me write it down?
The program consists in a motion sensor (pir) that once activated turns on a LED and makes the buzzer sound, and in the time it is on it creates a random sequence of LED (that will be replaced later with pression piezoresistent sensors), once the random sequence will end, the buzzer marks the end and the sensor goes off.
Thank you very much for helping.

// Define connection pins:
#define buzzerPin 5
#define pirPin 2
#define ledGreen 4
#define ledPin 8
#define ledPin 9
#define ledPin 10
#define ledPin 11
#define ledPin 12

int seq[10];

// Create variables:

int val = 0;
bool motionState = false; // We start with no motion detected.
void setup() {
// Configure the pins as input or output:
pinMode(5, OUTPUT);
pinMode(4, OUTPUT);
pinMode(2, INPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
// Begin serial communication at a baud rate of 9600:


//genero la sequenza di numeri casuali tra 1 e 4
for (int i = 0; i < sizeof(seq); i++)
seq[i] = random(8,13);
void loop() {
// Read out the pirPin and store as val:
val = digitalRead(pirPin);
// If motion is detected (pirPin = HIGH), do the following:
if (val == HIGH) {
digitalWrite(ledGreen, HIGH); // Turn on the on-board LED.
alarm(500, 1000); // Call the alarm(duration, frequency) function.
delay(1000); //ritardo attivazione led da lettura sensore
// Change the motion state to true (motion detected):
if (motionState == false) {
Serial.println(“Motion detected!”);
motionState = true;

for (int i = 0; i < sizeof(seq); i++)

digitalWrite(seq[i], HIGH);
delay(1000);// delay accensione tra led
if (motionState = false)break; // DA PROVARE
if (motionState = true)continue;//DA PROVARE
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
digitalWrite(12, LOW);


// If no motion is detected (pirPin = LOW), do the following:
else {
digitalWrite(ledGreen, LOW); // Turn off the on-board LED.
noTone(buzzerPin); // Make sure no tone is played when no motion is detected.
// Change the motion state to false (no motion):
if (motionState == true) {
Serial.println(“Motion ended!”);
motionState = false;

//spengo tutti i led



// Function to create a tone with parameters duration and frequency:
void alarm(long duration, int freq) {
tone(buzzerPin, freq);