private static synchronized TeamInfo addLiveTeam ( ) { String teamName = randomElement ( COLORS ) + randomElement ( ANIMALS ) ; String robot = null ; // Decide if we want to add a robot to the team. if ( random . nextInt ( ROBOT_PROBABILITY ) == 0 ) { robot = "Robot-" + random . nextInt ( NUM_ROBOTS ) ; } // Create the new team. TeamInfo newTeam = new TeamInfo ( teamName , System . currentTimeMillis ( ) , robot ) ; liveTeams . add ( newTeam ) ; System . out . println ( "[+" + newTeam + "]" ) ; return newTeam ; }
Create and add a team . Possibly add a robot to the team .