A code stays a rule when only one side keeps it
In 1920s Westerns the hero proves himself by playing fairly against opponents who do not. Earlier, both hero and villain obeyed the code. The book says the stories then claim an orderly universe because fair play wins anyway.
From Oriard, 1991, p. 272. Oriard, M. (1991). Sporting with the gods: the rhetoric of play and game in American culture. Cambridge: Cambridge University Press. ISBN 0-521-39113-X. (The copy is the digital printing of 2007, ISBN 978-0-521-39113-9. No DOI found.)