Created
September 5, 2016 09:36
-
-
Save tipochka/2f8a697eb4e46fc6ade44004e17912cf to your computer and use it in GitHub Desktop.
Фишки на доске. n -- это количество фишек с каждой стороны
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lecture5_practic; | |
/** | |
* Created by Xepcoh on 05.09.2016 | |
*/ | |
public class Desc { | |
public static void main(String[] args) { | |
int n = 1; | |
boolean white = true; | |
for(int i = 1; i<=n; i++) { | |
for (int j=1; j<=i; j++) { | |
String r = (white)?"w"+j:"b"+j; | |
System.out.println(r); | |
} | |
white = !white; | |
} | |
for (int i = 1; i<=n; i++){ | |
String r = (white)?"w"+i:"b"+i; | |
System.out.println(r); | |
} | |
white = !white; | |
for (int i = n; i>=1; i--) { | |
for (int j=n+1-i; j<=n; j++) { | |
String r = (white)?"w"+j:"b"+j; | |
System.out.println(r); | |
} | |
white = !white; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment