switch(actionType){ case AI_TURN: doAiTurn(); break; case HUMAN_TURN: doHumanTurn(); break; case INDICATE_HIT: doIndicateHit(); break; ...}
C++ (Qt)int random(int x) { return qrand() % x; }
C++ (Qt)void pause(int ms){ QEventLoop el; QTimer t; connect(&t, SIGNAL(timeout()), &el, SLOT(quit())); t.start(ms); el.exec();}
C++ (Qt)while(!asleep()) sheep++;