4 # Forces people to play Quantum Chess in order to login to a UCC clubroom machine
5 # (unless they work out that they can just press 'Q')
8 # WARNING: Don't use on systems without GDM, because it will probably break everything
9 # NOTE: If you have users that never log out (ie: lock the screen instead), this won't be very effective
11 # Add to root's crontab to run every minute
13 # Check qchess isn't already running
14 if [ "$(ps aux | grep -v grep | grep "qchess\.py" | wc -l)" != "0" ]; then
15 echo "qchess already running" 1>&2
16 (ps aux | grep -v grep | grep qchess) 1>&2
20 # Check that only GDM is running gnome-session
21 # This should indicate that the login selection is being shown
22 session_types="gnome-session\|kdeinit"
23 non_gdm_sessions=$(ps aux | grep -v grep | grep "$session_types" | awk '{print $1}' | grep -v gdm | wc -l)
25 if [ "$non_gdm_sessions" != 0 ]; then
26 echo "$non_gdm_sessions non gdm sessions running" 1>&2
30 # OK, go ahead and do evil stuff
34 cd /home/wheel/matches/progcomp2013/qchess
37 #espeak "I challenge you to a duel!"
38 while [ "$win" == "black" ]; do
39 # The game prevents the screen from sleeping automatically...
40 # The blackout option makes the game screen go black if no events happen
41 # It works on clownfish (OpenSUSE); the game is fullscreen. But not cabellera (Scientific Linux); the game isn't fullscreen
42 win=$(./qchess.py --blackout=600 @human @internal:AgentBishop)
45 #if [ "$win" == "white" ]; then
46 # espeak "I'll beat you next time."
48 # espeak "You dirty, cheating, human."