Guest User

Untitled

a guest
Jan 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. public class Game{
  2. private static int pingpangpong = 0;
  3. private static int turnChanger = 1;
  4. public static int getTurn(){
  5. return pingpangpong;
  6. }
  7.  
  8. public static void invTurn(){
  9. pingpangpong += turnChanger;
  10. turnChanger *= (pingpangpong == 2 || pingpangpong == 0 ? -1 : 1);
  11. }
  12.  
  13. public static void main(String[] args){
  14. Worker ping, pang, pong;
  15.  
  16. ping = new Worker(0, "PING\n");
  17. pang = new Worker(1, "PANG\n");
  18. pong = new Worker(2, "PONG\n");
  19. }
  20. }
Add Comment
Please, Sign In to add comment