Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chris-plus-alphanumericgibberish/af84190f36b59aa83eda to your computer and use it in GitHub Desktop.
Save Chris-plus-alphanumericgibberish/af84190f36b59aa83eda to your computer and use it in GitHub Desktop.
dNethack Games-Played Rules
def dnethack_tour?(user)
anz = repository.adapter.select "select count(distinct race), count(distinct role) from games where user_id = ? and version == 'DNH' and turns >= 1000 and (race in ('Inc','Clo','Dro','Hlf) or role in ('Nob','Pir','Bin','Brd');", user
return (anz[0]+anz[1]) == 8
end
def dnethack_king?(user)
anz = repository.adapter.select "select count(distinct race), count(distinct role) from games where user_id = ? and version == 'DNH' and ascended='t' and (race in ('Inc','Clo','Dro','Hlf) or role in ('Nob','Pir','Bin','Brd');", user
return (anz[0]+anz[1]) == 8
end
def dnethack_prince?(user)
anz = repository.adapter.select "select count(distinct race), count(distinct role) from games where user_id = ? and version == 'DNH' and ascended='t' and (race in ('Inc','Clo','Dro','Hlf) or role in ('Nob','Pir','Bin','Brd');", user
return (anz[0]+anz[1]) >= 4
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment