コード例 #1
0
ファイル: Battle.java プロジェクト: Rcdodson/Terminal-Game
 public static void Start(Player player, Level level, Enemy enemy) {
   System.out.println(player.getCharName() + " Health: " + player.getHealth());
   System.out.println(enemy.getName() + " " + enemy.getType() + " Health: " + enemy.getHealth());
   System.out.println("Level: " + level.getLevelType());
   int choice = ChooseAttacks();
   CalculateDamage(choice, player, level, enemy);
 }
コード例 #2
0
ファイル: Kill.java プロジェクト: Kissy/q3-log-parser
 @Override
 public void write(Kryo kryo, Output output) {
   output.writeInt(player.getId());
   output.writeInt(target.getId());
   output.writeLong(time);
   kryo.writeObject(output, meanOfDeath);
 }
コード例 #3
0
  public static void main(String[] args) {
    GameSettings settings = new GameSettings();
    Set<AbstractBot> bots = new HashSet<AbstractBot>();
    // add bots
    bots.add(new Maniac());
    bots.add(new StupidMover());
    bots.add(new StupidShooter());

    Map<String, Integer> leaderBoard = new HashMap<String, Integer>();

    for (int i = 0; i < 10000; i++) {
      Game game = new Game(bots, settings);
      Player winner = game.run();

      if (winner == null) continue;

      if (!leaderBoard.containsKey(winner.getId())) {
        leaderBoard.put(winner.getId(), new Integer(0));
      }
      leaderBoard.put(winner.getId(), leaderBoard.get(winner.getId()) + 1);
    }

    for (Map.Entry<String, Integer> entry : leaderBoard.entrySet()) {
      System.out.println(entry.getKey() + " won times: " + entry.getValue());
    }
  }
コード例 #4
0
ファイル: Team.java プロジェクト: barryp/q2java
	public void addPlayer( Player p )
	{
		if (fPlayers.contains(p))
			return; // already joined this team
			
		fPlayers.addElement( p );

		// make sure we find out if the team member disconnects
		p.addPlayerStateListener(this);

		// act as a damage filter for this member
		p.addDamageListener(this);

		// assign new skin
		assignSkinTo( p );
		Object[] args = {p.getName(), fTeamIndex};
		Game.localecast("q2java.ctf.CTFMessages", "join_team", args, Engine.PRINT_HIGH);	
		
		//update players stats that he joined this team (the yellow line around team-icon)
		int index1 = ( this == Team.TEAM1 ? STAT_CTF_JOINED_TEAM1_PIC : STAT_CTF_JOINED_TEAM2_PIC );
		int index2 = ( this == Team.TEAM1 ? STAT_CTF_JOINED_TEAM2_PIC : STAT_CTF_JOINED_TEAM1_PIC );
		int picnum = Engine.getImageIndex("i_ctfj");
		p.fEntity.setPlayerStat( index1, (short)picnum );
		p.fEntity.setPlayerStat( index2, (short)0      );
	}
コード例 #5
0
 public void banLogin(Player player) {
   if (loginBans.containsKey(player.getName())) {
     loginBans.get(player.getName()).increaseLevel();
   } else {
     loginBans.put(player.getName(), new loginBan());
   }
 }
コード例 #6
0
ファイル: FlipCoin.java プロジェクト: NorthFury/jmagic
  @Override
  public boolean perform(Game game, Event event, Map<Parameter, MagicSet> parameters) {
    Answer[] possibleResults = {Answer.WIN, Answer.LOSE};
    if (parameters.containsKey(Parameter.TYPE)) {
      Set<Answer> typeParameter = parameters.get(Parameter.TYPE).getAll(Answer.class);
      if (typeParameter.size() != 2)
        throw new UnsupportedOperationException(
            "Coin flip type " + typeParameter + " does not contain exactly two Answer objects!");
      possibleResults = typeParameter.toArray(possibleResults);
    }

    Answer flipResult = possibleResults[this.generator.nextBoolean() ? 1 : 0];
    if (game.noRandom) {
      Player player = parameters.get(Parameter.PLAYER).getOne(Player.class);
      flipResult =
          player
              .choose(
                  1,
                  Arrays.asList(possibleResults),
                  PlayerInterface.ChoiceType.COIN_FLIP,
                  PlayerInterface.ChooseReason.MANIPULATE_COIN_FLIP)
              .get(0);
    }

    event.setResult(Identity.instance(flipResult));

    // This returns false if the flip resulted in Answer.LOSE, but true
    // for everything else (including Answer.WIN, and any specified
    // Answers)
    return (flipResult != Answer.LOSE);
  }
