Skip to content

Instantly share code, notes, and snippets.

@StoneCypher
Created April 17, 2015 03:35
Show Gist options
  • Select an option

  • Save StoneCypher/83c218e4e41d347d0ae9 to your computer and use it in GitHub Desktop.

Select an option

Save StoneCypher/83c218e4e41d347d0ae9 to your computer and use it in GitHub Desktop.
parse_die(DieString) -> post_d(string:tokens(DieString, "d")).
post_d([JustDie]) -> post_d(["1"], JustDie);
post_d([Count,Die]) -> post_plus([Count] ++ string_tokens(JustDie, "+")).
post_plus(Count,[Die]) -> post_plus(Count,[Die,0]);
post_plus(Count,[Die,Plus]) -> {Count,Die,Plus}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment