Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
.gradle
build
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: java

jdk:
- oraclejdk8

sudo: false
addons:
apt:
packages:
- oracle-java8-installer
15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
group 'ru.spbau.shevchenko'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
compile group: 'org.reactfx', name: 'reactfx', version: '2.0-M5'
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Thu May 11 15:40:34 MSK 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
164 changes: 164 additions & 0 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 90 additions & 0 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = 'PairGame'

29 changes: 29 additions & 0 deletions src/main/java/Field.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import java.util.ArrayList;
import java.util.Collections;

class Field {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

джавадоки?

private final int[][] field;

Field(int n){
if (n % 2 == 1) {
throw new IllegalArgumentException("N should be even!");
}
field = new int[n][n];
ArrayList<Integer> bits = new ArrayList<>();
for (int i = 0; i < n*n; i++) {
bits.add(i % 2);
}
Collections.shuffle(bits);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
field[i][j] = bits.get(i*n + j);
}
}
}

int get(int i, int j){
return field[i][j];
}


}
Loading