Different LED Patterns

Well for a start it removes the need for all those led2, led3 and so on. Define an array with the PIN numbers in it, then use a for loop to set the pin mode on all of them.
Then define an array with your pattern in it, using one bit of the number for each LED. If you only had 8 LEDs then you could get away with a byte array but as you have 9 then you will have to go to an int array.
Then Look at your input buttons to see which array element of the pattern array value to get, and a for loop can be used to set each LED output high or low depending on if there is a one in the pattern number or not.

Almost exactly what that page tells you how to do.