コード例 #7
0
  /**
   * Method removeParty.
   *
   * @param party Party
   */
  public void removeParty(Party party) {
    _commandChannelParties.remove(party);
    refreshLevel();
    party.setCommandChannel(null);
    party.broadCast(ExMPCCClose.STATIC);
    Reflection reflection = getReflection();

    if (reflection != null) {
      for (Player player : party.getPartyMembers()) {
        player.teleToLocation(reflection.getReturnLoc(), 0);
      }
    }

    if (_commandChannelParties.size() < 2) {
      disbandChannel();
    } else {
      for (Player $member : party) {
        $member.sendPacket(new ExMPCCPartyInfoUpdate(party, 0));

        if (_matchingRoom != null) {
          _matchingRoom.broadcastPlayerUpdate($member);
        }
      }
    }
  }
コード例 #8
0
ファイル: Core.java プロジェクト: Kloranthy/BlackJack
 private void hit(Player p) {
   Card drawn = drawCard();
   int value = drawn.getValue();
   String sval;
   if (value > 2 && value < 11) {
     sval = value + "";
   } else if (value == 11) {
     sval = "Jack";
     value = 10;
   } else if (value == 12) {
     sval = "Queen";
     value = 10;
   } else if (value == 13) {
     sval = "King";
     value = 10;
   } else {
     sval = "Ace";
     if (p.getScore() <= 10) {
       value = 11;
     }
   }
   p.add(value);
   String suit = drawn.getSuit();
   io.print(p.getName() + " drew the " + sval + " of " + suit + ".");
   io.print(p.getName() + "'s score is currently " + p.getScore());
 }
コード例 #9
0
  @Test
  public void testSubmitAllCorrectAnswers() {
    Player playerWith5Friends = TestUtils.getPlayer(1005);

    // Take note of the player's points before they submit the correct
    // answers
    long playerPointsOriginal = playerWith5Friends.getPoints();

    // Submit 3 correct answers to our WebService as a POST request
    String targetURL =
        "http://localhost:8080/FBTutorialDemo/rest/webService/GameAnswers/"
            + "1005/67890/76543/89012";
    String JSONInput =
        "[\"" + "One Friend" + "\",\"" + "Two Friend" + "\",\"" + "Three Friend" + "\"]";
    String response = TestUtils.doPOST(targetURL, JSONInput);

    // Test that we get the correct String back from the incorrect answers
    // and our points were deducted
    String expectedResponse =
        "First entry was correct "
            + "Second entry was correct "
            + "Thrid entry was correct "
            + "You will have a total of ["
            + 30
            + "] points added!";

    // Re-GET the player now that the score should be updated
    playerWith5Friends = TestUtils.getPlayer(1005);
    Assert.assertTrue(response.equals(expectedResponse));
    Assert.assertTrue(playerWith5Friends.getPoints() == (playerPointsOriginal + 30));
  }
コード例 #10
0
ファイル: MCX118.java プロジェクト: tswaugh/craftbook
    private boolean entityInRange(BaseEntity entity) {
      switch (TYPE) {
        case 0:
          Player player = (Player) entity;

          return SETTINGS.isEmpty()
              || (SETTINGS.charAt(0) == 'g' && player.isInGroup(SETTINGS.substring(2)))
              || (SETTINGS.charAt(0) == 'p'
                  && player.getName().equalsIgnoreCase(SETTINGS.substring(2)));
        case 1:
        case 2:
          return true;
        case 3:
          if ((entity.isMob() || entity.isAnimal()) && entity instanceof Mob) {
            Mob mob = (Mob) entity;
            if (SETTINGS.isEmpty() || mob.getName().equalsIgnoreCase(SETTINGS)) return true;
          }
          break;
        case 4:
        case 5:
          return true;
      }

      return false;
    }
コード例 #11
0
ファイル: Core.java プロジェクト: Kloranthy/BlackJack
 private void doPlayerTurn() {
   String input = "";
   while (plyr.getScore() < 21 && !input.equalsIgnoreCase("stand")) {
     io.print("\nSelect your move.");
     while (!io.hasInput()) {
       try {
         Thread.sleep(500);
       } catch (InterruptedException e) {
         e.printStackTrace();
       }
     }
     input = io.getInput();
     switch (input) {
       case "hit":
         hit(plyr);
         if (plyr.isBust()) {
           io.print("Player is bust!");
           continue;
         }
         break;
       case "stand":
         continue;
     }
   }
 }
