You should almost never have to change these from the default settings.
All you need to do is make sure your webserver points to your server root properly (in your case,
The default Craft 3 install has
web/ as the server root, with Craft and all of it's files/folders in the root directory. If you don't change anything, the
index.php that ships with Craft will "just work" once you've pointed the webserver at the web root.
In your case, it sounds like you're saying that you've moved all of Craft into a
craft/ directory that sits alongside the
web/ directory. Assuming you've moved everything into that folder, you'd do something like this in your
// Project root path
$root = dirname(__DIR__).'/craft';