New answers tagged

1 vote

Tic Tac Toe on the command line in Scala

I've learned a fair amount of Scala conventions since posting this, so I'll leave a few comments on my own code for anyone who comes across this. The way the Map is used can be improved. For the ...
user avatar
1 vote
Accepted

Clear output line in terminal after use for countdown (different length strings)

ANSI escape sequences are not necessary, and the so-called archaic method of using a carriage return is preferred. Avoid mixing sys.stdout with ...
user avatar
  • 49.7k
2 votes

One of my first Python projects - an adventure game

This could be a place to implement a state machine. For such simple program, I would use globals to store the game state. (Unless you want to host multiple sessions at once in one process.) I would ...
user avatar
  • 149
3 votes

One of my first Python projects - an adventure game

As already mentioned by others, the branch conditions will get out of control quickly. It may be more suitable to encode the storyline in a separate file, such as a JSON file. Therefor we can identify ...
user avatar
7 votes

One of my first Python projects - an adventure game

Since you don't wait between prints, you can join some of them. Use triple quotes to extend a string on multiple lines (can be used for comments too) and \n to make a line break. ...
user avatar
1 vote

One of my first Python projects - an adventure game

Just a little tip on this line : start = input("Do you wish to begin your adventure? ").lower() When I tried your game, I just hit enter and it ...
user avatar
  • 11
10 votes

One of my first Python projects - an adventure game

Too much code duplication. Consider: ...
user avatar
  • 30.8k
1 vote

One of my first Python projects - an adventure game

Right off the bat, instead of strings maybe it'd be better to prompt your users to input the option number instead. It'd probably be cleaner, less prone to user error and allow you to run a Switch ...
user avatar
2 votes

Terminal calculator that saves and displays calculation history

For a first project in C++, this is looking really decent! There are still some things you can improve though, which I'll list below. Answers to your questions Is there a better/cleaner way to [Q]uit ...
user avatar
  • 33.4k
3 votes

Terminal calculator that saves and displays calculation history

Here are some things that may help you improve your code. Avoid singletons You probably already know about avoiding global data because it makes the program harder to understand and reason about. The ...
user avatar
  • 64.4k
1 vote

first try packagist: Detection of execution by command (Terminal) or web environment

Given you stated "Opinion is understood as everything related to good practices based on PSR/symfony2 code style, security, distribution practice and anything else that comes to mind." I ...
user avatar

Top 50 recent answers are included