Hey there guys! I was wondering if someone could help me make a function to check that I tick off a room in a text based adventure game to make sure that I don't go back in there and that it counts how many rooms I've been in
not exactly, I'm trying an exercise in class and I'm not sure how I would do it. Currently I'm thinking about setting up a bool for isNotVisited(); and Visited(); that I could use for graphs aswell
Currently I'm thinking about setting up a bool for isNotVisited(); and Visited();
It's a question of style, but I would create only one of these (Visited()) and then use !Visited() if I wanted to know that it wasn't visited.
The reason to create Visited() instead of isNotVisited() is because, to me, it always makes sense to record the positive sense of a boolean attribute. Otherwise you start having to write code like if (!flagNotTripped()) which not nearly as clear as if flagTripped()