Write a function or program that awards you SE badges. If an input "Q" is given it means you have asked a question. If no input is given it means you have only visited the site.*
Badges it must support:
- Run script 30 days in a row: "Enthusiast"
- Run script 100 days in a row: "Fanatic"
- Input "Q" first time: "Student"
- Input "Q" on 5 separate days: "Curious"
- Input "Q" on 30 separate days: "Inquisitive"
- Input "Q" on 100 separate days: "Socratic"
Input:
- You may choose an arbitrary input value for the times you ask questions (I've used "Q" as an example).
- You may choose an arbitrary input value, or have none at all, for the times you only visit the site.
- If a third type of input is given, say "R", then the counters and list of badges shall be reset. This is to ensure that the program can be reused.
Note, you may visit the site many times each day, and ask several questions on the same day. As with the real badges, days are counted in UTC.
You can only have one of each of the badges.
The source code can be altered, but remember the reset functionality. The score will be the size of the script before it's executed the first time.
Output:
Every time you run the script it should output/print a list of badges you have. The output format is optional, but it must use the proper badge names, i.e. you can't enumerate the badges.
The output should be an empty string, 0
, false
or something similar if you don't have any badges. The program can't crash, enter an infinite loop or something similar.
This is code golf, so the shortest code before running the script the first time. As always, the score is counted in bytes.
You may use an external file to store information, but both the name of the file, and the size of the file before the code is executed the first time will count toward the score.