コード例 #12
0
ファイル: DialogueGame.java プロジェクト: siwells/ProtOCL
    public void check_DialogueGame_invariant() {

      Player playerProponent = DialogueGame.this.getProponent();
      Set setTurn = playerProponent.getTurn();
      // evaluate 'forAll(getNumber()/2=1)':
      boolean bForAll = true;
      final Iterator iter = setTurn.iterator();
      while (bForAll && iter.hasNext()) {
        final Turn iter1 = (Turn) iter.next();
        int nGetNumber = iter1.getNumber();
        float fDivide = nGetNumber / 2;
        boolean bEquals = fDivide == 1;

        bForAll = bEquals;
      }
      Player playerOpponent = DialogueGame.this.getOpponent();
      Set setTurn0 = playerOpponent.getTurn();
      // evaluate 'forAll(getNumber()/2=0)':
      boolean bForAll0 = true;
      final Iterator iter0 = setTurn0.iterator();
      while (bForAll0 && iter0.hasNext()) {
        final Turn iter1 = (Turn) iter0.next();
        int nGetNumber0 = iter1.getNumber();
        float fDivide0 = nGetNumber0 / 2;
        boolean bEquals0 = fDivide0 == 0;

        bForAll0 = bEquals0;
      }
      boolean bAnd = bForAll && bForAll0;
      if (!bAnd) {
        System.err.println("invariant 'invariant' failed for object " + DialogueGame.this);
      }
    }
コード例 #13
0
ファイル: Player.java プロジェクト: bbosveld/reversi
 public int otherPlayer(Player a, Player b) {
   if (this.getID() == a.getID()) {
     return b.getID();
   } else {
     return a.getID();
   }
 }
コード例 #14
0
ファイル: GameState.java プロジェクト: rex1fernando/linewars
  /**
   * Updates the game state to the next tick. First applies the messages past in as arguments, then
   * updates the nodes, then the lanes, then checks for a winning player.
   *
   * @param messages the messages to apply for this game state tick
   */
  public void update(Message[] messages) {
    this.validateLock();

    for (Message m : messages) m.apply(this);

    this.validateLock();

    for (Node n : map.getNodes()) n.update();

    this.validateLock();

    for (Lane l : map.getLanes()) l.update();

    this.validateLock();

    double energyToAdd = ENERGY_INCREMENT_RATE * this.getLastLoopTime();
    for (Player p : players.values()) {
      p.setPlayerEnergy(p.getPlayerEnergy() + energyToAdd);
      if (p.getPlayerEnergy() > MAX_PLAYER_ENERGY) p.setPlayerEnergy(MAX_PLAYER_ENERGY);
    }

    timerTick++;

    lastLoopTime = this.getTime() - timeAtEndOfLastLoop;
    timeAtEndOfLastLoop = this.getTime();

    this.validateLock();

    // check for win
    Node n1 = map.getNodes()[0];
    for (Node n : map.getNodes())
      if (n1.getOwner() == null || !n1.getOwner().equals(n.getOwner())) return;
    winningPlayer = n1.getOwner();
  }
コード例 #15
0
ファイル: Functions.java プロジェクト: jordi2830/deltaBot
  public static Player getPlayerByNum(int num) {
    for (Player p : getCurrentPlayers()) {
      if (p.num() == num) return p;
    }

    return null;
  }
コード例 #16
0
  @Test
  public void testSubmitAllBlankAnswers() {
    String appName = "FBTutorialDemo";
    Player playerWith5Friends = TestUtils.getPlayer(1005);

    // Take note of the player's points before they submit the blank answers
    long playerPointsOriginal = playerWith5Friends.getPoints();

    // Submit 3 blank answers to our WebService as a POST request
    String targetURL =
        "http://localhost:8080/FBTutorialDemo/rest/webService/GameAnswers/"
            + "1005/67890/76543/89012";
    String JSONInput = "[\"" + "\",\"" + "\",\"" + "\"]";
    String response = TestUtils.doPOST(targetURL, JSONInput);

    // Test that we get the correct String back from the blank answers and
    // our points were deducted
    String expectedResponse =
        "First entry was INCORRECT "
            + "Second entry was INCORRECT "
            + "Third entry was INCORRECT "
            + "You will have a total of ["
            + 30
            + "] points deducted.";

    System.out.println("\n\n\n\n\n\n response: " + response);
    System.out.println("\n\n\n\n\n\n");

    // Re-GET the player now that the score should be updated
    playerWith5Friends = TestUtils.getPlayer(1005);
    Assert.assertTrue(response.equals(expectedResponse));
    Assert.assertTrue(playerWith5Friends.getPoints() == (playerPointsOriginal - 30));
  }
