Chosen Solution

my iphone 4s suddenly shut while playing games using wifi

As a battery gets older it will die from what looks like a good percentage of the battery left . what your describing , running wifi and gaming at the same time is a huge power drain and if the battery is older a getting weeker it will die from 40% quickly