After porting from C to Java, I found out that Java contains many functions that can do the job for you, so to speak, unlike C, where you have to do something manually.
I am currently developing an OOP board game in which several players are allowed to select a game piece that represents them throughout the game. I saved the game parts in an array, and then asked the number of players to select a game piece. However, for obvious reasons, they are not allowed to choose the same game as the player in front of them. Therefore, in my question there is a function that allows me to remove one of the selected game pieces from the array, or I have to do it manually, so to speak. My code is below if necessary:
String[] potential_player_pieces = new String[10];
potential_player_pieces[0]= "*";
potential_player_pieces[1]= "|";
potential_player_pieces[2]= "?";
potential_player_pieces[3]= "@";
potential_player_pieces[4]= "&";
potential_player_pieces[5]= "¬";
potential_player_pieces[6]= "!";
potential_player_pieces[7]= "%";
potential_player_pieces[8]= "<\n";
String[] player_pieces = new String[players+1];
for (int i=1; i<=players; i++)
{
System.out.print("Player " + i + " pick a playing piece:");
for (int j=0; j<=8; j++){
System.out.print(potential_player_pieces[j]);
}
player_pieces[i] = reader.nextLine();
}