Commit 17fe9228 authored by 9731301's avatar 9731301

Add Pentago Class

parent 43e33a78
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="63729159-695b-4499-ba7f-f31e81a0234c" name="Default Changelist" comment=""> <list default="true" id="63729159-695b-4499-ba7f-f31e81a0234c" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -59,6 +58,7 @@ ...@@ -59,6 +58,7 @@
<workItem from="1586099364327" duration="87000" /> <workItem from="1586099364327" duration="87000" />
<workItem from="1586105455800" duration="97000" /> <workItem from="1586105455800" duration="97000" />
<workItem from="1586105975356" duration="8819000" /> <workItem from="1586105975356" duration="8819000" />
<workItem from="1586162373379" duration="6300000" />
</task> </task>
<servers /> <servers />
</component> </component>
...@@ -66,26 +66,42 @@ ...@@ -66,26 +66,42 @@
<option name="version" value="1" /> <option name="version" value="1" />
</component> </component>
<component name="WindowStateProjectService"> <component name="WindowStateProjectService">
<state width="1493" height="21" key="GridCell.Tab.0.bottom" timestamp="1586117772912"> <state width="1493" height="2" key="GridCell.Tab.0.bottom" timestamp="1586168477737">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1493" height="21" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1586117772912" /> <state width="1493" height="2" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1586168477737" />
<state width="1493" height="21" key="GridCell.Tab.0.center" timestamp="1586117772912"> <state width="1493" height="2" key="GridCell.Tab.0.center" timestamp="1586168477737">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1493" height="21" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1586117772912" /> <state width="1493" height="2" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1586168477737" />
<state width="1493" height="21" key="GridCell.Tab.0.left" timestamp="1586117772912"> <state width="1493" height="2" key="GridCell.Tab.0.left" timestamp="1586168477737">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1493" height="21" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1586117772912" /> <state width="1493" height="2" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1586168477737" />
<state width="1493" height="21" key="GridCell.Tab.0.right" timestamp="1586117772912"> <state width="1493" height="2" key="GridCell.Tab.0.right" timestamp="1586168477737">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1493" height="21" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1586117772912" /> <state width="1493" height="2" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1586168477737" />
<state x="281" y="271" key="com.intellij.ide.util.TipDialog" timestamp="1586106017061"> <state width="1493" height="358" key="GridCell.Tab.1.bottom" timestamp="1586168209278">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state x="281" y="271" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1586106017061" /> <state width="1493" height="358" key="GridCell.Tab.1.bottom/0.0.1536.824@0.0.1536.824" timestamp="1586168209278" />
<state width="1493" height="358" key="GridCell.Tab.1.center" timestamp="1586168209278">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="358" key="GridCell.Tab.1.center/0.0.1536.824@0.0.1536.824" timestamp="1586168209278" />
<state width="1493" height="358" key="GridCell.Tab.1.left" timestamp="1586168209278">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="358" key="GridCell.Tab.1.left/0.0.1536.824@0.0.1536.824" timestamp="1586168209278" />
<state width="1493" height="358" key="GridCell.Tab.1.right" timestamp="1586168209278">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="358" key="GridCell.Tab.1.right/0.0.1536.824@0.0.1536.824" timestamp="1586168209278" />
<state x="281" y="271" key="com.intellij.ide.util.TipDialog" timestamp="1586162378517">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="281" y="271" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1586162378517" />
<state x="25" y="67" key="new project wizard" timestamp="1586105483065"> <state x="25" y="67" key="new project wizard" timestamp="1586105483065">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
......
...@@ -74,4 +74,5 @@ public class Block { ...@@ -74,4 +74,5 @@ public class Block {
public ArrayList<Cell> getAllCells() { public ArrayList<Cell> getAllCells() {
return allCells; return allCells;
} }
} }
...@@ -22,33 +22,32 @@ public class Pentago { ...@@ -22,33 +22,32 @@ public class Pentago {
blocks.add(block); blocks.add(block);
} }
j = 0 ; j = 0;
for ( i = 0 ; i < 4 ;){ for ( i = 0 ; i < 4 ;){
System.out.print("| " + blocks.get(i).getAllCells().get(j).getColor()+ " "+ blocks.get(i).getAllCells().get(j++).getColor() +" "+ blocks.get(i).getAllCells().get(j++).getColor() + " |"); System.out.print("| " + blocks.get(i).getAllCells().get(j++).getColor()+ " "+ blocks.get(i).getAllCells().get(j++).getColor() +" "+ blocks.get(i).getAllCells().get(j++).getColor() + " |");
if ( i == 3 && j == 8){ if ( i == 3 && j == 9){
break; break;
} }
if ((i == 0 || i == 2) && j == 2 ){ if ((i == 0 || i == 2) && j == 3 ){
i++; i++;
j = 0; j = 0;
} }
else if ((i == 0 || i == 2 ) && j == 5){ else if ((i == 0 || i == 2 ) && j == 6){
i++; i++;
j = 3; j = 3;
} }
else if(( i == 0 || i == 2 ) && j == 8){ else if(( i == 0 || i == 2 ) && j == 9){
i++; i++;
j = 6; j = 6;
} }
else if (( i == 1 )&& j == 8){ else if (( i == 1 )&& j == 9){
i = 2 ; i = 2 ;
j = 0 ; j = 0 ;
System.out.println("\n------------------"); System.out.println("\n------------------");
continue; continue;
} }
else if ( (j == 2 || j == 5 ) && ( i == 1 || i == 3)){ else if ( (j == 3 || j == 6 ) && ( i == 1 || i == 3)){
i--; i--;
j++;
System.out.println(); System.out.println();
} }
} }
...@@ -71,33 +70,36 @@ public class Pentago { ...@@ -71,33 +70,36 @@ public class Pentago {
// System.out.println("plz enter how change position? right/left"); // System.out.println("plz enter how change position? right/left");
// turn = scanner.next().trim(); // turn = scanner.next().trim();
// blocks.get(blockNumber).changePositionOfBlock(turn); // blocks.get(blockNumber).changePositionOfBlock(turn);
j = 0 ; j = 0 ;
i = 0;
System.out.println(blocks.get(i).getAllCells().get(j++).getColor()+ " "+ blocks.get(i).getAllCells().get(j ++).getColor());
j = 0;
for ( i = 0 ; i < 4 ;){ for ( i = 0 ; i < 4 ;){
System.out.print("| " + blocks.get(i).getAllCells().get(j).getColor()+ " "+ blocks.get(i).getAllCells().get(j+1).getColor() +" "+ blocks.get(i).getAllCells().get(j+2).getColor() + " |"); System.out.print("| " + blocks.get(i).getAllCells().get(j++).getColor()+ " "+ blocks.get(i).getAllCells().get(j++).getColor() +" "+ blocks.get(i).getAllCells().get(j++).getColor() + " |");
if ( i == 3 && j == 8){ if ( i == 3 && j == 9){
break; break;
} }
if ((i == 0 || i == 2) && j == 2 ){ if ((i == 0 || i == 2) && j == 3 ){
i++; i++;
j = 0; j = 0;
} }
else if ((i == 0 || i == 2 ) && j == 5){ else if ((i == 0 || i == 2 ) && j == 6){
i++; i++;
j = 3; j = 3;
} }
else if(( i == 0 || i == 2 ) && j == 8){ else if(( i == 0 || i == 2 ) && j == 9){
i++; i++;
j = 6; j = 6;
} }
else if (( i == 1 )&& j == 8){ else if (( i == 1 )&& j == 9){
i = 2 ; i = 2 ;
j = 0 ; j = 0 ;
System.out.println("\n------------------"); System.out.println("\n------------------");
continue; continue;
} }
else if ( (j == 2 || j == 5 ) && ( i == 1 || i == 3)){ else if ( (j == 3 || j == 6 ) && ( i == 1 || i == 3)){
i--; i--;
j++;
System.out.println(); System.out.println();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment