www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 144e9dfb998cd95d3950add7de0e0d3c691fb702
parent 4f0ac61338fde8ac440f6aee27ecbe46d2daed3d
Author: Bertrand BRUN <bertrand0brun@gmail.com>
Date:   Fri,  4 Feb 2011 13:37:12 +0100

Merge branch 'master' of https://github.com/jsmaniac/2011-m1s2-ter

Diffstat:
Mcode/PtiClic/AndroidManifest.xml | 10+++++-----
Mcode/PtiClic/res/layout/frontpage.xml | 24+++++++++++-------------
Mcode/PtiClic/src/org/pticlic/games/BaseGame.java | 2--
Mcode/serveur/php/pticlic.php | 18++++++++++++++----
Morganisation/notes | 21+++++++++++++++++++++
Mrapport/rapport.tex | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 106 insertions(+), 24 deletions(-)

diff --git a/code/PtiClic/AndroidManifest.xml b/code/PtiClic/AndroidManifest.xml @@ -10,11 +10,11 @@ </intent-filter> </activity> - <activity android:name=".Preference" android:label="Préférence"></activity> - <activity android:name=".games.BaseGame"></activity> - <activity android:label="Information" android:name=".Information"></activity> - <activity android:name=".Score" android:label="Score"></activity> -<activity android:name=".FrontPage"></activity> + <activity android:name=".Preference" android:label="Préférence" android:screenOrientation="portrait"></activity> + <activity android:name=".games.BaseGame" android:screenOrientation="portrait"></activity> + <activity android:label="Information" android:name=".Information" android:screenOrientation="portrait"></activity> + <activity android:name=".Score" android:label="Score" android:screenOrientation="portrait"></activity> +<activity android:name=".FrontPage" android:screenOrientation="portrait"></activity> </application> diff --git a/code/PtiClic/res/layout/frontpage.xml b/code/PtiClic/res/layout/frontpage.xml @@ -13,30 +13,28 @@ <ImageView android:layout_height="wrap_content" android:text="@string/play_label" android:layout_width="wrap_content" - android:id="@+id/play" android:clickable="true" android:padding="30dip" android:src="@drawable/mode_normal"/> + android:id="@+id/play" android:clickable="true" android:padding="30dip" + android:src="@drawable/mode_normal"/> - <ImageView android:src="@drawable/config" android:layout_height="wrap_content" android:id="@+id/prefs" + <ImageView android:src="@drawable/config" + android:layout_height="wrap_content" android:id="@+id/prefs" android:layout_width="wrap_content" android:layout_below="@+id/play" - android:layout_alignLeft="@+id/play" android:layout_alignRight="@+id/play" android:padding="30dip"></ImageView> + android:layout_alignLeft="@+id/play" android:layout_alignRight="@+id/play" + android:padding="30dip"></ImageView> - - - - - - -</RelativeLayout> + </RelativeLayout> <LinearLayout android:id="@+id/LinearLayout01" - android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical" android:layout_weight="1"> + android:layout_height="wrap_content" android:layout_width="fill_parent" + android:orientation="vertical" android:layout_weight="1"> <TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:textStyle="bold" android:gravity="center_horizontal" android:text="@+id/login" android:id="@+id/login"></TextView> <ImageView android:layout_height="wrap_content" android:id="@+id/infoButton" - android:layout_width="wrap_content" android:layout_gravity="right" android:layout_weight="5" - android:clickable="true" android:src="@drawable/aide"/> + android:layout_width="wrap_content" android:layout_gravity="right" + android:layout_weight="5" android:clickable="true" android:src="@drawable/aide" /> </LinearLayout> diff --git a/code/PtiClic/src/org/pticlic/games/BaseGame.java b/code/PtiClic/src/org/pticlic/games/BaseGame.java @@ -9,13 +9,11 @@ import org.pticlic.model.Network; import org.pticlic.model.Network.Mode; import org.pticlic.model.Relation; -import android.R.anim; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; -import android.graphics.Color; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.Display; diff --git a/code/serveur/php/pticlic.php b/code/serveur/php/pticlic.php @@ -229,16 +229,26 @@ function main($action) { } else if($action == 1) { // "Set partie" // Requête sql d'ajout d'informations (et calcul de résultat). // TODO : nettoyer, finir - $gid = $_GET['gid']; // TODO : vérifier qu'on a bien distribué cette partie à cet utilisateur, et qu'il n'y a pas déjà répondu (répercuter ça sur le random_game). - $userReputation = 5; // TODO : un nombre entre 0 et 5 environ. Par ex. log(pointsUtilisateur) est un bon choix. + + $gid = $_GET['gid']; + + if(ĝid != $db->querySingle("SELECT gid FROM played_game WHERE login='".$user."'")) + mdie(3,"Cette partie n'est associée à votre nom d'utilisateur"); + + $userReputation = log($db->querySingle("SELECT score FROM user WHERE login='".$user."'")); + $db->exec("begin transaction;"); - $db->exec("insert into played_game(pgid, gid, login) values (null, $gid, null);"); + $db->exec("INSERT INTO played_game(pgid, gid, login) VALUES (null, $gid, null);"); $pgid = $db->lastInsertRowID(); - for ($i=0; $i < 10; $i++) { + + for($i=0; $i < 10; $i++) + { $x = $_GET['$i']; + // TODO : calculer le score. Score = proba[réponse de l'utilisateur]*coeff - proba[autres reponses]*coeff // TODO : adapter le score en fonction de la réputation de l'utilisateur (plus quand il est jeune, pour le motiver, par ex. avec un terme constant qu'on ajoute). $score = 1; + $db->exec("insert into played_game_cloud(pgid, gid, type, num, relation, weight, score) values($pgid, $gid, 1, ".$c['pos'].", $r1, ".($x*$userReputation).", ".$score.");"); // TODO : game_cloud(probaR_x_) += $réputationJoueur * $coeff // TODO : game_cloud(totalWeight) += $réputationJoueur * $coeff (NOTE : même coeff que pour game_cloud(probaR_x_)) diff --git a/organisation/notes b/organisation/notes @@ -1,3 +1,24 @@ - Une classe Constante pour toutes les constantes ("symboles" pour les paramètres, ...). - Boutons pour les différents modes de jeu directement sur la "page de garde". - Icônes : http://developer.android.com/guide/practices/ui_guidelines/icon_design.html + +NOTES SUITE A LA REUNION +- addiction -> IMPORTANT ... teasing socialisation +- choix de la thématique : cadeau thématique +- game with a purpose GWAP +- espi +- liberman (sp?) +- indexation des images Google +- code pour Google.com code.google.com/intl/fr~FR/apis/chart/index.html +- qrcode +- lire sur site pour installer appli +- bêta testeurs externes +- intuitivité +- réflexion : intuitivité - prototypes - +- bouton aide -> affiche les icônes en vertical + texte, il y a moins de place pour le mot du nuage, mais on peut continuer à jouer en cliquant sur ces "gros" boutons. +- Modes de jeu supplémentaires payants par ex. + + +POUR LAFOURCADE +- lien : code.google.com/intl/fr~FR/apis/chart/index.html +- note techniques exactes pour le serveur au LIRMM diff --git a/rapport/rapport.tex b/rapport/rapport.tex @@ -60,6 +60,45 @@ Un grand nombre de développeurs ont créés des applications pour étendre la f \section{Conception} +\begin{verbatim} +NODE(EID integer primary key autoincrement, name string, #type (ref TYPE_NODE.num), weight); + +RELATION(RID integer primary key autoincrement, #start (ref NODE.eid), #end (ref NODE.eid), #type (ref TYPE_RELATION.num), weight); + +TYPE_NODE(NUM, name string); + +TYPE_RELATION(NUM, name string, extended_name string, info string); + +USER(LOGIN string primary key, mail string, hash_passwd string (md5sum du password), #score (contrainte : somme de tous les scores des PLAYED_GAME_CLOUD); + +GAME(GID integer primary key autoincrement, #eid_central_word (ref NODE.eid, #relation_1 (ref RELATION.rid), #relation_2 ( (ref RELATION.rid), difficulty); + +GAME_CLOUD(GID, NUM, difficulty, #eid_word(ref NODE.eid), totalWeight (contrainte : = somme des probas), probaR1 (contrainte : = somme des probas des PLAYED_GAME_CLOUD.weight avec la bonne relation et la même gid et num), probaR2 (idem), probaR0 (idem), probaTrash (idem)); + +PLAYED_GAME(PGID integer primary key autoincrement, #gid (ref GAME.gid), #login (ref USER.login); + +PLAYED_GAME_CLOUD(#PGID (ref PLAYED_GAME.pgid), #GID (ref PLAYED_GAME.gid), NUM, type (contrainte : 0 = partie de référence, 1 = réponse d'un joueur), #relation (ref RELATION.rid), weight (contrainte : probabilité estimée de cette réponse pour les bots (robots), réputation du joueur sinon), score (score donné au joueur, 0 pour les bots); + +**INT unless otherwise marked +\end{verbatim} +\begin{verbatim} +create table node(eid integer primary key autoincrement, name, type, weight); +create table relation(rid integer primary key autoincrement, start, end, type, weight); +create table type_node(name, num); +create table type_relation(name, num, extended_name, info); +create table user(login primary key, mail, hash_passwd, score); +create table game(gid integer primary key autoincrement, eid_central_word, relation_1, relation_2, difficulty); +create table game_cloud(gid, num, difficulty, eid_word, totalWeight, probaR1, probaR2, probaR0, probaTrash); +create table played_game(pgid integer primary key autoincrement, gid, login); +create table played_game_cloud(pgid, gid, type, num, relation, weight, score); + +create index i_relation_start on relation(start); +create index i_relation_end on relation(end); +create index i_relation_type on relation(type); +create index i_relation_start_type on relation(start,type); +create index i_relation_end_type on relation(end,type); +\end{verbatim} + TODO: UML, diagrammes de classes, Use cases, etc... @@ -87,6 +126,22 @@ TODO: UML, diagrammes de classes, Use cases, etc... \item Caractères non échappés dans le dump de la base.% gd \end{itemize} +\subsubsection{Itération 1, semaine 3} +\begin{itemize} +\item SQLite3 n'est pas capable d'utiliser un index pour la requête extérieure sur une requête du type +\begin{verbatim} +select * from (select * from table where condition) where condition +\end{verbatim} +Donc nécessité de ré-écrire certaines requêtes avec des jointures à priori beaucoup moins efficaces, mais qui le sont plus grâce aux index. +\item SQLite3 tranforme les requêtes de la forme~: +\begin{verbatim} +select * from table limit 100 order by random(); +\end{verbatim} + en une requête qui récupère tout le set de résultats, ajoute une colonne random(), prend les 100 premiers résultats et les trie. Mais cela + l'oblige à récupérer tout le set de résultats, et calculer le random() pour chaque ligne, pour ensuite jeter tout ce qui dépasse la ligne + 100. Cela est évidemment très coûteux dans le cadre de requêtes avec beaucoup de résultats, et nous avons donc dû isoler la requête avec + \verb!limit! de son \verb!order by! avec des «hacks» assez tordus. +\end{itemize} \section{Conclusions}