コード例 #17
0
  private void move() {
    xa = 0;
    ya = 0;

    List<Player> players = level.getPlayers(this, 300);
    if (players.size() > 0) {
      Player player = players.get(0);

      if (isSlowed((int) xa, (int) ya)) speed = 0.35;
      else speed = 0.5;
      if (x + 30 < player.getX()) xa += speed;
      if (x - 30 > player.getX()) xa -= speed;
      if (y + 30 < player.getY()) ya += speed;
      if (y - 30 > player.getY()) ya -= speed;
    } else {
      time++; // /n time % 60 = 0; == once per second
      if (time % (random.nextInt(60) + 40) == 0) {
        xa = random.nextInt(3) - 1;
        ya = random.nextInt(3) - 1;
        if (random.nextInt(3) == 0) { // or if (time % 60 == 0)
          xa = 0;
          ya = 0;
        }
      }
    }

    if (xa != 0 || ya != 0) {
      move(xa, ya);
      walking = true;
    } else {
      walking = false;
    }
  }
コード例 #18
0
ファイル: GUI.java プロジェクト: karljv/Apox_TEST
  @Override
  protected void paintComponent(Graphics g) {
    super.paintComponent(g);

    Graphics2D g2d = (Graphics2D) g;
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setColor(Color.GREEN);

    if (player != null) {
      g2d.fillOval(player.getX(), player.getY(), 5, 5);
    }
    /*
    if(trees != null)
    {
     for(Circle tree: trees)
     {
     	g2d.fillOval((int) tree.x, (int) tree.y,(int) tree.RADIUS,(int) tree.RADIUS);
     }
    }
    if(bigHerbivores != null)
    {
    	for(BigHerbivore c: bigHerbivores)
    	{
    		int rad = Math.round(c.RADIUS/2);

    		g2d.setColor(Color.RED);
    		g2d.fillOval((int) c.x - rad,(int) c.y - rad,(int) c.RADIUS,(int) c.RADIUS);
    		g2d.drawLine((int) c.x,(int) c.y,(int) c.destX,(int) c.destY);
    	}
    }
    */
  }
コード例 #19
0
 /**
  * Constructor for CommandChannel.
  *
  * @param leader Player
  */
 public CommandChannel(Player leader) {
   _commandChannelLeader = leader;
   _commandChannelParties.add(leader.getParty());
   _commandChannelLvl = leader.getParty().getLevel();
   leader.getParty().setCommandChannel(this);
   broadCast(ExMPCCOpen.STATIC);
 }
コード例 #20
0
ファイル: JukeBox.java プロジェクト: Latsuj/PFE
 /**
  * Le chemin du fichier que l'on souhaite fermer
  *
  * @param path Le chemin du fichier que l'on souhaite stopper
  * @return Retourne true si le fichier a ete stoppe, false sinon
  * @author Justal "Latsuj" Kevin
  * @email [email protected]
  */
 public boolean stop(String path) {
   if (path != null) {
     if (player != null && path.equals(player.getPath())) {
       logger.info("Arret de la lecture du fichier : " + path);
       player.stopSong();
       return true;
     }
     for (int i = 0; i < listPlayerWaiting.size(); i++) {
       if (path.equals(listPlayerWaiting.get(i).getPath())) {
         logger.info("Arret de la lecture du fichier : " + path);
         listPlayerWaiting.get(i).stopSong();
         return true;
       }
     }
     for (int i = 0; i < listPlayerBackgroundMusics.size(); i++) {
       if (path.equals(listPlayerBackgroundMusics.get(i).getPath())) {
         logger.info("Arret de la lecture du fichier : " + path);
         listPlayerBackgroundMusics.get(i).stopSong();
         return true;
       }
     }
   }
   logger.warning("Le fichier n'existe pas : " + path);
   return false;
 }
