When you do k1 p1 and decrease by one, the next time you get there you do p1 k1 and so forth.
But trying to figure this out is way to hard - just learn to recognise your knits and your purls. Once you know what they look like, you can just work them the way they appear.
For a quick fix: once you see moss stitch: you are off by one stitch.
And: in k1 p1 ribbing the knit whales lie higher than the purl columns. So when the stitch you work is part of a "hill" or "ridge", then you knit it. And if it is a "valley" then you purl it. If you can not see with the stitch on the needle itself, then at least look at the stitches further down in your knitting. Those lines run through.