2017/02/01 01:57
頑張れー
投稿2017/01/31 12:26
前回、テトリスを作っていて回転を制御するプログラムを質問させてもらったものです。
あのあと考えてみて、こんなしようのプログラムを考えてみました。
mainで一番上からランダムでテトリミノが出てきたとき、テトリミノごとに番号を振っています。
例)Tetorimino == 1 だったら 「●●●●」 という形
という感じです
mainからTetoriminoを受け取って、その番号を取得したあと、
さらに回転番号をつけます。
例)Tetorimino == 1 だったら 「●●●●」 という形
さらにそこから番号入力を求めます
例)bango に1を入力したら
別の配列に入れておいた
[●
●
●
●」 ←縦一列に並んでるものと思ってください><
をmainに出すプログラムを考えました
そしてコンパイルしたところエラーが100件以上出てしまいました><
すべてのエラーの内容が「文ではありません」「;がありません」がほとんどです
どこが間違っているのかわかりません。
どこが間違っているのかご指摘お願いします(>人<;)
※配列がものすごく見づらくなってしまってすいません><
上一列の配列と
下3列の配列の位置がずれてしまってますが縦4行揃ってるものと思ってもらってください><
public class operation2 {
public static void main(String[] args) throws IOException {
/*入力の準備*/ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[][] turnedBlock = new String[4][4]; /* テトリミノを回転させる */ if (Tetorimino == 0 ) { //テトリミノ「●●●●」の回転 turnedBlock [][] = {{"□","□","□","□"}, {"●","●","●","●"}, {"□","□","□","□"}, {"□","□","□","□"}}; System.out.plintln("回転させたい図の番号を入力してください") int bango =("u"); bango = br.readLine(); switch (bango) { case 1: turnedBlock[][] = {{"□","●","□","□"}, {"□","●","□","□"}, {"□","●","□","□"}, {"□","●","□","□"}}; break; case 2: turnedBlock[][] = {{"□","□","□","□"}, {"●","●","●","●"}, {"□","□","□","□"}, {"□","□","□","□"}}; break; } //テトリミノ「●● // ●●」の回転 } else if (Tetorimino == 1) { turnedBlock[][] = {{"□","□","□","□"}, {"□","●","●","□"}, {"□","●","●","□"}, {"□","□","□","□"}}; System.out.plintln("回転させたい図の番号を入力してください") int bango =("u"); bango = br.readLine(); switch (bango = 1) { case 1: turnedBlock[][] = {{"□","□","□","□"}, {"□","●","●","□"}, {"□","●","●","□"}, {"□","□","□","□"}}; break; } //テトリミノ「 ● // ●●●」の回転 } else if (Tetorimino == 2){ turnedBlock[][] = {{"□","●","□","□"}, {"●","●","●","□"}, {"□","□","□","□"}, {"□","□","□","□"}}; System.out.plintln("回転させたい図の番号を入力してください") int bango =("u"); bango = br.readLine(); switch (bango) { case 1: turnedBlock[][] = {{"□","●","□","□"}, {"□","●","●","□"}, {"□","●","□","□"}, {"□","□","□","□"}}; break; case 2: turnedBlock[][] = {{"□","□","□","□"}, {"●","●","●","□"}, {"□","●","□","□"}, {"□","□","□","□"}}; break; case 3: turnedBlock[][] = {{"□","●","□","□"}, {"●","●","□","□"}, {"□","●","□","□"}, {"□","□","□","□"}}; break; case 4: turnedBlock[][] = {{"□","●","□","□"}, {"●","●","●","□"}, {"□","□","□","□"}, {"□","□","□","□"}}; break; } //テトリミノ「 ■■ // ■■」の回転 } else if (Tetorimino == 3) { turnedBlock[][] = {{"□","□","□","□"}, {"□","■","■","□"}, {"■","■","□","□"}, {"□","□","□","□"}}; System.out.plintln("回転させたい図の番号を入力してください") int bango =("u"); bango = br.readLine(); switch (bango) { case 1: turnedBlock[][] = {{"□","□","□","□"}, {"□","■","□","□"}, {"□","■","■","□"}, {"□","□","■","□"}}; break; case 2: turnedBlock[][] = {{"□","□","□","□"}, {"□","□","□","□"}, {"□","■","■","□"}, {"■","■","□","□"}}; break; case 3: turnedBlock[][] = {{"□","□","□","□"}, {"■","□","□","□"}, {"■","■","□","□"}, {"□","■","□","□"}}; break; case 3: turnedBlock[][] = {{"□","□","□","□"}, {"□","■","■","□"}, {"■","■","□","□"}, {"□","□","□","□"}}; break; } //テトリミノ「■■ // ■■」の回転 } else if (Tetorimino == 4) { turnedBlock[][] = {{"□","□","□","□"}, {"■","■","□","□"}, {"□","■","■","□"}, {"□","□","□","□"}}; System.out.plintln("回転させたい図の番号を入力してください") int bango =("u"); bango = br.readLine(); switch (bango) { case 1: turnedBlock[][] = {{"□","□","□","□"}, {"□","□","■","□"}, {"□","■","■","□"}, {"□","■","□","□"}}; break; case 2: turnedBlock[][] = {{"□","□","□","□"}, {"□","□","□","□"}, {"■","■","□","□"}, {"□","■","■","□"}}; break; case 3: turnedBlock[][] = {{"□","□","□","□"}, {"□","■","□","□"}, {"■","■","□","□"}, {"■","□","□","□"}}; break; case 4: turnedBlock[][] = {{"□","□","□","□"}, {"■","■","□","□"}, {"□","■","■","□"}, {"□","□","□","□"}}; break; } //テトリミノ「 ■ // ■■■」の回転 } else if (Tetorimino == 5) { turnedBlock[][] = {{"□","□","■","□"}, {"■","■","■","□"}, {"□","□","□","□"}, {"□","□","□","□"}}; System.out.plintln("回転させたい図の番号を入力してください") int bango =("u"); bango = br.readLine(); switch (bango) { case 1: turnedBlock[][] = {{"□","■","□","□"}, {"□","■","□","□"}, {"□","■","■","□"}, {"□","□","□","□"}}; break; case 2: turnedBlock[][] = {{"□","□","□","□"}, {"■","■","■","□"}, {"■","□","□","□"}, {"□","□","□","□"}}; break; case 3: turnedBlock[][] = {{"■","■","□","□"}, {"□","■","□","□"}, {"□","■","□","□"}, {"□","□","□","□"}}; break; case 4: turnedBlock[][] = {{"□","□","■","□"}, {"■","■","■","□"}, {"□","□","□","□"}, {"□","□","□","□"}}; break; } //テトリミノ「■ // ■■■」の回転 } else { turnedBlock[][] = {{"■","□","□","□"}, {"■","■","■","□"}, {"□","□","□","□"}, {"□","□","□","□"}}; System.out.plintln("回転させたい図の番号を入力してください") int bango =("u"); bango = br.readLine(); switch (bango) { case 1: turnedBlock[][] = {{"□","■","■","□"}, {"□","■","□","□"}, {"□","■","□","□"}, {"□","□","□","□"}}; break; case 2: turnedBlock[][] = {{"□","□","□","□"}, {"■","■","■","□"}, {"□","□","■","□"}, {"□","□","□","□"}}; break; case 3: turnedBlock[][] = {{"□","■","□","□"}, {"□","■","□","□"}, {"■","■","□","□"}, {"□","□","□","□"}}; break; case 4: turnedBlock[][] = {{"■","□","□","□"}, {"■","■","■","□"}, {"□","□","□","□"}, {"□","□","□","□"}}; break; } }
}
}
回答4件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/02/01 11:42