Réorganisation du dossier
@@ -0,0 +1,26 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("sae.chuzzle", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="sae.chuzzle">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:label="Chuzzle"
|
||||
android:theme="@android:style/Theme.Light.NoTitleBar">
|
||||
|
||||
<!-- Point d'entrée : le menu principal -->
|
||||
<activity android:name=".MenuActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Partie avec graine : retour arrière = MenuActivity -->
|
||||
<activity
|
||||
android:name=".SeedActivity"
|
||||
android:parentActivityName=".MenuActivity"/>
|
||||
|
||||
<!-- Options : retour arrière = MenuActivity -->
|
||||
<activity
|
||||
android:name=".OptionsActivity"
|
||||
android:parentActivityName=".MenuActivity"/>
|
||||
|
||||
<!-- Jeu : retour arrière = MenuActivity -->
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:parentActivityName=".MenuActivity"/>
|
||||
|
||||
<!-- Fin de partie : retour arrière = MenuActivity -->
|
||||
<activity
|
||||
android:name=".FinPartieActivity"
|
||||
android:parentActivityName=".MenuActivity"/>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,209 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class Controleur {
|
||||
|
||||
private final Activity activite;
|
||||
private final EtatJeu etatJeu;
|
||||
private final VueGrille vueGrille;
|
||||
private final long graine;
|
||||
|
||||
private final TextView tvScore;
|
||||
private final TextView tvCoups;
|
||||
|
||||
// Hard Mode logic
|
||||
private final boolean hardMode;
|
||||
private GestionnaireObjectifs gestionnaireObjectifs;
|
||||
private Objectif objectifActuel;
|
||||
private TextView tvObjectif;
|
||||
private TextView tvNbObjectifs;
|
||||
private TextView tvCles;
|
||||
private Button btnReinitialisationObjectif;
|
||||
private View layoutCles;
|
||||
|
||||
public Controleur(Activity activite, EtatJeu etatJeu, VueGrille vueGrille,
|
||||
long graine, TextView tvScore, TextView tvCoups,
|
||||
boolean hardMode) {
|
||||
|
||||
|
||||
|
||||
this.activite = activite;
|
||||
this.etatJeu = etatJeu;
|
||||
this.vueGrille = vueGrille;
|
||||
this.graine = graine;
|
||||
this.tvScore = tvScore;
|
||||
this.tvCoups = tvCoups;
|
||||
this.hardMode = hardMode;
|
||||
|
||||
if (hardMode) {
|
||||
this.gestionnaireObjectifs = new GestionnaireObjectifs(graine);
|
||||
this.tvObjectif = activite.findViewById(R.id.tvObjectif);
|
||||
this.tvNbObjectifs = activite.findViewById(R.id.tvNbObjectifs);
|
||||
this.tvCles = activite.findViewById(R.id.tvCles);
|
||||
this.layoutCles = activite.findViewById(R.id.layoutCles);
|
||||
this.btnReinitialisationObjectif = activite.findViewById(R.id.btnReinitialisationObjectif);
|
||||
|
||||
if (tvObjectif != null) tvObjectif.setVisibility(View.VISIBLE);
|
||||
if (tvNbObjectifs != null) tvNbObjectifs.setVisibility(View.VISIBLE);
|
||||
if (layoutCles != null) layoutCles.setVisibility(View.VISIBLE);
|
||||
|
||||
|
||||
if (btnReinitialisationObjectif != null) {
|
||||
btnReinitialisationObjectif.setOnClickListener(v -> reinitialiserObjectif());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rafraichirAffichage();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initialise l'objectif au début de la partie ou lors de la restauration.
|
||||
*/
|
||||
public void initialiserObjectif(Bundle savedState) {
|
||||
if (!hardMode) return;
|
||||
|
||||
gestionnaireObjectifs.restaurer(savedState);
|
||||
objectifActuel = Objectif.restaurer(savedState);
|
||||
|
||||
if (objectifActuel == null) {
|
||||
objectifActuel = gestionnaireObjectifs.genererObjectif();
|
||||
}
|
||||
rafraichirAffichage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gère la validation d'un coup réussi (mise à jour objectif, score, affichage).
|
||||
* Centralise la logique pour être appelé par le bouton ET par le tactile.
|
||||
*/
|
||||
public void gererFinDeCoup() {
|
||||
|
||||
// 1 clé tous les 5 coups
|
||||
if (hardMode && etatJeu.obtenirNbCoups() % 5 == 0) {
|
||||
gestionnaireObjectifs.ajouterCle();
|
||||
}
|
||||
// --- Logique Hard Mode
|
||||
if (hardMode && objectifActuel != null) {
|
||||
// 1. Décrémenter les coups de l'objectif
|
||||
objectifActuel.decrementerCoups();
|
||||
|
||||
// 2. Compter les séries de la couleur cible
|
||||
int[] series = etatJeu.getSeriesParCouleurDernierCoup();
|
||||
objectifActuel.ajouterSeries(series[objectifActuel.getCouleur()]);
|
||||
|
||||
// 3. Vérifier réussite ou échec
|
||||
if (objectifActuel.estReussi()) {
|
||||
|
||||
gestionnaireObjectifs.incrementerReussites();
|
||||
objectifActuel = gestionnaireObjectifs.genererObjectif();
|
||||
} else if (objectifActuel.estEchoue()) {
|
||||
// Plus de coups disponibles et objectif non réussi -> fin de partie immédiate
|
||||
Toast.makeText(activite, "Objectif échoué !",
|
||||
Toast.LENGTH_SHORT
|
||||
).show();
|
||||
|
||||
etatJeu.forcerFinDePartie();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
rafraichirAffichage();
|
||||
verifierFinDePartie();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tente de réinitialiser l'objectif en cours en consommant 3 clés.
|
||||
* Affiche un Toast si le joueur n'a pas assez de clés.
|
||||
*/
|
||||
public void reinitialiserObjectif() {
|
||||
if (!hardMode || gestionnaireObjectifs == null) return;
|
||||
|
||||
if (gestionnaireObjectifs.consommerCles()) {
|
||||
objectifActuel = gestionnaireObjectifs.genererObjectif();
|
||||
rafraichirAffichage();
|
||||
} else {
|
||||
Toast.makeText(activite, "Pas assez de clés !", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lancer l'écran de fin.
|
||||
*/
|
||||
public void verifierFinDePartie() {
|
||||
int nbARetenir;
|
||||
if (hardMode) {
|
||||
nbARetenir = gestionnaireObjectifs.getNbObjectifsRealises();
|
||||
} else {
|
||||
nbARetenir = 0;
|
||||
}
|
||||
|
||||
String description;
|
||||
if (hardMode == true && objectifActuel != null) {
|
||||
description = objectifActuel.getDescription();
|
||||
} else {
|
||||
description = null;
|
||||
}
|
||||
|
||||
if (etatJeu.estTerminee()) {
|
||||
FinPartieActivity.demarrer(
|
||||
activite,
|
||||
etatJeu.obtenirScore(),
|
||||
etatJeu.obtenirNbCoups(),
|
||||
graine,
|
||||
nbARetenir,
|
||||
description,
|
||||
etatJeu.obtenirGrille(),
|
||||
etatJeu.obtenirVerrous()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void rafraichirAffichage() {
|
||||
tvScore.setText("Score : " + etatJeu.obtenirScore());
|
||||
tvCoups.setText("Coups : " + etatJeu.obtenirNbCoups());
|
||||
vueGrille.definirGrille(etatJeu.obtenirGrille());
|
||||
vueGrille.definirVerrous(etatJeu.obtenirVerrous());
|
||||
|
||||
if (hardMode && objectifActuel != null) {
|
||||
if (tvObjectif != null){
|
||||
tvObjectif.setText(objectifActuel.getDescription());
|
||||
}
|
||||
if (tvNbObjectifs != null){
|
||||
tvNbObjectifs.setText("Objectifs réussis : " + gestionnaireObjectifs.getNbObjectifsRealises());
|
||||
}
|
||||
|
||||
int nbCles = gestionnaireObjectifs.getNbCles();
|
||||
if (tvCles != null) {
|
||||
tvCles.setText("🗝️ Clés : " + nbCles + " (Max 1)");
|
||||
}
|
||||
if (btnReinitialisationObjectif != null) {
|
||||
// Grisé si 0 clé
|
||||
float alpha;
|
||||
if (nbCles >= 1) {
|
||||
alpha = 1f; // visible
|
||||
} else {
|
||||
alpha = 0.4f; // grisé
|
||||
}
|
||||
btnReinitialisationObjectif.setAlpha(alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sauvegarderEtat(Bundle out) {
|
||||
if (hardMode) {
|
||||
gestionnaireObjectifs.sauvegarder(out);
|
||||
if (objectifActuel != null) {
|
||||
objectifActuel.sauvegarder(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.os.Bundle;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Gère la session de jeu (score, coups, état de la partie) et délègue la
|
||||
* manipulation
|
||||
* physique de la grille à la classe Plateau.
|
||||
*/
|
||||
public class EtatJeu {
|
||||
|
||||
private final Plateau plateau;
|
||||
private final Random aleatoire;
|
||||
private final boolean hardMode;
|
||||
|
||||
private int score = 0;
|
||||
private int nbCoups = 0;
|
||||
private boolean partieTerminee = false;
|
||||
|
||||
private final int[] seriesParCouleurDernierCoup = new int[Plateau.NB_TYPES];
|
||||
|
||||
public EtatJeu(long graine, boolean hardMode) {
|
||||
this.aleatoire = new Random(graine);
|
||||
this.hardMode = hardMode;
|
||||
this.plateau = new Plateau(this.aleatoire);
|
||||
}
|
||||
|
||||
// --- Getters ---
|
||||
|
||||
public int obtenirScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public int obtenirNbCoups() {
|
||||
return nbCoups;
|
||||
}
|
||||
|
||||
public boolean estTerminee() {
|
||||
return partieTerminee;
|
||||
}
|
||||
|
||||
public int[] getSeriesParCouleurDernierCoup() {
|
||||
return seriesParCouleurDernierCoup;
|
||||
}
|
||||
|
||||
public int[][] obtenirGrille() {
|
||||
return plateau.copierGrille();
|
||||
}
|
||||
|
||||
public boolean[][] obtenirVerrous() {
|
||||
// Copie manuelle pour respecter l'encapsulation
|
||||
boolean[][] v = plateau.getVerrous();
|
||||
boolean[][] copie = new boolean[Plateau.NB_LIGNES][Plateau.NB_COLONNES];
|
||||
for (int l = 0; l < Plateau.NB_LIGNES; l++) {
|
||||
System.arraycopy(v[l], 0, copie[l], 0, Plateau.NB_COLONNES);
|
||||
}
|
||||
return copie;
|
||||
}
|
||||
|
||||
// --- Actions ---
|
||||
|
||||
public boolean appliquerCoup(boolean estLigne, int index, int sens) {
|
||||
if (partieTerminee || plateau.estBloque(estLigne, index)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int[][] sauvegarde = plateau.copierGrille();
|
||||
if (estLigne) {
|
||||
plateau.decalerLigne(index, sens);
|
||||
} else {
|
||||
plateau.decalerColonne(index, sens);
|
||||
}
|
||||
|
||||
if (plateau.trouverSeries().isEmpty()) {
|
||||
plateau.restaurerGrille(sauvegarde);
|
||||
return false;
|
||||
}
|
||||
|
||||
nbCoups++;
|
||||
resetSeriesDernierCoup();
|
||||
score += resoudreCascades();
|
||||
|
||||
plateau.ajouterVerrou(nbCoups);
|
||||
if (hardMode) {
|
||||
plateau.ajouterVerrou(nbCoups);
|
||||
}
|
||||
|
||||
if (!aUnCoupValide()) {
|
||||
partieTerminee = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private int resoudreCascades() {
|
||||
int baseTotal = 0;
|
||||
int nbSeriesTotal = 0;
|
||||
List<int[]> series = plateau.trouverSeries();
|
||||
|
||||
while (!series.isEmpty()) {
|
||||
int[] result = traiterSeries(series);
|
||||
baseTotal += result[0];
|
||||
nbSeriesTotal += result[1];
|
||||
|
||||
boolean[][] masque = creerMasque(series);
|
||||
plateau.libererVerrous(masque);
|
||||
plateau.faireTomber(masque);
|
||||
|
||||
series = plateau.trouverSeries();
|
||||
}
|
||||
|
||||
if (nbSeriesTotal == 0) {
|
||||
return 0;
|
||||
}
|
||||
return (int) (baseTotal * (1.0 + (nbSeriesTotal - 1) * 0.5));
|
||||
}
|
||||
|
||||
// --- Aide à la résolution
|
||||
|
||||
/**
|
||||
* Parcourt les séries détectées, calcule les points de base et compte le nombre
|
||||
* de séries.
|
||||
* Vérifie la couleur des cellules pour délimiter correctement les séries.
|
||||
*
|
||||
* int[2] : [0] = points de base, [1] = nombre de séries
|
||||
*/
|
||||
private int[] traiterSeries(List<int[]> series) {
|
||||
boolean[][] masque = creerMasque(series);
|
||||
int[][] g = plateau.getGrille();
|
||||
int pts = 0;
|
||||
int count = 0;
|
||||
|
||||
// Horizontal
|
||||
for (int l = 0; l < Plateau.NB_LIGNES; l++) {
|
||||
int c = 0;
|
||||
while (c < Plateau.NB_COLONNES) {
|
||||
if (masque[l][c]) {
|
||||
int type = g[l][c];
|
||||
int fin = c + 1;
|
||||
while (fin < Plateau.NB_COLONNES && masque[l][fin] && g[l][fin] == type) {
|
||||
fin++;
|
||||
}
|
||||
if (fin - c >= 3) {
|
||||
pts += pointsPourLongueur(fin - c);
|
||||
seriesParCouleurDernierCoup[type]++;
|
||||
count++;
|
||||
}
|
||||
c = fin;
|
||||
} else {
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Vertical
|
||||
for (int c = 0; c < Plateau.NB_COLONNES; c++) {
|
||||
int l = 0;
|
||||
while (l < Plateau.NB_LIGNES) {
|
||||
if (masque[l][c]) {
|
||||
int type = g[l][c];
|
||||
int fin = l + 1;
|
||||
while (fin < Plateau.NB_LIGNES && masque[fin][c] && g[fin][c] == type) {
|
||||
fin++;
|
||||
}
|
||||
if (fin - l >= 3) {
|
||||
pts += pointsPourLongueur(fin - l);
|
||||
seriesParCouleurDernierCoup[type]++;
|
||||
count++;
|
||||
}
|
||||
l = fin;
|
||||
} else {
|
||||
l++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new int[] { pts, count };
|
||||
}
|
||||
|
||||
private int pointsPourLongueur(int n) {
|
||||
if (n == 3)
|
||||
return 8;
|
||||
if (n == 4)
|
||||
return 16;
|
||||
if (n == 5)
|
||||
return 32;
|
||||
return 64;
|
||||
}
|
||||
|
||||
private boolean[][] creerMasque(List<int[]> positions) {
|
||||
boolean[][] m = new boolean[Plateau.NB_LIGNES][Plateau.NB_COLONNES];
|
||||
for (int[] p : positions) {
|
||||
m[p[0]][p[1]] = true;
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
private void resetSeriesDernierCoup() {
|
||||
for (int i = 0; i < Plateau.NB_TYPES; i++) {
|
||||
seriesParCouleurDernierCoup[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean aUnCoupValide() {
|
||||
for (int i = 0; i < Plateau.NB_LIGNES; i++) {
|
||||
if (plateau.estBloque(true, i)) {
|
||||
continue;
|
||||
}
|
||||
for (int s = 1; s < Plateau.NB_COLONNES; s++) {
|
||||
if (simulerCoup(true, i, s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < Plateau.NB_COLONNES; j++) {
|
||||
if (plateau.estBloque(false, j)) {
|
||||
continue;
|
||||
}
|
||||
for (int s = 1; s < Plateau.NB_LIGNES; s++) {
|
||||
if (simulerCoup(false, j, s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean simulerCoup(boolean estLigne, int idx, int s) {
|
||||
int[][] save = plateau.copierGrille();
|
||||
if (estLigne) {
|
||||
plateau.decalerLigne(idx, s);
|
||||
} else {
|
||||
plateau.decalerColonne(idx, s);
|
||||
}
|
||||
boolean ok = !plateau.trouverSeries().isEmpty();
|
||||
plateau.restaurerGrille(save);
|
||||
return ok;
|
||||
}
|
||||
|
||||
public void forcerFinDePartie() {
|
||||
partieTerminee = true;
|
||||
}
|
||||
|
||||
public void sauvegarderEtat(Bundle b) {
|
||||
int[] g = new int[36];
|
||||
boolean[] v = new boolean[36];
|
||||
int[][] grid = plateau.getGrille();
|
||||
boolean[][] lk = plateau.getVerrous();
|
||||
for (int i = 0; i < Plateau.NB_LIGNES; i++) {
|
||||
for (int j = 0; j < Plateau.NB_COLONNES; j++) {
|
||||
g[i * Plateau.NB_LIGNES + j] = grid[i][j];
|
||||
v[i * Plateau.NB_LIGNES + j] = lk[i][j];
|
||||
}
|
||||
}
|
||||
b.putIntArray("grille", g);
|
||||
b.putBooleanArray("verrous", v);
|
||||
b.putInt("score", score);
|
||||
b.putInt("nbCoups", nbCoups);
|
||||
b.putBoolean("partieTerminee", partieTerminee);
|
||||
}
|
||||
|
||||
public void restaurerEtat(Bundle b) {
|
||||
if (!b.containsKey("grille")) {
|
||||
return;
|
||||
}
|
||||
int[] g = b.getIntArray("grille");
|
||||
boolean[] v = b.getBooleanArray("verrous");
|
||||
int[][] grid = plateau.getGrille();
|
||||
boolean[][] lk = plateau.getVerrous();
|
||||
for (int i = 0; i < Plateau.NB_LIGNES; i++) {
|
||||
for (int j = 0; j < Plateau.NB_COLONNES; j++) {
|
||||
grid[i][j] = g[i * Plateau.NB_LIGNES + j];
|
||||
lk[i][j] = v[i * Plateau.NB_LIGNES + j];
|
||||
}
|
||||
}
|
||||
score = b.getInt("score");
|
||||
nbCoups = b.getInt("nbCoups");
|
||||
partieTerminee = b.getBoolean("partieTerminee");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class FinPartieActivity extends Activity {
|
||||
|
||||
private FinPartieControleur controleur;
|
||||
private Button btnMenu;
|
||||
|
||||
/**
|
||||
* Méthode statique pour démarrer l'activité avec toutes les données nécessaires.
|
||||
*/
|
||||
public static void demarrer(Activity source, int score, int nbCoups, long graine,
|
||||
int objectifsReussis, String objectifDescription,
|
||||
int[][] grille, boolean[][] verrous) {
|
||||
Intent intent = new Intent(source, FinPartieActivity.class);
|
||||
intent.putExtra("score", score);
|
||||
intent.putExtra("nbCoups", nbCoups);
|
||||
intent.putExtra("graine", graine);
|
||||
intent.putExtra("objectifsReussis", objectifsReussis);
|
||||
intent.putExtra("objectifDescription", objectifDescription);
|
||||
|
||||
// Aplatissement de la grille
|
||||
int nbLignes = grille.length;
|
||||
int nbCols = grille[0].length;
|
||||
int[] grillePlat = new int[nbLignes * nbCols];
|
||||
for (int l = 0; l < nbLignes; l++)
|
||||
for (int c = 0; c < nbCols; c++)
|
||||
grillePlat[l * nbCols + c] = grille[l][c];
|
||||
|
||||
intent.putExtra("grille", grillePlat);
|
||||
intent.putExtra("nbLignes", nbLignes);
|
||||
intent.putExtra("nbCols", nbCols);
|
||||
|
||||
// Aplatissement des verrous
|
||||
boolean[] verrousPlat = new boolean[nbLignes * nbCols];
|
||||
for (int l = 0; l < nbLignes; l++)
|
||||
for (int c = 0; c < nbCols; c++)
|
||||
verrousPlat[l * nbCols + c] = verrous[l][c];
|
||||
|
||||
intent.putExtra("verrous", verrousPlat);
|
||||
|
||||
source.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_fin_partie);
|
||||
|
||||
// Récupérer les données passées
|
||||
int score = getIntent().getIntExtra("score", 0);
|
||||
int nbCoups = getIntent().getIntExtra("nbCoups", 0);
|
||||
long graine = getIntent().getLongExtra("graine", 0L);
|
||||
|
||||
// Afficher les données textuelles
|
||||
TextView tvScore = findViewById(R.id.tvFinScore);
|
||||
TextView tvCoups = findViewById(R.id.tvFinCoups);
|
||||
TextView tvGraine = findViewById(R.id.tvFinGraine);
|
||||
|
||||
tvScore.setText(String.valueOf(score));
|
||||
tvCoups.setText(String.valueOf(nbCoups));
|
||||
tvGraine.setText(String.valueOf(graine));
|
||||
|
||||
// Objectif en cours (hard mode)
|
||||
String objectifDesc = getIntent().getStringExtra("objectifDescription");
|
||||
TextView tvLabelObjectif = findViewById(R.id.tvLabelObjectif);
|
||||
TextView tvFinObjectif = findViewById(R.id.tvFinObjectif);
|
||||
if (objectifDesc != null) {
|
||||
tvLabelObjectif.setVisibility(android.view.View.VISIBLE);
|
||||
tvFinObjectif.setVisibility(android.view.View.VISIBLE);
|
||||
tvFinObjectif.setText(objectifDesc);
|
||||
}
|
||||
|
||||
// Reconstruire et afficher la grille finale
|
||||
int nbLignes = getIntent().getIntExtra("nbLignes", 6);
|
||||
int nbCols = getIntent().getIntExtra("nbCols", 6);
|
||||
int[] grillePlat = getIntent().getIntArrayExtra("grille");
|
||||
boolean[] verrousPlat = getIntent().getBooleanArrayExtra("verrous");
|
||||
|
||||
VueGrille vueGrilleFinale = findViewById(R.id.vueGrilleFinale);
|
||||
|
||||
if (grillePlat != null && grillePlat.length == nbLignes * nbCols) {
|
||||
int[][] grille = new int[nbLignes][nbCols];
|
||||
for (int l = 0; l < nbLignes; l++)
|
||||
for (int c = 0; c < nbCols; c++)
|
||||
grille[l][c] = grillePlat[l * nbCols + c];
|
||||
vueGrilleFinale.definirGrille(grille);
|
||||
}
|
||||
|
||||
if (verrousPlat != null && verrousPlat.length == nbLignes * nbCols) {
|
||||
boolean[][] verrous = new boolean[nbLignes][nbCols];
|
||||
for (int l = 0; l < nbLignes; l++)
|
||||
for (int c = 0; c < nbCols; c++)
|
||||
verrous[l][c] = verrousPlat[l * nbCols + c];
|
||||
vueGrilleFinale.definirVerrous(verrous);
|
||||
}
|
||||
|
||||
|
||||
controleur = new FinPartieControleur(this);
|
||||
btnMenu = findViewById(R.id.btnFinMenu);
|
||||
btnMenu.setOnClickListener(controleur);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
retourMenu();
|
||||
}
|
||||
|
||||
public void retourMenu() {
|
||||
Intent intent = new Intent(this, MenuActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Contrôleur pour l'écran de fin de partie.
|
||||
* Gère les interactions utilisateur
|
||||
*/
|
||||
public class FinPartieControleur implements View.OnClickListener {
|
||||
|
||||
private final Activity activity;
|
||||
|
||||
public FinPartieControleur(Activity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (v.getId() == R.id.btnFinMenu) {
|
||||
((FinPartieActivity) activity).retourMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.os.Bundle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Gère la génération aléatoire et le comptage des objectifs.
|
||||
*/
|
||||
public class GestionnaireObjectifs {
|
||||
private final Random random;
|
||||
private int nbObjectifsRealises = 0;
|
||||
private int nbCles = 0;
|
||||
|
||||
public GestionnaireObjectifs(long graine) {
|
||||
|
||||
this.random = new Random(graine);
|
||||
}
|
||||
|
||||
/**
|
||||
* Génère un nouvel objectif en respectant les probabilités de difficulté.
|
||||
*/
|
||||
public Objectif genererObjectif() {
|
||||
List<Objectif> pool = new ArrayList<>();
|
||||
int totalPoids = 0;
|
||||
|
||||
// M (nbCoupsMax) entre 2 et 5.
|
||||
// N (nbSeriesCible) tel que M - N >= 1 et N <= 3.
|
||||
for (int m = 2; m <= 5; m++) {
|
||||
for (int n = 1; n <= m - 1 && n <= 3; n++) {
|
||||
// Probabilité inversement proportionnelle à la facilité (M-N).
|
||||
// Plus (M-N) est petit, plus c'est dur.
|
||||
int diff = m - n;
|
||||
int poids = diff * diff; // On utilise le carré pour accentuer la différence de probabilité
|
||||
|
||||
for (int color = 0; color < 7; color++) {
|
||||
pool.add(new Objectif(color, n, m, poids));
|
||||
totalPoids += poids;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (totalPoids == 0) return null;
|
||||
|
||||
int tirage = random.nextInt(totalPoids);
|
||||
int cumul = 0;
|
||||
for (Objectif obj : pool) {
|
||||
cumul += obj.getPoids();
|
||||
if (tirage < cumul) {
|
||||
return new Objectif(obj.getCouleur(), obj.getNbSeriesCible(), obj.getNbCoupsMax(), obj.getPoids());
|
||||
}
|
||||
}
|
||||
return pool.get(0);
|
||||
}
|
||||
|
||||
public void incrementerReussites() {
|
||||
nbObjectifsRealises++;
|
||||
// 1 clé gagnée tous les 2 objectifs réussis, maximum 1 clés en stock
|
||||
if (nbObjectifsRealises % 2 == 0) {
|
||||
ajouterCle();
|
||||
}
|
||||
}
|
||||
|
||||
public int getNbCles() {
|
||||
return nbCles;
|
||||
}
|
||||
|
||||
public void ajouterCle() {
|
||||
// Ajoute une clé maximum 1 en stock
|
||||
nbCles = Math.min(nbCles + 1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Consomme 1 clé pour réinitialiser l'objectif.
|
||||
*/
|
||||
public boolean consommerCles() {
|
||||
if (nbCles >= 1) {
|
||||
nbCles -= 1;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getNbObjectifsRealises() {
|
||||
|
||||
return nbObjectifsRealises;
|
||||
}
|
||||
|
||||
public void sauvegarder(Bundle out) {
|
||||
out.putInt("nb_objectifs_total", nbObjectifsRealises);
|
||||
out.putInt("nb_cles", nbCles);
|
||||
}
|
||||
|
||||
public void restaurer(Bundle in) {
|
||||
if (in != null) {
|
||||
nbObjectifsRealises = in.getInt("nb_objectifs_total", 0);
|
||||
nbCles = in.getInt("nb_cles", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
public class GestionnaireTactile implements View.OnTouchListener {
|
||||
|
||||
private static final int NB_LIGNES = Plateau.NB_LIGNES;
|
||||
private static final int NB_COLONNES = Plateau.NB_COLONNES;
|
||||
private static final float SEUIL_DIRECTION_PX = 10f;
|
||||
|
||||
private final VueGrille vueGrille;
|
||||
private final EtatJeu etatJeu;
|
||||
private final Controleur controleur;
|
||||
|
||||
private float touchDebutX, touchDebutY;
|
||||
private int ligneTouchee, colonneTouchee;
|
||||
private Boolean estLigne;
|
||||
private int indexGlissement;
|
||||
private float decalagePx;
|
||||
private float tailleCase;
|
||||
|
||||
public GestionnaireTactile(VueGrille vueGrille,
|
||||
EtatJeu etatJeu,
|
||||
Controleur controleur) {
|
||||
this.vueGrille = vueGrille;
|
||||
this.etatJeu = etatJeu;
|
||||
this.controleur = controleur;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
|
||||
if (etatJeu.estTerminee()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (event.getAction()) {
|
||||
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
tailleCase = calculerTailleCase();
|
||||
gererDebut(event);
|
||||
return true;
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
gererMouvement(event);
|
||||
return true;
|
||||
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
gererFin(event.getAction() == MotionEvent.ACTION_UP);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void gererDebut(MotionEvent event) {
|
||||
touchDebutX = event.getX();
|
||||
touchDebutY = event.getY();
|
||||
estLigne = null;
|
||||
decalagePx = 0f;
|
||||
|
||||
float margeGauche = (vueGrille.getWidth() - tailleCase * NB_COLONNES) / 2f;
|
||||
float margeHaut = (vueGrille.getHeight() - tailleCase * NB_LIGNES) / 2f;
|
||||
|
||||
ligneTouchee = (int) ((touchDebutY - margeHaut) / tailleCase);
|
||||
colonneTouchee = (int) ((touchDebutX - margeGauche) / tailleCase);
|
||||
|
||||
ligneTouchee = Math.max(0, Math.min(NB_LIGNES - 1, ligneTouchee));
|
||||
colonneTouchee = Math.max(0, Math.min(NB_COLONNES - 1, colonneTouchee));
|
||||
}
|
||||
|
||||
private void gererMouvement(MotionEvent event) {
|
||||
float dx = event.getX() - touchDebutX;
|
||||
float dy = event.getY() - touchDebutY;
|
||||
|
||||
if (estLigne == null) {
|
||||
if (Math.abs(dx) > SEUIL_DIRECTION_PX || Math.abs(dy) > SEUIL_DIRECTION_PX) {
|
||||
estLigne = Math.abs(dx) >= Math.abs(dy);
|
||||
|
||||
if (estLigne) {
|
||||
indexGlissement = ligneTouchee;
|
||||
} else {
|
||||
indexGlissement = colonneTouchee;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (estLigne) {
|
||||
decalagePx = dx;
|
||||
} else {
|
||||
decalagePx = dy;
|
||||
}
|
||||
|
||||
// Affiche le glissement réel du doigt (permet la rotation multi-cases)
|
||||
vueGrille.definirGlissement(estLigne, indexGlissement, decalagePx);
|
||||
}
|
||||
|
||||
private void gererFin(boolean estRelachement) {
|
||||
|
||||
if (estLigne == null) {
|
||||
vueGrille.annulerGlissement();
|
||||
return;
|
||||
}
|
||||
|
||||
if (tailleCase <= 1f) {
|
||||
vueGrille.annulerGlissement();
|
||||
estLigne = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// Arrondi au nombre de cases le plus proche (permet ±1, ±2, ±3…)
|
||||
int nbCases = (int) Math.round(decalagePx / tailleCase);
|
||||
|
||||
if (nbCases != 0 && estRelachement) {
|
||||
boolean accepte = etatJeu.appliquerCoup(estLigne, indexGlissement, nbCases);
|
||||
if (accepte) {
|
||||
// MISE A JOUR DES OBJECTIFS APRES UN COUP TACTILE
|
||||
controleur.gererFinDeCoup();
|
||||
}
|
||||
}
|
||||
|
||||
vueGrille.annulerGlissement();
|
||||
estLigne = null;
|
||||
}
|
||||
|
||||
private float calculerTailleCase() {
|
||||
float l = vueGrille.getWidth();
|
||||
float h = vueGrille.getHeight();
|
||||
|
||||
if (l == 0 || h == 0) {
|
||||
return 1f;
|
||||
}
|
||||
|
||||
return Math.min(l / NB_COLONNES, h / NB_LIGNES);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
private Controleur controleur;
|
||||
private boolean hardMode;
|
||||
private EtatJeu etatJeu;
|
||||
|
||||
private Button btnMenu;
|
||||
private VueGrille vueGrille;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
// --- Modèle
|
||||
long graine = getIntent().getLongExtra("graine", System.currentTimeMillis());
|
||||
hardMode = getSharedPreferences("chuzzle_prefs", MODE_PRIVATE).getBoolean("hard_mode", false);
|
||||
|
||||
|
||||
etatJeu = new EtatJeu(graine, hardMode);
|
||||
|
||||
// --- Restauration si retour de pause
|
||||
if (savedInstanceState != null) {
|
||||
etatJeu.restaurerEtat(savedInstanceState);
|
||||
}
|
||||
|
||||
// --- Vue
|
||||
vueGrille = findViewById(R.id.vueGrille);
|
||||
|
||||
// --- Controleur métier
|
||||
controleur = new Controleur(
|
||||
this,
|
||||
etatJeu,
|
||||
vueGrille,
|
||||
graine,
|
||||
(TextView) findViewById(R.id.tvScore),
|
||||
(TextView) findViewById(R.id.tvCoups),
|
||||
hardMode
|
||||
);
|
||||
|
||||
// --- INITIALISATION DE L'OBJECTIF
|
||||
controleur.initialiserObjectif(savedInstanceState);
|
||||
|
||||
// --- Gestion tactile
|
||||
GestionnaireTactile gestionnaireTactile =
|
||||
new GestionnaireTactile(vueGrille, etatJeu, controleur);
|
||||
vueGrille.setOnTouchListener(gestionnaireTactile);
|
||||
|
||||
// --- Controleur
|
||||
btnMenu = findViewById(R.id.btnMenu);
|
||||
MainController mainController = new MainController(this, etatJeu);
|
||||
btnMenu.setOnClickListener(mainController);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
if (etatJeu != null) {
|
||||
etatJeu.sauvegarderEtat(outState);
|
||||
}
|
||||
if (controleur != null) {
|
||||
controleur.sauvegarderEtat(outState);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
public class MainController implements View.OnClickListener {
|
||||
|
||||
private final MainActivity activity;
|
||||
private final EtatJeu etatJeu;
|
||||
|
||||
public MainController(MainActivity activity, EtatJeu etatJeu) {
|
||||
this.activity = activity;
|
||||
this.etatJeu = etatJeu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == R.id.btnMenu) {
|
||||
etatJeu.forcerFinDePartie();
|
||||
Intent intent = new Intent(activity, MenuActivity.class);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
|
||||
public class MenuActivity extends Activity {
|
||||
|
||||
private Button btnNouvellePartie;
|
||||
private Button btnPartieGraine;
|
||||
private Button btnOptions;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_menu);
|
||||
|
||||
btnNouvellePartie = findViewById(R.id.btnNouvellePartie);
|
||||
btnPartieGraine = findViewById(R.id.btnPartieGraine);
|
||||
btnOptions = findViewById(R.id.btnOptions);
|
||||
|
||||
MenuController controller = new MenuController(this);
|
||||
btnNouvellePartie.setOnClickListener(controller);
|
||||
btnPartieGraine.setOnClickListener(controller);
|
||||
btnOptions.setOnClickListener(controller);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
public class MenuController implements View.OnClickListener {
|
||||
|
||||
private final MenuActivity activity;
|
||||
|
||||
public MenuController(MenuActivity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == R.id.btnNouvellePartie) {
|
||||
long graine = System.currentTimeMillis();
|
||||
Intent intent = new Intent(activity, MainActivity.class);
|
||||
intent.putExtra("graine", graine);
|
||||
activity.startActivity(intent);
|
||||
} else if (id == R.id.btnPartieGraine) {
|
||||
Intent intent = new Intent(activity, SeedActivity.class);
|
||||
activity.startActivity(intent);
|
||||
} else if (id == R.id.btnOptions) {
|
||||
Intent intent = new Intent(activity, OptionsActivity.class);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* Représente un objectif dynamique pour le mode Hard.
|
||||
*/
|
||||
public class Objectif {
|
||||
private final int couleur; // Index de la couleur cible (0-6)
|
||||
private final int nbSeriesCible; // Nombre de séries à réaliser
|
||||
private final int nbCoupsMax; // Limite de coups à faire
|
||||
private final int poids; // Probabilité d'apparition (poids pour le tirage)
|
||||
|
||||
private int seriesRealisees = 0;
|
||||
private int coupsRestants;
|
||||
|
||||
public Objectif(int couleur, int nbSeries, int nbCoupsMax, int poids) {
|
||||
this.couleur = couleur;
|
||||
this.nbSeriesCible = nbSeries;
|
||||
this.nbCoupsMax = nbCoupsMax;
|
||||
this.coupsRestants = nbCoupsMax;
|
||||
this.poids = poids;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public int getCouleur() {
|
||||
return couleur;
|
||||
}
|
||||
public int getNbSeriesCible() {
|
||||
|
||||
return nbSeriesCible;
|
||||
}
|
||||
public int getNbCoupsMax() {
|
||||
return nbCoupsMax;
|
||||
}
|
||||
|
||||
public int getCoupsRestants() {
|
||||
return coupsRestants;
|
||||
|
||||
}
|
||||
public int getPoids() {
|
||||
return poids;
|
||||
|
||||
}
|
||||
|
||||
public void decrementerCoups() {
|
||||
|
||||
if (coupsRestants > 0) coupsRestants--;
|
||||
}
|
||||
|
||||
public void ajouterSeries(int n) {
|
||||
|
||||
this.seriesRealisees += n;
|
||||
}
|
||||
|
||||
public boolean estReussi() {
|
||||
|
||||
return seriesRealisees >= nbSeriesCible;
|
||||
}
|
||||
|
||||
public boolean estEchoue() {
|
||||
|
||||
return coupsRestants <= 0 && !estReussi();
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
String nomCouleur = obtenirNomCouleur(couleur);
|
||||
return "Éclatez " + nbSeriesCible + " fois des Chuzzle " + nomCouleur +
|
||||
" en moins de " + nbCoupsMax + " coups (" + seriesRealisees + "/" + nbSeriesCible +
|
||||
").\nCoups restants : " + coupsRestants;
|
||||
}
|
||||
|
||||
private String obtenirNomCouleur(int c) {
|
||||
switch (c) {
|
||||
case 0: return "Gris";
|
||||
case 1: return "Rose";
|
||||
case 2: return "Vert";
|
||||
case 3: return "Bleu";
|
||||
case 4: return "Jaune";
|
||||
case 5: return "Orange";
|
||||
case 6: return "Rouge";
|
||||
default: return "Inconnue";
|
||||
}
|
||||
}
|
||||
|
||||
// Persistance pour la rotation d'écran
|
||||
public void sauvegarder(Bundle out) {
|
||||
out.putInt("obj_couleur", couleur);
|
||||
out.putInt("obj_cible", nbSeriesCible);
|
||||
out.putInt("obj_max", nbCoupsMax);
|
||||
out.putInt("obj_restants", coupsRestants);
|
||||
out.putInt("obj_realise", seriesRealisees);
|
||||
out.putInt("obj_poids", poids);
|
||||
}
|
||||
|
||||
public static Objectif restaurer(Bundle in) {
|
||||
if (in == null || !in.containsKey("obj_couleur")) return null;
|
||||
Objectif obj = new Objectif(
|
||||
in.getInt("obj_couleur"),
|
||||
in.getInt("obj_cible"),
|
||||
in.getInt("obj_max"),
|
||||
in.getInt("obj_poids")
|
||||
);
|
||||
obj.coupsRestants = in.getInt("obj_restants");
|
||||
obj.seriesRealisees = in.getInt("obj_realise");
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
|
||||
public class OptionsActivity extends Activity {
|
||||
|
||||
private SharedPreferences prefs;
|
||||
private CheckBox checkHard;
|
||||
private Button btnRetour;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_options);
|
||||
|
||||
prefs = getSharedPreferences("chuzzle_prefs", MODE_PRIVATE);
|
||||
|
||||
checkHard = findViewById(R.id.checkHard);
|
||||
btnRetour = findViewById(R.id.btnBack);
|
||||
|
||||
checkHard.setChecked(prefs.getBoolean("hard_mode", false));
|
||||
|
||||
OptionsController controller = new OptionsController(this, prefs);
|
||||
checkHard.setOnCheckedChangeListener(controller);
|
||||
btnRetour.setOnClickListener(controller);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.view.View;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
public class OptionsController
|
||||
implements CompoundButton.OnCheckedChangeListener, View.OnClickListener {
|
||||
|
||||
private final OptionsActivity activity;
|
||||
private final SharedPreferences prefs;
|
||||
|
||||
public OptionsController(OptionsActivity activity, SharedPreferences prefs) {
|
||||
this.activity = activity;
|
||||
this.prefs = prefs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton bouton, boolean estCoche) {
|
||||
int id = bouton.getId();
|
||||
if (id == R.id.checkHard) {
|
||||
prefs.edit().putBoolean("hard_mode", estCoche).apply();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == R.id.btnBack) {
|
||||
Intent intent = new Intent(activity, MenuActivity.class);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Gère les données de la grille et la logique de manipulation du plateau.
|
||||
*/
|
||||
public class Plateau {
|
||||
public static final int NB_LIGNES = 6;
|
||||
public static final int NB_COLONNES = 6;
|
||||
public static final int NB_TYPES = 7;
|
||||
|
||||
private final int[][] grille = new int[NB_LIGNES][NB_COLONNES];
|
||||
private final boolean[][] verrous = new boolean[NB_LIGNES][NB_COLONNES];
|
||||
private final Random aleatoire;
|
||||
|
||||
public Plateau(Random aleatoire) {
|
||||
this.aleatoire = aleatoire;
|
||||
initialiserGrilleSansTriples();
|
||||
}
|
||||
|
||||
private void initialiserGrilleSansTriples() {
|
||||
for (int l = 0; l < NB_LIGNES; l++) {
|
||||
for (int c = 0; c < NB_COLONNES; c++) {
|
||||
int valeur;
|
||||
do {
|
||||
valeur = aleatoire.nextInt(NB_TYPES);
|
||||
} while (creeTriple(l, c, valeur));
|
||||
grille[l][c] = valeur;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean creeTriple(int l, int c, int val) {
|
||||
if (c >= 2 && grille[l][c - 1] == val && grille[l][c - 2] == val) {
|
||||
return true;
|
||||
}
|
||||
if (l >= 2 && grille[l - 1][c] == val && grille[l - 2][c] == val) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void decalerLigne(int ligne, int sens) {
|
||||
int s = ((sens % NB_COLONNES) + NB_COLONNES) % NB_COLONNES;
|
||||
for (int etape = 0; etape < s; etape++) {
|
||||
int tmp = grille[ligne][NB_COLONNES - 1];
|
||||
for (int c = NB_COLONNES - 1; c > 0; c--) {
|
||||
grille[ligne][c] = grille[ligne][c - 1];
|
||||
}
|
||||
grille[ligne][0] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
public void decalerColonne(int col, int sens) {
|
||||
int s = ((sens % NB_LIGNES) + NB_LIGNES) % NB_LIGNES;
|
||||
for (int etape = 0; etape < s; etape++) {
|
||||
int tmp = grille[NB_LIGNES - 1][col];
|
||||
for (int l = NB_LIGNES - 1; l > 0; l--) {
|
||||
grille[l][col] = grille[l - 1][col];
|
||||
}
|
||||
grille[0][col] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
public List<int[]> trouverSeries() {
|
||||
boolean[][] aSupprimer = new boolean[NB_LIGNES][NB_COLONNES];
|
||||
// Analyse horizontale
|
||||
for (int l = 0; l < NB_LIGNES; l++) {
|
||||
int c = 0;
|
||||
while (c < NB_COLONNES) {
|
||||
int type = grille[l][c];
|
||||
int fin = c + 1;
|
||||
while (fin < NB_COLONNES && grille[l][fin] == type) {
|
||||
fin++;
|
||||
}
|
||||
if (fin - c >= 3) {
|
||||
for (int k = c; k < fin; k++) {
|
||||
aSupprimer[l][k] = true;
|
||||
}
|
||||
}
|
||||
c = fin;
|
||||
}
|
||||
}
|
||||
// Analyse verticale
|
||||
for (int col = 0; col < NB_COLONNES; col++) {
|
||||
int l = 0;
|
||||
while (l < NB_LIGNES) {
|
||||
int type = grille[l][col];
|
||||
int fin = l + 1;
|
||||
while (fin < NB_LIGNES && grille[fin][col] == type) {
|
||||
fin++;
|
||||
}
|
||||
if (fin - l >= 3) {
|
||||
for (int k = l; k < fin; k++) {
|
||||
aSupprimer[k][col] = true;
|
||||
}
|
||||
}
|
||||
l = fin;
|
||||
}
|
||||
}
|
||||
List<int[]> positions = new ArrayList<>();
|
||||
for (int l = 0; l < NB_LIGNES; l++) {
|
||||
for (int c = 0; c < NB_COLONNES; c++) {
|
||||
if (aSupprimer[l][c]) {
|
||||
positions.add(new int[]{l, c});
|
||||
}
|
||||
}
|
||||
}
|
||||
return positions;
|
||||
}
|
||||
|
||||
public boolean estBloque(boolean estLigne, int index) {
|
||||
if (estLigne) {
|
||||
for (int c = 0; c < NB_COLONNES; c++) {
|
||||
if (verrous[index][c]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int l = 0; l < NB_LIGNES; l++) {
|
||||
if (verrous[l][index]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ajouterVerrou(int nbCoups) {
|
||||
int intervalle = Math.max(1, 5 - nbCoups / 10);
|
||||
if (nbCoups % intervalle != 0) {
|
||||
return;
|
||||
}
|
||||
List<int[]> libres = new ArrayList<>();
|
||||
for (int l = 0; l < NB_LIGNES; l++) {
|
||||
for (int c = 0; c < NB_COLONNES; c++) {
|
||||
if (!verrous[l][c]) {
|
||||
libres.add(new int[]{l, c});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (libres.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
int[] choix = libres.get(aleatoire.nextInt(libres.size()));
|
||||
verrous[choix[0]][choix[1]] = true;
|
||||
}
|
||||
|
||||
public void libererVerrous(boolean[][] masque) {
|
||||
for (int l = 0; l < NB_LIGNES; l++) {
|
||||
for (int c = 0; c < NB_COLONNES; c++) {
|
||||
if (masque[l][c]) {
|
||||
verrous[l][c] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int[][] copierGrille() {
|
||||
int[][] copie = new int[NB_LIGNES][NB_COLONNES];
|
||||
for (int l = 0; l < NB_LIGNES; l++) {
|
||||
System.arraycopy(grille[l], 0, copie[l], 0, NB_COLONNES);
|
||||
}
|
||||
return copie;
|
||||
}
|
||||
|
||||
public void restaurerGrille(int[][] source) {
|
||||
for (int l = 0; l < NB_LIGNES; l++) {
|
||||
System.arraycopy(source[l], 0, grille[l], 0, NB_COLONNES);
|
||||
}
|
||||
}
|
||||
|
||||
public int[][] getGrille() {
|
||||
return grille;
|
||||
}
|
||||
|
||||
public boolean[][] getVerrous() {
|
||||
return verrous;
|
||||
}
|
||||
|
||||
public void faireTomber(boolean[][] aSupprimer) {
|
||||
for (int col = 0; col < NB_COLONNES; col++) {
|
||||
List<Integer> survivants = new ArrayList<>();
|
||||
for (int l = NB_LIGNES - 1; l >= 0; l--) {
|
||||
if (!aSupprimer[l][col]) {
|
||||
survivants.add(grille[l][col]);
|
||||
}
|
||||
}
|
||||
int li = NB_LIGNES - 1;
|
||||
for (int val : survivants) {
|
||||
grille[li][col] = val;
|
||||
li--;
|
||||
}
|
||||
while (li >= 0) {
|
||||
grille[li][col] = aleatoire.nextInt(NB_TYPES);
|
||||
li--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class SeedActivity extends Activity implements View.OnClickListener {
|
||||
|
||||
private EditText etGraine;
|
||||
private Button btnJouer;
|
||||
|
||||
private Button btnRetour;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_seed);
|
||||
|
||||
etGraine = findViewById(R.id.etGraine);
|
||||
btnJouer = findViewById(R.id.btnJouer);
|
||||
btnRetour = findViewById(R.id.btnBack);
|
||||
|
||||
btnRetour.setOnClickListener(this);
|
||||
|
||||
btnJouer.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v == btnJouer) {
|
||||
lancerPartieAvecGraine();
|
||||
}
|
||||
if (v == btnRetour) {
|
||||
Intent intent = new Intent(this, MenuActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private void lancerPartieAvecGraine() {
|
||||
String texte = etGraine.getText().toString().trim();
|
||||
|
||||
if (texte.isEmpty()) {
|
||||
Toast.makeText(this, "Veuillez entrer une graine.",
|
||||
Toast.LENGTH_SHORT
|
||||
).show();
|
||||
return;
|
||||
}
|
||||
|
||||
long graine;
|
||||
|
||||
try {
|
||||
graine = Long.parseLong(texte);
|
||||
} catch (NumberFormatException e) {
|
||||
graine = texte.hashCode();
|
||||
}
|
||||
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.putExtra("graine", graine);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class VueGrille extends View {
|
||||
|
||||
// Constantes
|
||||
|
||||
private static final int NB_LIGNES = 6;
|
||||
private static final int NB_COLONNES = 6;
|
||||
private static final int NB_TYPES = 7;
|
||||
|
||||
/** Symboles pour le mode daltonien, un par type. */
|
||||
private static final String[] SYMBOLES = {"●", "■", "▲", "✚", "★", "♦", "✿"};
|
||||
|
||||
// Données nécessaires au dessin
|
||||
|
||||
private int[][] grille = new int[NB_LIGNES][NB_COLONNES];
|
||||
private boolean[][] verrous = new boolean[NB_LIGNES][NB_COLONNES];
|
||||
|
||||
private Boolean animEstLigne = null;
|
||||
private int animIndex = 0;
|
||||
private float animDecalagePx = 0f;
|
||||
|
||||
// Outils de dessin
|
||||
|
||||
private final Paint pinceauCase = new Paint();
|
||||
private final Paint pinceauSymbole = new Paint();
|
||||
private final Paint pinceauSelection = new Paint();
|
||||
private Bitmap imageChaine;
|
||||
|
||||
// Constructeurs
|
||||
|
||||
public VueGrille(Context contexte) {
|
||||
super(contexte);
|
||||
initPinceaux();
|
||||
}
|
||||
|
||||
public VueGrille(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initPinceaux();
|
||||
}
|
||||
|
||||
private void initPinceaux() {
|
||||
pinceauCase.setAntiAlias(true);
|
||||
pinceauCase.setStyle(Paint.Style.FILL);
|
||||
|
||||
pinceauSymbole.setAntiAlias(true);
|
||||
pinceauSymbole.setColor(0xFF000000);
|
||||
pinceauSymbole.setTextAlign(Paint.Align.CENTER);
|
||||
|
||||
pinceauSelection.setAntiAlias(true);
|
||||
pinceauSelection.setStyle(Paint.Style.STROKE);
|
||||
pinceauSelection.setStrokeWidth(12f);
|
||||
pinceauSelection.setColor(0xFFFFFFFF);
|
||||
|
||||
imageChaine = BitmapFactory.decodeResource(getResources(), R.drawable.chaine);
|
||||
}
|
||||
|
||||
// -
|
||||
|
||||
public void definirGrille(int[][] nouvelleGrille) {
|
||||
for (int l = 0; l < NB_LIGNES; l++) {
|
||||
System.arraycopy(nouvelleGrille[l], 0, grille[l], 0, NB_COLONNES);
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void definirVerrous(boolean[][] nouveauxVerrous) {
|
||||
for (int l = 0; l < NB_LIGNES; l++) {
|
||||
System.arraycopy(nouveauxVerrous[l], 0, verrous[l], 0, NB_COLONNES);
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
|
||||
// animation de glissement
|
||||
|
||||
public void definirGlissement(boolean estLigne, int index, float decalagePx) {
|
||||
this.animEstLigne = estLigne;
|
||||
this.animIndex = index;
|
||||
this.animDecalagePx = decalagePx;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void annulerGlissement() {
|
||||
this.animEstLigne = null;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
// Dessin
|
||||
|
||||
@Override
|
||||
protected void onDraw(@NonNull Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
// Mise à jour de la couleur du contour de sélection si bloqué
|
||||
if (animEstLigne != null) {
|
||||
if (estSelectionBloquee()) {
|
||||
pinceauSelection.setColor(0xFF000000); // Noir
|
||||
} else {
|
||||
pinceauSelection.setColor(0xFFFFFFFF); // Blanc
|
||||
}
|
||||
}
|
||||
|
||||
int largeur = getWidth() - getPaddingLeft() - getPaddingRight();
|
||||
int hauteur = getHeight() - getPaddingTop() - getPaddingBottom();
|
||||
|
||||
float tailleCase = Math.min(
|
||||
largeur / (float) NB_COLONNES,
|
||||
hauteur / (float) NB_LIGNES
|
||||
);
|
||||
|
||||
float margeGauche = getPaddingLeft() + (largeur - tailleCase * NB_COLONNES) / 2f;
|
||||
float margeHaut = getPaddingTop() + (hauteur - tailleCase * NB_LIGNES) / 2f;
|
||||
|
||||
// Limite le dessin à la zone de la grille
|
||||
canvas.save();
|
||||
canvas.clipRect(margeGauche, margeHaut,
|
||||
margeGauche + NB_COLONNES * tailleCase,
|
||||
margeHaut + NB_LIGNES * tailleCase);
|
||||
|
||||
pinceauSymbole.setTextSize(tailleCase * 0.4f);
|
||||
|
||||
for (int ligne = 0; ligne < NB_LIGNES; ligne++) {
|
||||
for (int colonne = 0; colonne < NB_COLONNES; colonne++) {
|
||||
|
||||
float offsetX = 0f;
|
||||
float offsetY = 0f;
|
||||
|
||||
if (animEstLigne != null) {
|
||||
int nbCases = Math.round(animDecalagePx / tailleCase);
|
||||
if (animEstLigne && ligne == animIndex) {
|
||||
offsetX = nbCases * tailleCase;
|
||||
} else if (!animEstLigne && colonne == animIndex) {
|
||||
offsetY = nbCases * tailleCase;
|
||||
}
|
||||
}
|
||||
|
||||
float x1 = margeGauche + colonne * tailleCase + 6 + offsetX;
|
||||
float y1 = margeHaut + ligne * tailleCase + 6 + offsetY;
|
||||
float x2 = margeGauche + (colonne + 1) * tailleCase - 6 + offsetX;
|
||||
float y2 = margeHaut + (ligne + 1) * tailleCase - 6 + offsetY;
|
||||
|
||||
dessinerCase(canvas, ligne, colonne, x1, y1, x2, y2,
|
||||
tailleCase, margeGauche, margeHaut, offsetX, offsetY);
|
||||
}
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
private void dessinerCase(Canvas canvas,
|
||||
int ligne, int colonne,
|
||||
float x1, float y1, float x2, float y2,
|
||||
float tailleCase,
|
||||
float margeGauche, float margeHaut,
|
||||
float offsetX, float offsetY) {
|
||||
|
||||
float largeurGrille = NB_COLONNES * tailleCase;
|
||||
float hauteurGrille = NB_LIGNES * tailleCase;
|
||||
|
||||
// Dessin case principale
|
||||
dessinerRectCase(canvas, ligne, colonne, x1, y1, x2, y2);
|
||||
|
||||
// Réapparition de l'autre côté (wrap)
|
||||
if (offsetX != 0f) {
|
||||
float bordD = margeGauche + largeurGrille;
|
||||
float bordG = margeGauche;
|
||||
if (x2 > bordD) {
|
||||
dessinerRectCase(canvas, ligne, colonne, x1 - largeurGrille, y1, x2 - largeurGrille, y2);
|
||||
} else if (x1 < bordG) {
|
||||
dessinerRectCase(canvas, ligne, colonne, x1 + largeurGrille, y1, x2 + largeurGrille, y2);
|
||||
}
|
||||
}
|
||||
if (offsetY != 0f) {
|
||||
float bordB = margeHaut + hauteurGrille;
|
||||
float bordH = margeHaut;
|
||||
if (y2 > bordB) {
|
||||
dessinerRectCase(canvas, ligne, colonne, x1, y1 - hauteurGrille, x2, y2 - hauteurGrille);
|
||||
} else if (y1 < bordH) {
|
||||
dessinerRectCase(canvas, ligne, colonne, x1, y1 + hauteurGrille, x2, y2 + hauteurGrille);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dessine le rectangle coloré d'une case + verrou + symbole daltonien.
|
||||
* Ajoute un contour gras si la case est sélectionnée.
|
||||
*/
|
||||
private void dessinerRectCase(Canvas canvas,
|
||||
int ligne, int colonne,
|
||||
float x1, float y1, float x2, float y2) {
|
||||
|
||||
int type = grille[ligne][colonne];
|
||||
|
||||
definirCouleur(type);
|
||||
canvas.drawRoundRect(x1, y1, x2, y2, 20, 20, pinceauCase);
|
||||
|
||||
if (animEstLigne != null) {
|
||||
if ((animEstLigne && ligne == animIndex)
|
||||
|| (!animEstLigne && colonne == animIndex)) {
|
||||
canvas.drawRoundRect(x1, y1, x2, y2, 20, 20, pinceauSelection);
|
||||
}
|
||||
}
|
||||
|
||||
// Assombrir si verrouillée
|
||||
if (verrous[ligne][colonne]) {
|
||||
pinceauCase.setARGB(120, 0, 0, 0);
|
||||
canvas.drawRoundRect(x1, y1, x2, y2, 20, 20, pinceauCase);
|
||||
}
|
||||
|
||||
float cx = (x1 + x2) / 2f;
|
||||
float cy = (y1 + y2) / 2f - (pinceauSymbole.descent() + pinceauSymbole.ascent()) / 2f;
|
||||
|
||||
canvas.drawText(SYMBOLES[type % NB_TYPES], cx, cy, pinceauSymbole);
|
||||
|
||||
// Dessin de l'image de la chaine si verrouillée
|
||||
if (verrous[ligne][colonne] && imageChaine != null) {
|
||||
float size = (x2 - x1);
|
||||
float chainSize = size * 0.55f;
|
||||
canvas.drawBitmap(imageChaine, null, new RectF(x1, y1, x1 + chainSize, y1 + chainSize), null);
|
||||
canvas.drawBitmap(imageChaine, null, new RectF(x2 - chainSize, y2 - chainSize, x2, y2), null);
|
||||
}
|
||||
}
|
||||
|
||||
private void definirCouleur(int type) {
|
||||
switch (type % NB_TYPES) {
|
||||
case 0: pinceauCase.setARGB(255, 200, 200, 200); break;
|
||||
case 1: pinceauCase.setARGB(255, 255, 105, 180); break;
|
||||
case 2: pinceauCase.setARGB(255, 90, 230, 200); break;
|
||||
case 3: pinceauCase.setARGB(255, 100, 170, 255); break;
|
||||
case 4: pinceauCase.setARGB(255, 255, 220, 90); break;
|
||||
case 5: pinceauCase.setARGB(255, 255, 140, 90); break;
|
||||
case 6: pinceauCase.setARGB(255, 255, 90, 90); break;
|
||||
}
|
||||
}
|
||||
|
||||
/** Vérifie si la ligne/colonne en cours de glissement contient un verrou. */
|
||||
private boolean estSelectionBloquee() {
|
||||
if (animEstLigne == null) return false;
|
||||
if (animEstLigne) {
|
||||
for (int c = 0; c < NB_COLONNES; c++)
|
||||
if (verrous[animIndex][c]) return true;
|
||||
} else {
|
||||
for (int l = 0; l < NB_LIGNES; l++)
|
||||
if (verrous[l][animIndex]) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
|
After Width: | Height: | Size: 30 KiB |
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
@@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#1A1A2E">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="32dp">
|
||||
|
||||
<!-- Titre -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Partie terminée !"
|
||||
android:textSize="36sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#E94560"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="32dp"/>
|
||||
|
||||
<!-- Score -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Score"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#AAAACC"
|
||||
android:gravity="center"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFinScore"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textSize="42sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#FFFFFF"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="24dp"/>
|
||||
|
||||
<!-- Nombre de coups -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Coups joués"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#AAAACC"
|
||||
android:gravity="center"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFinCoups"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textSize="36sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#FFFFFF"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="24dp"/>
|
||||
|
||||
<!-- Graine -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Graine de la partie"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#AAAACC"
|
||||
android:gravity="center"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFinGraine"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textSize="20sp"
|
||||
android:textColor="#E2C94E"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="32dp"/>
|
||||
|
||||
<!-- Objectif en cours (hard mode uniquement) -->
|
||||
<TextView
|
||||
android:id="@+id/tvLabelObjectif"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Objectif en cours"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#AAAACC"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFinObjectif"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textSize="15sp"
|
||||
android:textColor="#E2C94E"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<!-- Grille finale -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Dernière grille"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#AAAACC"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
|
||||
<sae.chuzzle.VueGrille
|
||||
android:id="@+id/vueGrilleFinale"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="280dp"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:layout_marginBottom="32dp"/>
|
||||
|
||||
<!-- Bouton retour au menu -->
|
||||
<Button
|
||||
android:id="@+id/btnFinMenu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Retour au menu"
|
||||
android:textSize="18sp"
|
||||
android:backgroundTint="#E94560"
|
||||
android:textColor="#FFFFFF"
|
||||
android:padding="16dp"
|
||||
android:layout_margin="50dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="48dp"
|
||||
android:background="#1A1A2E">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Chuzzle"
|
||||
android:textSize="48sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#E94560"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="64dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnNouvellePartie"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Nouvelle Partie"
|
||||
android:backgroundTint="#E94560"
|
||||
android:textColor="#FFFFFF"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPartieGraine"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Partie avec Graine"
|
||||
android:backgroundTint="#E94560"
|
||||
android:textColor="#FFFFFF"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnOptions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Options"
|
||||
android:backgroundTint="#E94560"
|
||||
android:textColor="#FFFFFF"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="48dp"
|
||||
android:background="#1A1A2E">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Entrez une graine"
|
||||
android:textSize="24sp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="32dp"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etGraine"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Ex : 12345"
|
||||
android:inputType="number"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textColorHint="#AAAACC"
|
||||
android:backgroundTint="#E94560"
|
||||
android:layout_marginBottom="32dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnJouer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Jouer"
|
||||
android:backgroundTint="#E94560"
|
||||
android:textColor="#FFFFFF"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnBack"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="Retour"
|
||||
android:backgroundTint="#E94560"
|
||||
android:textColor="#FFFFFF"
|
||||
android:layout_marginTop="32dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 982 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.Chuzzle" parent="@android:style/Theme.Light.NoTitleBar" />
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">RealChuzzle</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.Chuzzle" parent="@android:style/Theme.Light.NoTitleBar" />
|
||||
</resources>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older than API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -0,0 +1,17 @@
|
||||
package sae.chuzzle;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||