├── .gitignore
├── COPYING
├── README.md
├── app
├── .gitignore
├── app.iml
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── net
│ │ └── lrstudios
│ │ └── android
│ │ └── pachi
│ │ ├── MainActivity.java
│ │ ├── MyApplication.java
│ │ └── PachiEngine.java
│ └── res
│ ├── drawable-hdpi
│ └── ic_home.png
│ ├── drawable-mdpi
│ └── ic_home.png
│ ├── drawable-xhdpi
│ └── ic_home.png
│ ├── raw
│ └── pachi
│ └── values
│ └── strings.xml
├── build.gradle
├── debug.keystore
├── elygo-lib
├── .gitignore
├── COPYING
├── README
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── lrstudios
│ │ ├── games
│ │ └── ego
│ │ │ └── lib
│ │ │ ├── BoardAnimation.java
│ │ │ ├── BoardLabelMark.java
│ │ │ ├── BoardMark.java
│ │ │ ├── BoardView.java
│ │ │ ├── Coords.java
│ │ │ ├── DetailedSeekBar.java
│ │ │ ├── ExternalGtpEngine.java
│ │ │ ├── GameInfo.java
│ │ │ ├── GameNode.java
│ │ │ ├── GoBoard.java
│ │ │ ├── GoGame.java
│ │ │ ├── GoGameResult.java
│ │ │ ├── GtpEngine.java
│ │ │ ├── GtpThread.java
│ │ │ ├── IntentGameInfo.java
│ │ │ ├── LibConfig.java
│ │ │ ├── LightCoords.java
│ │ │ ├── LrfParser.java
│ │ │ ├── PrisonersView.java
│ │ │ ├── ScoreView.java
│ │ │ ├── SgfParser.java
│ │ │ ├── TypefaceCache.java
│ │ │ ├── UpdatePrefsTask.java
│ │ │ ├── Utils.java
│ │ │ ├── themes
│ │ │ ├── BlackWhiteTheme.java
│ │ │ ├── DarkBoardTheme.java
│ │ │ ├── StandardTheme.java
│ │ │ └── Theme.java
│ │ │ ├── ui
│ │ │ ├── BaseBoardActivity.java
│ │ │ ├── GtpBoardActivity.java
│ │ │ ├── NewGameActivity.java
│ │ │ └── Preferences.java
│ │ │ └── util
│ │ │ ├── GoUtils.java
│ │ │ ├── HoloDialog.java
│ │ │ └── SoundHelper.java
│ │ └── util
│ │ ├── EventListenerList.java
│ │ ├── Rect.java
│ │ ├── android
│ │ ├── AndroidUtils.java
│ │ └── ui
│ │ │ └── BetterFragmentActivity.java
│ │ └── io
│ │ ├── BitContainer.java
│ │ ├── BitReader.java
│ │ └── BitWriter.java
│ └── res
│ ├── anim
│ ├── fragment_fade_in.xml
│ └── fragment_fade_out.xml
│ ├── drawable-mdpi
│ └── list_extra_button_left_border.9.png
│ ├── drawable-nodpi
│ ├── actionbar_top_bg.9.png
│ ├── login_frame.9.png
│ ├── wood2.png
│ └── wood6.png
│ ├── drawable-xhdpi
│ ├── __btn_default_disabled_focused_holo_light.9.png
│ ├── __btn_default_disabled_holo_light.9.png
│ ├── __btn_default_focused_holo_light.9.png
│ ├── __btn_default_normal_holo_light.9.png
│ ├── __btn_default_pressed_holo_light.9.png
│ ├── __btn_green_normal_holo_light.9.png
│ ├── __btn_red_normal_holo_light.9.png
│ ├── dialog_full_holo_light.9.png
│ ├── grey_background_pattern_tile.png
│ ├── grey_border_inset_lr.9.png
│ ├── ic_action_help.png
│ ├── ic_action_navigation_next_disabled.png
│ ├── ic_action_navigation_next_enabled.png
│ ├── ic_action_navigation_previous_disabled.png
│ ├── ic_action_navigation_previous_enabled.png
│ ├── ic_action_restart_disabled.png
│ ├── ic_action_restart_enabled.png
│ ├── ic_action_save_disabled.png
│ ├── ic_action_save_enabled.png
│ ├── ic_action_settings.png
│ ├── ic_action_split_disabled.png
│ ├── ic_action_split_enabled.png
│ ├── ic_action_undo_disabled.png
│ ├── ic_action_undo_enabled.png
│ ├── ic_green_check_mark.png
│ ├── ic_red_cross.png
│ ├── item_activated.9.png
│ ├── item_checked.9.png
│ ├── item_focused.9.png
│ ├── item_pressed.9.png
│ └── list_extra_button_left_border.9.png
│ ├── drawable
│ ├── __btn_default_holo_light.xml
│ ├── __btn_green_holo_light.xml
│ ├── __btn_red_holo_light.xml
│ ├── actionbar_shadow.9.png
│ ├── activatable_grey_item_background.xml
│ ├── activatable_item_background.xml
│ ├── bottom_bar_bg.xml
│ ├── dialog_title_bg.xml
│ ├── grey_background_pattern.xml
│ ├── ic_action_navigation_next.xml
│ ├── ic_action_navigation_previous.xml
│ ├── ic_action_restart.xml
│ ├── ic_action_save.xml
│ ├── ic_action_split.xml
│ ├── ic_action_undo.xml
│ ├── list_extra_button_bg.xml
│ ├── main_top_separator.xml
│ └── main_top_separator_horizontal.xml
│ ├── layout-land
│ └── score_panel.xml
│ ├── layout
│ ├── activity_with_fragment_container.xml
│ ├── alert_dialog_holo.xml
│ ├── board_activity.xml
│ ├── detailed_seek_bar.xml
│ ├── dialog_save_file.xml
│ ├── newgame_activity.xml
│ ├── score_panel.xml
│ └── toolbar_with_progress.xml
│ ├── menu
│ └── actionbar_gtp_board.xml
│ ├── raw
│ ├── pass.mp3
│ └── stone.wav
│ ├── values-de
│ ├── arrays.xml
│ └── strings.xml
│ ├── values-es
│ └── strings.xml
│ ├── values-fr
│ ├── arrays.xml
│ └── strings.xml
│ ├── values-ja
│ ├── arrays.xml
│ └── strings.xml
│ ├── values-ko
│ └── strings.xml
│ ├── values-pl
│ └── strings.xml
│ ├── values-ru
│ └── strings.xml
│ ├── values
│ ├── arrays.xml
│ ├── attrs.xml
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
│ └── xml
│ └── preferences.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── jni
├── Android.mk
├── Application.mk
└── pachi
│ ├── .gitignore
│ ├── Android.mk
│ ├── COPYING
│ ├── CREDITS
│ ├── HACKING
│ ├── Makefile
│ ├── README
│ ├── TODO
│ ├── android
│ ├── util.c
│ └── util.h
│ ├── board.c
│ ├── board.h
│ ├── book.dat.bad
│ ├── book.dat.extra
│ ├── chat.c
│ ├── chat.h
│ ├── debug.h
│ ├── distributed
│ ├── Makefile
│ ├── distributed.c
│ ├── distributed.h
│ ├── merge.c
│ ├── merge.h
│ ├── protocol.c
│ └── protocol.h
│ ├── engine.h
│ ├── fbook.c
│ ├── fbook.h
│ ├── fixp.h
│ ├── gtp.c
│ ├── gtp.h
│ ├── joseki
│ ├── Makefile
│ ├── README
│ ├── base.c
│ ├── base.h
│ ├── joseki.c
│ ├── joseki.h
│ └── sgfvar2gtp.pl
│ ├── joseki19.pdict
│ ├── media
│ ├── pachi-small.png
│ └── pachi.jpg
│ ├── montecarlo
│ ├── Makefile
│ ├── internal.h
│ ├── montecarlo.c
│ └── montecarlo.h
│ ├── move.c
│ ├── move.h
│ ├── mq.h
│ ├── network.c
│ ├── network.h
│ ├── ownermap.c
│ ├── ownermap.h
│ ├── pachi.c
│ ├── pattern.c
│ ├── pattern.h
│ ├── pattern3.c
│ ├── pattern3.h
│ ├── patternplay
│ ├── Makefile
│ ├── patternplay.c
│ └── patternplay.h
│ ├── patternprob.c
│ ├── patternprob.h
│ ├── patternscan
│ ├── Makefile
│ ├── patternscan.c
│ └── patternscan.h
│ ├── patternsp.c
│ ├── patternsp.h
│ ├── playout.c
│ ├── playout.h
│ ├── playout
│ ├── Makefile
│ ├── light.c
│ ├── light.h
│ ├── moggy.c
│ └── moggy.h
│ ├── probdist.c
│ ├── probdist.h
│ ├── random.c
│ ├── random.h
│ ├── random
│ ├── Makefile
│ ├── random.c
│ └── random.h
│ ├── replay
│ ├── Makefile
│ ├── replay.c
│ └── replay.h
│ ├── stats.h
│ ├── stone.c
│ ├── stone.h
│ ├── t-play
│ ├── TESTS
│ ├── autotest
│ │ ├── README
│ │ ├── TODO
│ │ ├── autotest-client
│ │ ├── autotest-clients
│ │ ├── autotest-gather
│ │ ├── autotest-lib
│ │ ├── autotest-prune
│ │ ├── autotest-show
│ │ ├── autotest-worker
│ │ └── rc
│ ├── resum
│ └── test_in_context.sh
│ ├── t-regress
│ ├── README
│ ├── TODO
│ ├── by-falseeye
│ │ ├── 2011-06-05-Zen19-pachi2.sgf
│ │ ├── 2011-06-05-tazaki-pachi30s.sgf
│ │ ├── 2011-06-09-botkiller2-pachi30s.sgf
│ │ ├── 2011-06-10-pachi30s-samba-2.sgf
│ │ ├── 2011-06-18-dorabon-pachi2-4.sgf
│ │ ├── 2011-07-28-pachi2-Novicer.sgf
│ │ └── 2011-08-12-xiaosugi-pachi2.sgf
│ ├── by-ko
│ │ └── 2011-06-09-jinen-pachi30s-2.sgf
│ ├── by-ladder
│ │ ├── 2011-01-11-llopl-pachi2.sgf
│ │ ├── 2011-06-06-tyzef-pachi30s.sgf
│ │ ├── 2011-06-13-pachi30s-Jep.sgf
│ │ ├── 2011-07-28-pachi2-pkunzip-2.sgf
│ │ ├── 2011-08-08-Dallas-pachi2-2.sgf
│ │ ├── 2011-08-09-pachi2-BlueSpark.sgf
│ │ ├── 2011-08-09-somrak-pachi2-2.sgf
│ │ ├── 2011-08-24-StoneGrid-pachi2.sgf
│ │ ├── 2011-09-04-pachi2-stv.sgf
│ │ └── 2012-03-16-IMC-pachi2.sgf
│ ├── by-semeai
│ │ ├── 2011-01-15-pachi2-rollingon.sgf
│ │ ├── 2011-06-05-Zen19-pachi2.sgf
│ │ ├── 2011-06-05-tazaki-pachi30s.sgf
│ │ ├── 2011-06-18-dorabon-pachi2-4.sgf
│ │ └── 2012-03-15-pachi2-Leech.sgf
│ ├── games
│ │ ├── 2010-12-05-pachi-CzechBot.sgf
│ │ ├── 2011-01-11-llopl-pachi2.sgf
│ │ ├── 2011-01-15-pachi2-rollingon.sgf
│ │ ├── 2011-06-05-Zen19-pachi2.sgf
│ │ ├── 2011-06-05-tazaki-pachi30s.sgf
│ │ ├── 2011-06-06-tyzef-pachi30s.sgf
│ │ ├── 2011-06-07-fidibus-pachi30s.sgf
│ │ ├── 2011-06-09-botkiller2-pachi30s.sgf
│ │ ├── 2011-06-09-jinen-pachi30s-2.sgf
│ │ ├── 2011-06-10-pachi30s-samba-2.sgf
│ │ ├── 2011-06-13-pachi30s-Jep.sgf
│ │ ├── 2011-06-18-dorabon-pachi2-4.sgf
│ │ ├── 2011-07-28-pachi2-Novicer.sgf
│ │ ├── 2011-07-28-pachi2-pkunzip-2.sgf
│ │ ├── 2011-08-08-Dallas-pachi2-2.sgf
│ │ ├── 2011-08-09-pachi2-BlueSpark.sgf
│ │ ├── 2011-08-09-somrak-pachi2-2.sgf
│ │ ├── 2011-08-12-xiaosugi-pachi2.sgf
│ │ ├── 2011-08-24-StoneGrid-pachi2.sgf
│ │ ├── 2011-09-04-pachi2-stv.sgf
│ │ ├── 2012-01-17-pachi2-Soromon-3.sgf
│ │ ├── 2012-03-15-pachi2-Leech.sgf
│ │ ├── 2012-03-16-IMC-pachi2.sgf
│ │ └── 2012-03-21-pachi2-Hujisawa-3.sgf
│ └── test-game.sh
│ ├── t-unit
│ ├── Makefile
│ ├── README
│ ├── sar.t
│ ├── test.c
│ └── test.h
│ ├── tactics
│ ├── 1lib.c
│ ├── 1lib.h
│ ├── 2lib.c
│ ├── 2lib.h
│ ├── Makefile
│ ├── ladder.c
│ ├── ladder.h
│ ├── nakade.c
│ ├── nakade.h
│ ├── nlib.c
│ ├── nlib.h
│ ├── selfatari.c
│ ├── selfatari.h
│ ├── util.c
│ └── util.h
│ ├── timeinfo.c
│ ├── timeinfo.h
│ ├── tools
│ ├── autobook
│ │ ├── README
│ │ ├── autobook.sh
│ │ ├── autobook2fbook.sh
│ │ ├── eval.sh
│ │ ├── expand.sh
│ │ └── walk.sh
│ ├── complete-tromptaylor.gtp
│ ├── complete.gtp
│ ├── genmove.gtp
│ ├── genmove19.gtp
│ ├── gentbook.sh
│ ├── kgslog2gtp.pl
│ ├── pattern3_show.pl
│ ├── pattern_bayes_gen.sh
│ ├── pattern_bayes_merge.sh
│ ├── pattern_byplayer.sh
│ ├── pattern_getdrops.pl
│ ├── pattern_spatial_gen.sh
│ ├── pattern_spatial_show.pl
│ ├── sgf-analyse.pl
│ ├── sgf-ratemove.sh
│ ├── sgf2gtp.pl
│ ├── sgf2gtp.py
│ ├── sgflib
│ │ ├── .gitignore
│ │ ├── __init__.py
│ │ ├── sgflib.py
│ │ └── typelib.py
│ ├── spirit.gtp
│ └── twogtp.py
│ ├── uct
│ ├── Makefile
│ ├── dynkomi.c
│ ├── dynkomi.h
│ ├── internal.h
│ ├── plugin.h
│ ├── plugin
│ │ ├── example.c
│ │ └── wolf.c
│ ├── plugins.c
│ ├── plugins.h
│ ├── policy
│ │ ├── Makefile
│ │ ├── generic.c
│ │ ├── generic.h
│ │ ├── ucb1.c
│ │ └── ucb1amaf.c
│ ├── prior.c
│ ├── prior.h
│ ├── search.c
│ ├── search.h
│ ├── slave.c
│ ├── slave.h
│ ├── tree.c
│ ├── tree.h
│ ├── uct.c
│ ├── uct.h
│ ├── walk.c
│ └── walk.h
│ ├── util.h
│ └── version.h
├── pachi.iml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | .DS_Store
3 | /local.properties
4 | /.idea
5 | /.gradle
6 | /captures
7 | /build
8 | */build
9 | /libs
10 | /obj
11 |
12 | *.bat
13 | *.sh
14 | *.keystore
15 | *.apk
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Pachi for Android
2 |
3 | This is the Android version of [Pachi][1], a Go game engine developed by Petr Baudis and Jean-Loup Gailly.
4 |
5 | If you make a change to Pachi's code, you have to rebuild the executable with the [Android NDK][2].
6 | To do this, open the `jni` folder and enter the command `ndk-build`. If you get errors, try to use the NDK version r10e. Sometimes newer versions require to make some changes to the code. Then copy the executable from `libs/armeabi` to the `app/src/main/res/raw` folder and replace the existing one.
7 |
8 |
9 | ## Credits
10 |
11 | - [The Pachi project](http://pachi.or.cz)
12 | - [elygo-lib](http://github.com/Daimas/elygo-lib)
13 |
14 | ## License
15 |
16 | Pachi for Android is distributed under the GPLv2 license (see the COPYING file for details and full text of the license). You are welcome to tweak it as you wish and distribute it freely, but only together with the source code.
17 |
18 | [1]: http://pachi.or.cz
19 | [2]: http://developer.android.com/tools/sdk/ndk/index.html
20 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 27
5 | buildToolsVersion '27.0.3'
6 |
7 | defaultConfig {
8 | applicationId 'net.lrstudios.android.pachi'
9 | minSdkVersion 21
10 | targetSdkVersion 27
11 | versionCode 12
12 | versionName '1.19'
13 | }
14 |
15 | signingConfigs {
16 | debug {
17 | storeFile file("../debug.keystore")
18 | }
19 |
20 | release {
21 | storeFile file("../release.keystore")
22 | storePassword System.getenv("KEYSTORE_PASSWORD")
23 | keyAlias "krelease"
24 | keyPassword System.getenv("KEYSTORE_PASSWORD")
25 | }
26 | }
27 |
28 | buildTypes {
29 | debug {
30 | minifyEnabled false
31 | signingConfig signingConfigs.debug
32 | }
33 |
34 | release {
35 | minifyEnabled false
36 | signingConfig signingConfigs.release
37 | }
38 | }
39 |
40 | lintOptions {
41 | abortOnError false
42 | }
43 | }
44 |
45 | dependencies {
46 | compile 'com.android.support:appcompat-v7:27.1.1'
47 |
48 | compile project(':elygo-lib')
49 | compile fileTree(dir: 'libs', include: ['*.jar'])
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
15 |
16 |
21 |
22 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
37 |
38 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/java/net/lrstudios/android/pachi/MainActivity.java:
--------------------------------------------------------------------------------
1 | package net.lrstudios.android.pachi;
2 |
3 | import lrstudios.games.ego.lib.ui.NewGameActivity;
4 |
5 |
6 | public class MainActivity extends NewGameActivity {
7 | @Override
8 | protected Class> getBotClass() {
9 | return PachiEngine.class;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/net/lrstudios/android/pachi/MyApplication.java:
--------------------------------------------------------------------------------
1 | package net.lrstudios.android.pachi;
2 |
3 | import android.app.Application;
4 |
5 | public class MyApplication extends Application {
6 | @Override
7 | public void onCreate() {
8 | super.onCreate();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emathis11/android-pachi/4d79cae0568776ba2ea3a05bb370fd60953e6581/app/src/main/res/drawable-hdpi/ic_home.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emathis11/android-pachi/4d79cae0568776ba2ea3a05bb370fd60953e6581/app/src/main/res/drawable-mdpi/ic_home.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emathis11/android-pachi/4d79cae0568776ba2ea3a05bb370fd60953e6581/app/src/main/res/drawable-xhdpi/ic_home.png
--------------------------------------------------------------------------------
/app/src/main/res/raw/pachi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emathis11/android-pachi/4d79cae0568776ba2ea3a05bb370fd60953e6581/app/src/main/res/raw/pachi
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Pachi
3 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | google()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.0.1'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | jcenter()
15 | google()
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emathis11/android-pachi/4d79cae0568776ba2ea3a05bb370fd60953e6581/debug.keystore
--------------------------------------------------------------------------------
/elygo-lib/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | .idea
4 | build
--------------------------------------------------------------------------------
/elygo-lib/README:
--------------------------------------------------------------------------------
1 |
2 | *** ElyGo-lib ***
3 |
4 | ElyGo-lib is the core library used by the Android application "ElyGo".
5 | It provides several features related to the game of Go (Igo, Weiqi, Baduk).
6 |
7 |
8 | *** USAGE ***
9 |
10 | It is an Android library project and cannot be run directly as it is.
11 | Check the Android documentation for more informations about library projects.
12 |
13 | You can also download the "ElyGo-bots" source code for an example on how to
14 | use this library in an application.
15 |
16 | Link : https://github.com/Daimas/elygo-bots
17 |
18 |
19 | *** Copyrights and License ***
20 |
21 | All files are under the GNU General Public License, which may be found in
22 | the file COPYING.
23 |
24 | Author :
25 |
26 | Emmanuel Mathis
27 |
--------------------------------------------------------------------------------
/elygo-lib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 27
5 | buildToolsVersion '27.0.3'
6 |
7 | defaultConfig {
8 | minSdkVersion 15
9 | targetSdkVersion 27
10 | }
11 | }
12 |
13 | dependencies {
14 | compile 'com.android.support:support-v4:27.1.1'
15 | compile 'com.android.support:appcompat-v7:27.1.1'
16 |
17 | compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
18 | }
--------------------------------------------------------------------------------
/elygo-lib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/elygo-lib/src/main/java/lrstudios/games/ego/lib/BoardLabelMark.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Elygo-lib.
3 | * Copyright (C) 2012 Emmanuel Mathis [emmanuel *at* lr-studios.net]
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package lrstudios.games.ego.lib;
20 |
21 |
22 | /**
23 | * Represents a board mark with a label (usually letters or digits).
24 | */
25 | public final class BoardLabelMark extends BoardMark {
26 | protected char _label;
27 |
28 | public BoardLabelMark(int x, int y, char label) {
29 | super(x, y, MARK_LABEL);
30 | _label = label;
31 | }
32 |
33 |
34 | /**
35 | * {@inheritDoc}
36 | */
37 | @Override
38 | public char getLabel() {
39 | return _label;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/elygo-lib/src/main/java/lrstudios/games/ego/lib/BoardMark.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Elygo-lib.
3 | * Copyright (C) 2012 Emmanuel Mathis [emmanuel *at* lr-studios.net]
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package lrstudios.games.ego.lib;
20 |
21 |
22 | /**
23 | * Represents a mark on a Go Board (like triangles, squares, letters, ...).
24 | */
25 | public class BoardMark {
26 | public static final byte
27 | NO_MARK = 0,
28 | MARK_TRIANGLE = 1,
29 | MARK_CIRCLE = 2,
30 | MARK_SQUARE = 3,
31 | MARK_CROSS = 4,
32 | MARK_WHITE_TERRITORY = 5,
33 | MARK_BLACK_TERRITORY = 6,
34 | MARK_WHITE_TRANSPARENT = 7,
35 | MARK_BLACK_TRANSPARENT = 8,
36 | MARK_LABEL = 9,
37 | MARK_ADD_BLACK = 50,
38 | MARK_ADD_WHITE = 51,
39 | MARK_ADD_EMPTY = 52;
40 |
41 |
42 | /**
43 | * The mark type : one of the MARK_* constants.
44 | */
45 | public byte type;
46 | public byte x;
47 | public byte y;
48 |
49 |
50 | /**
51 | * Creates a new Board Mark.
52 | */
53 | public BoardMark(int x, int y, byte type) {
54 | this.type = type;
55 | this.x = (byte) x;
56 | this.y = (byte) y;
57 | }
58 |
59 | public short getIntersection(int size) {
60 | return (short) (y * size + x);
61 | }
62 |
63 |
64 | /**
65 | * Returns the label associated with this mark (or '\0' if there is none).
66 | */
67 | public char getLabel() {
68 | return 0;
69 | }
70 |
71 |
72 | @Override
73 | public String toString() {
74 | return "[BoardMark] type = " + type + " at (" + x + ", " + y + ")";
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/elygo-lib/src/main/java/lrstudios/games/ego/lib/Coords.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Elygo-lib.
3 | * Copyright (C) 2012 Emmanuel Mathis [emmanuel *at* lr-studios.net]
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package lrstudios.games.ego.lib;
20 |
21 |
22 | /**
23 | * Represents a point defined by two coordinates.
24 | */
25 | public final class Coords {
26 | public int x;
27 | public int y;
28 |
29 |
30 | public Coords() {
31 | }
32 |
33 | public Coords(final int x, final int y) {
34 | this.x = x;
35 | this.y = y;
36 | }
37 |
38 | public void set(final int x, final int y) {
39 | this.x = x;
40 | this.y = y;
41 | }
42 |
43 |
44 | @Override
45 | public String toString() {
46 | return String.format("(%d, %d)", x, y);
47 | }
48 |
49 |
50 | /**
51 | * Returns true if the specified object have the same coordinates that the current object.
52 | */
53 | @Override
54 | public boolean equals(Object obj) {
55 | if (obj instanceof Coords) {
56 | Coords coords = (Coords) obj;
57 | return x == coords.x && y == coords.y;
58 | }
59 | return false;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/elygo-lib/src/main/java/lrstudios/games/ego/lib/IntentGameInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Elygo-lib.
3 | * Copyright (C) 2012 Emmanuel Mathis [emmanuel *at* lr-studios.net]
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package lrstudios.games.ego.lib;
20 |
21 | import android.os.Parcel;
22 | import android.os.Parcelable;
23 |
24 |
25 | /**
26 | * This parcelable class is passed to a BoardActivity to start a new game
27 | * with the specified parameters.
28 | */
29 | public final class IntentGameInfo implements Parcelable {
30 | public int boardSize;
31 | public int handicap;
32 | public byte color;
33 | public double komi;
34 | public int botLevel;
35 | public String rules = "";
36 |
37 |
38 | public IntentGameInfo() {
39 | }
40 |
41 | public IntentGameInfo(Parcel in) {
42 | boardSize = in.readInt();
43 | handicap = in.readInt();
44 | color = in.readByte();
45 | komi = in.readDouble();
46 | botLevel = in.readInt();
47 | rules = in.readString();
48 | }
49 |
50 |
51 | @Override
52 | public int describeContents() {
53 | return 0;
54 | }
55 |
56 | @Override
57 | public void writeToParcel(Parcel parcel, int i) {
58 | parcel.writeInt(boardSize);
59 | parcel.writeInt(handicap);
60 | parcel.writeByte(color);
61 | parcel.writeDouble(komi);
62 | parcel.writeInt(botLevel);
63 | parcel.writeString(rules);
64 | }
65 |
66 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
67 | @Override
68 | public IntentGameInfo createFromParcel(Parcel source) {
69 | return new IntentGameInfo(source);
70 | }
71 |
72 | @Override
73 | public IntentGameInfo[] newArray(int size) {
74 | return new IntentGameInfo[size];
75 | }
76 | };
77 | }
78 |
--------------------------------------------------------------------------------
/elygo-lib/src/main/java/lrstudios/games/ego/lib/LibConfig.java:
--------------------------------------------------------------------------------
1 | package lrstudios.games.ego.lib;
2 |
3 |
4 | public class LibConfig {
5 | public static final String ASSET_ROBOTO_LIGHT = "fonts/Roboto-Light.ttf";
6 | public static final String ASSET_ROBOTO_REGULAR = "fonts/Roboto-Regular.ttf";
7 | public static final String ASSET_ROBOTO_BOLD = "fonts/Roboto-Bold.ttf";
8 | }
9 |
--------------------------------------------------------------------------------
/elygo-lib/src/main/java/lrstudios/games/ego/lib/LightCoords.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Elygo-lib.
3 | * Copyright (C) 2012 Emmanuel Mathis [emmanuel *at* lr-studios.net]
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package lrstudios.games.ego.lib;
20 |
21 | /**
22 | * These move coordinates are stored in 3 bytes, to reduce memory usage on Android.
23 | */
24 | public final class LightCoords {
25 | public byte x;
26 | public byte y;
27 | public byte color;
28 |
29 | public LightCoords(int x, int y, byte color) {
30 | this.x = (byte) x;
31 | this.y = (byte) y;
32 | this.color = color;
33 | }
34 |
35 |
36 | /**
37 | * Ne compare que les coordonnées, pas la couleur.
38 | */
39 | @Override
40 | public boolean equals(Object obj) {
41 | if (obj instanceof LightCoords) {
42 | LightCoords coords = (LightCoords) obj;
43 | return x == coords.x && y == coords.y;
44 | }
45 | return false;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/elygo-lib/src/main/java/lrstudios/games/ego/lib/TypefaceCache.java:
--------------------------------------------------------------------------------
1 | package lrstudios.games.ego.lib;
2 |
3 | import android.content.res.AssetManager;
4 | import android.graphics.Typeface;
5 |
6 | import java.util.Hashtable;
7 |
8 |
9 | public class TypefaceCache {
10 | private static final Hashtable cache = new Hashtable();
11 |
12 | public static Typeface get(AssetManager assetMgr, String assetPath) {
13 | synchronized (cache) {
14 | if (!cache.containsKey(assetPath)) {
15 | Typeface typeface = Typeface.createFromAsset(assetMgr, assetPath);
16 | cache.put(assetPath, typeface);
17 | }
18 | return cache.get(assetPath);
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/elygo-lib/src/main/java/lrstudios/games/ego/lib/UpdatePrefsTask.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Elygo-lib.
3 | * Copyright (C) 2012 Emmanuel Mathis [emmanuel *at* lr-studios.net]
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package lrstudios.games.ego.lib;
20 |
21 | import android.content.SharedPreferences;
22 | import android.os.AsyncTask;
23 | import android.util.Log;
24 |
25 | /**
26 | * Updates a specified SharedPreferences object on a secondary thread.
27 | */
28 | public final class UpdatePrefsTask extends AsyncTask