What does this code do?

Hello, i am new on this forum and complete beginner of arduino.
I would like to know what does this code do? Can you help me? I have to describe it.

/*
 *   PA0 on Seg4 A, PA1 on Seg4 B ... PA7 on Seg4 DP
 *  PB0 on Seg4
* PD0 on button 1
 */

#include <avr/io.h>
#include <util/delay.h>

#define  WY_1 0x06;
#define  WY_2 0x5b;
#define  WY_3 0x4f;
#define  WY_4 0x66;
#define  WY_5 0x6d;
#define  WY_6 0x7d;

int main(void)
{
	unsigned char i, n, l=0;

	DDRA = 0xff;
	PORTA = 0x7f;

	DDRB |= (1<<PB0);
	PORTB &= ~(1<<PB0);

	DDRD &= ~(1<<PD0);
	PORTD |= (1<<PD0);

	while(1)
	{
		while(PIND & 0x01) ++l;
		_delay_ms(40);
		while(!(PIND & 0x01)) l+=2;
		_delay_ms(40);

		n = l % 6 + 1;

		for(i=1; i<=n; i++)
		{
			switch(i)
			{
			case 1:
				PORTA = ~WY_1;
				break;
			case 2:
				PORTA = ~WY_2;
				break;
			case 3:
				PORTA = ~WY_3;
				break;
			case 4:
				PORTA = ~WY_4;
				break;
			case 5:
				PORTA = ~WY_5;
				break;
			case 6:
				PORTA = ~WY_6;
			}
			PORTB |= (1<<PB0);
			_delay_ms(50);
			PORTB &= ~(1<<PB0);
			_delay_ms(50);
		}
	}
}

theadrn:
I have to describe it.

Too lazy to do our own homework, are we? Assuming the code is for an ATmega328P, you should look at the spec sheets.

No, not too lazy. My knowledge of this language is zero..

I have to describe it.

Do we get the credit if we describe it ?

Sure.

(deleted)

I would go so far as to say it isn't even Arduino

Electronic 6-value die, i think.

#define WY_1 0x06;Lucky oops

theadrn:
Hello, i am new on this forum and complete beginner of arduino.
I would like to know what does this code do? Can you help me?

If you look in the datasheet for the microcontroller chip it will tell you all about the port control registers
that are used in that code, DDRx/PORTx/PINx... Its doing direct access to pins using the hardware
registers.

It commits the cardinal sin of using...

l

...as a variable name.

Well, it's not for an Arduino UNO or Nano. The ATmega328P processor doesn't have a port 'A'. The Arduino Mega (ATmega2560 processor) does and the 'sketch' will compile.

I suspect it uses a 7-segment display. The number of '1' bits in the constants matches the number of segments you would light up for the corresponding digit.

#define  WY_1 0x06; // 00000110
#define  WY_2 0x5b; // 01011011
#define  WY_3 0x4f; // 01001111
#define  WY_4 0x66; // 01100110  
#define  WY_5 0x6d; // 01101101
#define  WY_6 0x7d; // 01111101

I wonder what idiot decided to include a ';' in a #define.