To be perfectly honest Ribo01 I see no reason to write a bash script for you.
I can see the mechanics of the code using an if while script with a counter that would wait for input from the user (maybe scanf) then compare it to a file stored elsewhere in your user account. Frankly though it is a horrible security feature. Eventually some will figure out the word you type in and get to the console.
Besides this there are lots of other things in your system that can make your user account or possible entire system vulnerable. Since you mentioned terminal and not console, I assume you are in a graphical environment. This would give your roommates access to your browser and the ability to download and possible run some programs within the graphical environment.
I think you should read this link from the suse forum on your very topic here
And you should think about making a separate account your roommates can log into. It keeps there stuff separate from your stuff. Its your computer so as root, you can always see there files.
The console is not that dangerous as some say it is. If your roommates are able to gain root root access and compromise your system with a console, then a password script won't stop them.