my computer turns off when i play portal?
As has been said, it's possible that your system is overheating. It's also possible that the power supply is running on the ragged edge and either CPU or GPU demands are drawing too much power. You can download a variety of desktop monitors to gauge the temp.
I had to upgrade a power supply in a similar case.
i checked a place and (amazingly) it said that my computer can play portal 2 and easily play assassins creed brother hood (just have to get my computer dusted off ._.
how do i know if there is a corrupt file?
I suggested it because you said that this happens only when you fire up Portal. I don't know where you got the program. If Portal is not a game that you actually purchased, then you cannot know if its files are all "viable".
b) Many people download games from questionable sources.
Which is what I thought might be the case. Remove it and purchase the game. Torrent based apps have an alarming tendency to carry parasites.
Well, keep what I said in mind in the future anyway. I'm not judging you here, just pointing out a fact. Torrent is a potential recipe for system infection and/or instability.
Reinstall the program. Save all the user files and data generated and then uninstall it and reinstall.
There is a possibility , like seandouge says that its the power supply. If it is that then there may be a little delay when it restarts, just long enough to cool down and reset the thermal switch. Do the simplest first which is to clean out the dust and check the fans.
I had an early Radeon card that worked perfectly until I played MW3. between 10 and fifteen minutes into the game everything would lock up. I bought a little peltier cooler and put it on the backside of the card and it fixed the problem. But current video cards are built for better cooling. They will usually handle everything as long as the fans can spin at top speed and mover the air through.
Overheating. Check all your fans, especially the video card ones. Clean the dust out of them and out of the heastsink fins.