コード例 #21
0
ファイル: Maps.java プロジェクト: baskwo/DevEmu_Project
 public List<GameClient> getAllClients() {
   List<GameClient> loc0 = new ArrayList<>();
   for (Player loc1 : playersOnMaps) {
     loc0.add(loc1.getClient());
   }
   return loc0;
 }
コード例 #22
0
ファイル: Players.java プロジェクト: lituss/setimig
 // public int getSize(){return players.size;}
 public int getActiveSize() {
   int contador = 0;
   for (Player auxPlayer : players)
     if (auxPlayer.getEstat() == Jugada.CartaDestapada
         || auxPlayer.getEstat() == Jugada.CartaTapada) contador++;
   return contador;
 }
コード例 #23
0
  /** *** MINECRAFT.NET AUTHENTICATION **** */
  public boolean onlineAuthenticate(Player player) {
    if (!useCustAuth(player)) {
      return true;
    }

    boolean result = false;
    // Send a GET request to minecraft.net

    String urlStr;
    try {
      urlStr =
          MINECRAFT_AUTH_URL
              + String.format("?user=%s&serverId=%s", player.getName(true), player.getLoginHash());
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
    try {
      URL url = new URL(urlStr);
      URLConnection conn = url.openConnection();

      BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
      result = (in.readLine().equals("YES")) ? true : false;
      in.close();

    } catch (MalformedURLException e) {
      System.out.println("[CustAuth] Malformed URL: " + urlStr);
    } catch (Exception e) {
      // seems to be down
      System.out.println("[CustAuth] Could not reach authentication url: " + urlStr);
      updateMinecraftState();
    }
    return result;
  }
コード例 #24
0
 public boolean onCommand(Player player, String[] split) {
   if (!player.canUseCommand(split[0])) {
     return false;
   }
   if (split[0].equalsIgnoreCase("/saveStargate")) {
     if (split.length == 5) {
       StargateData.Savestargate(player, split);
     }
     return true;
   } else if (split[0].equalsIgnoreCase("/listStargates")) {
     // world.setBlockAt(20,(int)Math.floor(player.getX()),(int)Math.floor(player.getY()),(int)Math.floor(player.getZ()));
     return true;
   } else if (split[0].equalsIgnoreCase("/removeStargate")) {
     boolean worked = false;
     if (split.length > 1) {}
     if (worked) {
       player.sendMessage("Stargate removed");
     } else {
       player.sendMessage("Failed to remove Stargate");
     }
     return true;
   } else {
     return false;
   }
 }
コード例 #25
0
ファイル: Settings.java プロジェクト: BlkStormy/epic-inventor
  public static void loadPlayer(Registry registry) {
    Player p = (Player) getPlayers().get(player);
    if (p != null) {
      p.setTransient(registry);
    }

    GameController gc = registry.getGameController();
    registry.getPlayerManager().clearPlayers();
    registry.getPlayerManager().registerPlayer(p);
    BlockManager bm = (BlockManager) blockManagers.get(player);
    bm.name = "Saved";
    bm = (BlockManager) bm.clone();
    bm.name = "Clone";
    bm.setTransient(registry);
    gc.setBlockManager(bm);
    PlaceableManager pm = (PlaceableManager) placeableManagers.get(player).clone();
    gc.setPlaceableManager(pm);
    MonsterManager mm = (MonsterManager) monsterManagers.get(player).clone();
    mm.setTransient(registry);
    gc.setMonsterManager(mm);

    if (p != null) {
      p.resetPlayer();
    }

    // unloadUnused();
  }
コード例 #26
0
ファイル: Game.java プロジェクト: FHNW-IWI/AIGS
 /**
  * Sends a message to all players in the current game.<br>
  * The message will not be sent to players with the {@link Player#isAi} flag.
  *
  * @param message The message to be sent.
  */
 public void sendMessageToAllPlayers(Message message) {
   for (Player p : players) {
     if (p.isAi() == false || p.getSocket() != null) {
       message.send(p.getSocket(), p);
     }
   }
 }
コード例 #27
0
ファイル: GameUtil.java プロジェクト: esfdk/HoNmasters
  private static void update(Player one, Player two, Player winner) {
    // Vi kan lave alle mulige slags Fight-instanser:

    // listen fightparticipants gemmer historik over hvilke spillere der har kæmpet mod hinanden
    GamePlay.fightparticipants.add(new Fight<Player>(one, two, winner));

    // listen fighttypes gemmer historik over hvilke typer af spillere (Thief, Wizard, etc) der har
    // kæmpet mod hinanden. Bemærk
    // metoden getClass().getSimpleName() giver os navnet på den klasse som objektet er instantieret
    // af
    GamePlay.fighttypes.add(
        new Fight<String>(
            one.getClass().getSimpleName(),
            two.getClass().getSimpleName(),
            winner.getClass().getSimpleName()));

    // listen smartfight gemmer historik over hvordan det går to kæmpende med hver deres
    // intelligensniveau. Kan bruges til at
    // regulere i spillet så vi ikke får for mange stupide vindere :-)
    GamePlay.smartfight.add(new Fight<Smartness>(one.smartness, two.smartness, winner.smartness));

    // Hvis Fight parameteriseres kan man ikke indsætte forkert
    // GamePlay.smartfight.add(new Fight<Smartness>(one.strength, two.speak(), winner.getClass()));
    // er ikke lovligt

    // men uden parameterisering går det fint med at lave rod. Og vi får lov at sætte instansen ind
    // i vores
    // "typesikre" Liste i GamePlay! Så warnings i forbindelse m generics skal tages seriøst..
    // Husk parameterisering af Collections er kun gældende på compiletime. Runtime glemmes typerne
    // igen

    // GamePlay.strongfight.add(new Fight(one.strength, two.speak(), winner.getClass())); kan godt
    // lade sig gøre
  }
コード例 #28
0
ファイル: Functions.java プロジェクト: jordi2830/deltaBot
  public static Player getPlayerByIP(String IP) {
    for (Player p : getCurrentPlayers()) {
      if (p.IP().equals(IP)) return p;
    }

    return null;
  }
コード例 #29
0
ファイル: QuestDelegate.java プロジェクト: whonderland/msoy
  /**
   * Pays out all players any accrued coins and records all player minutes and coin awards to this
   * game's activity log, potentially recalculating its payout factor as a result.
   */
  protected void flushAllPlayers() {
    int totalSecs = 0, totalTasks = 0, totalAward = 0;

    // pay out flow to all players, total up our coin awards and play time
    for (Player player : _players.values()) {
      final int playerSecs = player.timeAccrued + player.getPlayTime(now());
      totalSecs += playerSecs;
      totalTasks += player.tasksCompleted;
      if (player.coinsAccrued > 0) {
        final UserAction action =
            UserAction.playedGame(
                player.playerObject.getMemberId(), _content.game.name, _gameId, playerSecs);
        _gameReg.awardCoins(_gameId, action, player.coinsAccrued);
        totalAward += player.coinsAccrued;
      }
      player.reset();
    }

    // if we actually awarded coins or accrued time, update our game metrics
    if (totalAward > 0 || totalSecs > 0) {
      final int totalMins = Math.round(totalSecs / 60f);
      _gameReg.updateGameMetrics(
          _content.metrics, GameGameRegistry.MetricType.AVRG, totalMins, totalTasks, totalAward);
    }
  }
コード例 #30
0
  public void newGame() {
    dissapear = false;

    botborder.clear();
    topborder.clear();

    missiles.clear();
    smoke.clear();

    minBorderHeight = 5;
    maxBorderHeight = 30;

    player.resetDY();
    player.resetScore();
    player.setY(HEIGHT / 2);

    if (player.getScore() > best) {
      best = player.getScore();
    }

    // create initial borders

    // initial top border
    for (int i = 0; i * 20 < WIDTH + 40; i++) {
      // first top border create
      if (i == 0) {
        topborder.add(
            new TopBorder(
                BitmapFactory.decodeResource(getResources(), R.drawable.brick), i * 20, 0, 10));
      } else {
        topborder.add(
            new TopBorder(
                BitmapFactory.decodeResource(getResources(), R.drawable.brick),
                i * 20,
                0,
                topborder.get(i - 1).getHeight() + 1));
      }
    }
    // initial bottom border
    for (int i = 0; i * 20 < WIDTH + 40; i++) {
      // first border ever created
      if (i == 0) {
        botborder.add(
            new BotBorder(
                BitmapFactory.decodeResource(getResources(), R.drawable.brick),
                i * 20,
                HEIGHT - minBorderHeight));
      }
      // adding borders until the initial screen is filed
      else {
        botborder.add(
            new BotBorder(
                BitmapFactory.decodeResource(getResources(), R.drawable.brick),
                i * 20,
                botborder.get(i - 1).getY() - 1));
      }
    }

    newGameCreated = true;
  }