public int regArmy(String name, List<UnitAndPlace> units) throws WarAlreadyFinishedException, WarAlreadyStartedException, InvalidUnitNameException, PlaceNotFreeToPlaceUnitException, UnitCoordinatesOutsideMatrixException {
		if (status == Status.FIGHTING) throw new WarAlreadyStartedException(warID);
		if (status == Status.FINISHED) throw new WarAlreadyFinishedException(warID);
		
		Army field = new Army(name);
		
		
		for (UnitAndPlace unit : units) {

			String unitName = unit.getUnitName();
			int unitRow = unit.getRow();
			int unitCol = unit.getCol();
			
			Unit u = null;
			if (unitName.compareToIgnoreCase("Soldier") == 0) {
				u = new Soldier();
			}
			else if (unitName.compareToIgnoreCase("Tank") == 0) {
				u = new Tank();
			}
			else if (unitName.compareToIgnoreCase("Ship") == 0) {
				u = new Ship();
			}
			else if (unitName.compareToIgnoreCase("Plane") == 0) {
				u = new Plane();
			}
			else {
				throw new InvalidUnitNameException(name);
			}
			//Class classUnit = Class.forName("navalwar.server.units." + units[i]);
			//Unit u = (Unit) classUnit.getConstructor().newInstance();

			
			field.addUnit(u, unitRow, unitCol);
			
		}

		
		// assign unique ID to the army in the war
		int armyID = rnd.nextInt(MAX_ARMY_ID);
		while (armies.containsKey(armyID)) armyID = rnd.nextInt(MAX_ARMY_ID);
		field.setArmyID(armyID);

		// keep army in map
		armies.put(armyID, field);
		numArmies++;

		// update armies in fight and wait turn
		armiesInFight.add(armyID);
		armiesWaitTurn.add(armyID);
		
		return armyID;
	}