Skip to content

Instantly share code, notes, and snippets.

@tipochka
Created September 5, 2016 09:36
Show Gist options
  • Save tipochka/2f8a697eb4e46fc6ade44004e17912cf to your computer and use it in GitHub Desktop.
Save tipochka/2f8a697eb4e46fc6ade44004e17912cf to your computer and use it in GitHub Desktop.
Фишки на доске. n -- это количество фишек с каждой стороны
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