Yes of course.

It has been done years ago.

A senior in my hostel in IIT Bombay wrote a program in FORTRAN to solve the Rubik’s Cube in 1982. This was for his B.Tech Project. Memory serves, it had 10,000 lines.

Since IIT Bombay didn’t have interactive computers back then, the program had to be punched https://levitralab.com into so-called Hollerith Cards, one line per card. The entire deck comprising 10K cards occupied a good portion of his hostel room!

UPDATE DATED 26 MARCH 2020:

I recently happened to find a Hollerith Card of my B.Tech Project program from 1985. This is how it looks: