Sorry if this already exists; I tried searching but I keep getting page doesn't exist/database/other errors, and I got tired of searching.
What the individual stats do is obvious, but aside from HP, I'm not sure how they directly effect battle. How are speed/defense/attack actually coded in to work, out of curiosity?