我创建了这个程序,以帮助我在创建的文本冒险中绘制地图.到目前为止,它所做的只是绘制你输入的黑色方格的拘留.有没有办法去除每条线之间的空间,所以没有白线穿过广场?
这是我的代码:
import java.util.Scanner;
public class MapGrid {
static String createGrid(int x, int y) {
String output = "";
String block = new String("\u2588\u2588"); //A string of two unicode block symbols: ??
if(x * y != 0) { //If neither x nor y is 0, a map of length x and height y will be returned
for(int n = 1; n <= y; n++) {
for(int i = 1; i <= x; i++) {
output += block;
}
output += …Run Code Online (Sandbox Code Playgroud)