Well to solve a rubiks cube basically you go layer by layer. Then depending on which layer you are working on, and the layout of the pieces, you use different algorithms, which are a pattern of turns you make. There are basically 5-6 different algorithms for solving a 3x3 that you'll need to know. It took me about 30 minutes to memorize the algorithms for a 3x3 and an hour for a 4x4. So basically, there is no magic code to solve a rubik's cube, you just have to memorize the different algorithms and know when to use them. There's many sites and many more youtube videos explaining these. Have a look around and you should eventually find one with a good tutorial