Android: Maia on her own scale (600–2600); games written into the player's database
As on the desktop (decisions «Партии игрока записываются сами», «Сила соперника — по шкале самого движка»): - mobile-api: Maia plays the rating on the slider, temperature 1; the sheet says it is her own rating, not a person's Elo. - PlayerGames: «<name> — games against the computer» (no name: «Games against the computer»), an own database made at the first game; a game ends → written once (the mark kept with commit, guarded by the game's serial against a rematch); a game put aside and let go (×, «Start new», Maia failing) → written unfinished, once both have moved. - Play sheet: «Your name» with the phone's players (filtered by what is typed), the line where games go; result card «✓ В «…», № n ›» (a new database said there), opens it; no third button; a failed write said with its reason. ♞ on the row, «пишутся сами»; a setting. - «Play from here» and «Continue it» inside a play game show the new game. Checked on the emulator by the tester (kill right after the end, rematch, rename/delete of the database, setting off) and the designer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
aa136fb85e
commit
07a9e120b1
24 changed files with 487 additions and 55 deletions
|
|
@ -11,6 +11,7 @@ import io.github.vrubelroman.chesspenguin.data.DbEntry
|
|||
import io.github.vrubelroman.chesspenguin.data.EngineFiles
|
||||
import io.github.vrubelroman.chesspenguin.data.MaiaFiles
|
||||
import io.github.vrubelroman.chesspenguin.data.MaiaGames
|
||||
import io.github.vrubelroman.chesspenguin.data.PlayerGames
|
||||
import io.github.vrubelroman.chesspenguin.data.Sounds
|
||||
import io.github.vrubelroman.chesspenguin.data.Library
|
||||
import io.github.vrubelroman.chesspenguin.data.OnlineDownloads
|
||||
|
|
@ -37,6 +38,8 @@ class ChessPenguinApp : Application() {
|
|||
val maiaFiles by lazy { MaiaFiles(this, scope) }
|
||||
/// The game against Maia in hand (android-play.md §31.7).
|
||||
val maiaGames by lazy { MaiaGames(this) }
|
||||
/// The players' databases: games against Maia written by themselves (player-games.md).
|
||||
val playerGames by lazy { PlayerGames(this, library) }
|
||||
/// The sounds of moves and of the end of a game (android-play.md §33).
|
||||
val sounds by lazy { Sounds(this, settings) }
|
||||
/// Games from Lichess and Chess.com being downloaded (android-ui.md §23).
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ fun MainNavigation() {
|
|||
GameScreen(PLAY_GAME, 0, "", onBack = { backStack.removeLastOrNull() }, onSettings = { backStack.add(SettingsKey) }, onPlayGame = {
|
||||
backStack.removeLastOrNull()
|
||||
backStack.add(PlayKey)
|
||||
})
|
||||
}, onOpenDatabase = { id -> backStack.add(Games(id)) })
|
||||
}
|
||||
entry<Games> { key ->
|
||||
GamesScreen(key.db, onBack = { backStack.removeLastOrNull() }, onGame = { place, query -> backStack.add(GameAt(key.db, place, query)) })
|
||||
|
|
|
|||
|
|
@ -34,10 +34,18 @@ class MaiaGames(context: Context) {
|
|||
/// The PGN of the game in hand.
|
||||
fun pgn(): String? = runCatching { file.readText() }.getOrNull()
|
||||
|
||||
/// Which game is in hand: bumped by each new one (a write that ends after a rematch
|
||||
/// began is not taken for the new game's).
|
||||
var serial = 0
|
||||
private set
|
||||
|
||||
/// A new game: it replaces the one in hand.
|
||||
fun begin(pgn: String, meta: PlayMeta) {
|
||||
serial++
|
||||
write(pgn)
|
||||
prefs.edit()
|
||||
.remove("writtenDb")
|
||||
.remove("writtenIndex")
|
||||
.putInt("strength", meta.strength)
|
||||
.putBoolean("white", meta.userWhite)
|
||||
.putString("name", meta.name)
|
||||
|
|
@ -55,10 +63,23 @@ class MaiaGames(context: Context) {
|
|||
/// The game ended: it is not offered to go on with any more.
|
||||
fun finish(pgn: String) {
|
||||
save(pgn)
|
||||
prefs.edit().putBoolean("over", true).apply()
|
||||
// At once (commit): a game over must not come back as one to go on with.
|
||||
prefs.edit().putBoolean("over", true).commit()
|
||||
_current.value = _current.value?.copy(over = true)
|
||||
}
|
||||
|
||||
/// The game was written into its player's database: database and number there.
|
||||
fun setWritten(id: String, index: UInt, game: Int) {
|
||||
if (game != serial) return
|
||||
prefs.edit().putString("writtenDb", id).putLong("writtenIndex", index.toLong()).commit()
|
||||
}
|
||||
|
||||
/// Where the game in hand was written, if it was.
|
||||
fun written(): Pair<String, UInt>? {
|
||||
val id = prefs.getString("writtenDb", null) ?: return null
|
||||
return id to prefs.getLong("writtenIndex", 0).toUInt()
|
||||
}
|
||||
|
||||
/// The game is gone (left after its end, removed by the user).
|
||||
fun clear() {
|
||||
file.delete()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,111 @@
|
|||
package io.github.vrubelroman.chesspenguin.data
|
||||
|
||||
import android.content.Context
|
||||
import io.github.vrubelroman.chesspenguin.R
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
|
||||
/// A game written into its player's database: the database, its number there (from 0),
|
||||
/// and whether the database was made for it.
|
||||
data class Written(val id: String, val name: String, val index: UInt, val created: Boolean)
|
||||
|
||||
/// The players' databases (docs/design/player-games.md §6, decisions «Партии игрока
|
||||
/// записываются сами»): every game against Maia goes by itself into an own database of
|
||||
/// its player — «Roman — games against the computer», made at their first game; without
|
||||
/// a name, «Games against the computer». Only new games are added; replacing and
|
||||
/// deleting stay the user's.
|
||||
class PlayerGames(private val context: Context, private val library: Library) {
|
||||
private val store = context.getSharedPreferences("players", Context.MODE_PRIVATE)
|
||||
private val lock = Mutex()
|
||||
|
||||
/// The name as it is kept: trimmed, inner spaces single.
|
||||
fun tidy(name: String): String = name.trim().split(Regex("\\s+")).filter { it.isNotEmpty() }.joinToString(" ")
|
||||
|
||||
/// Names that are the same player: «Иван» and «иван ».
|
||||
private fun key(name: String) = tidy(name).lowercase()
|
||||
|
||||
/// The name of a new database for the player.
|
||||
fun dbName(name: String): String = tidy(name).let {
|
||||
if (it.isEmpty()) context.getString(R.string.player_db_shared) else context.getString(R.string.player_db_name, it)
|
||||
}
|
||||
|
||||
/// The player's database, while it is on the list.
|
||||
fun database(name: String): DbEntry? =
|
||||
store.getString("db:" + key(name), null)?.let { library.entry(it) }?.takeIf { it.source == Source.Own }
|
||||
|
||||
/// Whether `id` is a player's database (a knight on its row).
|
||||
fun isPlayers(id: String): Boolean = store.all.any { (k, v) -> k.startsWith("db:") && v == id }
|
||||
|
||||
/// The players who played here, the last first (named ones).
|
||||
fun players(): List<String> =
|
||||
(store.getString("order", "") ?: "").split('\n').filter { it.isNotEmpty() }
|
||||
.mapNotNull { store.getString("name:$it", null) }
|
||||
|
||||
/// The player who starts a game goes first in the list.
|
||||
fun remember(name: String) {
|
||||
val k = key(name)
|
||||
if (k.isEmpty()) return
|
||||
val order = listOf(k) + (store.getString("order", "") ?: "").split('\n').filter { it.isNotEmpty() && it != k }
|
||||
store.edit().putString("name:$k", tidy(name)).putString("order", order.joinToString("\n")).apply()
|
||||
}
|
||||
|
||||
/// The game in hand let go unfinished (× on its card, a new game in its place, Maia
|
||||
/// failing): kept in the player's database with `*` once both have moved, unless it
|
||||
/// was written already or the user turned writing off. What is in hand is taken at
|
||||
/// once (the caller may put a new game there right after); `then` on `scope`.
|
||||
/// Whether it is written (a game without moves of both sides is not).
|
||||
fun keepUnfinished(games: MaiaGames, record: Boolean, scope: CoroutineScope, then: (Written) -> Unit = {}): Boolean {
|
||||
if (!wouldKeep(games, record)) return false
|
||||
val m = games.current.value ?: return false
|
||||
val pgn = games.pgn() ?: return false
|
||||
scope.launch { runCatching { writeUnfinished(m, pgn) }.getOrNull()?.let(then) }
|
||||
return true
|
||||
}
|
||||
|
||||
/// Whether the game in hand, let go now, would be kept.
|
||||
fun wouldKeep(games: MaiaGames, record: Boolean): Boolean {
|
||||
val m = games.current.value ?: return false
|
||||
if (m.over || !record || games.written() != null) return false
|
||||
val pgn = games.pgn() ?: return false
|
||||
return plies(pgn) - m.floor >= 2
|
||||
}
|
||||
|
||||
/// Half-moves of the main line.
|
||||
private fun plies(pgn: String): Int {
|
||||
val s = uniffi.mobile_api.GameSession.fromPgn(pgn)
|
||||
try {
|
||||
val d = s.data()
|
||||
var n = 0
|
||||
var plies = 0
|
||||
while (true) {
|
||||
n = d.nodes[n].children.firstOrNull()?.toInt() ?: return plies
|
||||
plies++
|
||||
}
|
||||
} finally {
|
||||
s.close()
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun writeUnfinished(m: PlayMeta, pgn: String): Written {
|
||||
val s = uniffi.mobile_api.GameSession.fromPgn(pgn)
|
||||
val text = try {
|
||||
s.setData(listOf(uniffi.mobile_api.Tag("Termination", "Unterminated")), "*")
|
||||
s.pgn()
|
||||
} finally {
|
||||
s.close()
|
||||
}
|
||||
return write(m.name, text)
|
||||
}
|
||||
|
||||
/// Adds `pgn` to the player's database, making it first when they have none.
|
||||
suspend fun write(name: String, pgn: String): Written = lock.withLock {
|
||||
val existing = database(name)
|
||||
val entry = existing ?: library.createOwn(dbName(name)).also {
|
||||
store.edit().putString("db:" + key(name), it.id).apply()
|
||||
}
|
||||
val n = library.saveOwn(entry.id, null, pgn)
|
||||
Written(entry.id, entry.name, n, existing == null)
|
||||
}
|
||||
}
|
||||
|
|
@ -36,6 +36,8 @@ data class Prefs(
|
|||
val yourName: String = "",
|
||||
/// Sounds of moves and of the end of a game (§33).
|
||||
val sound: Boolean = true,
|
||||
/// Games against Maia go by themselves into the player's database (player-games.md).
|
||||
val recordGames: Boolean = true,
|
||||
)
|
||||
|
||||
/// Half the cores, at most 2: the engine leaves the phone's interface room (§9).
|
||||
|
|
@ -76,6 +78,7 @@ class Settings(context: Context) {
|
|||
maiaColor = store.getInt("maiaColor", d.maiaColor).coerceIn(-1, 1),
|
||||
yourName = store.getString("yourName", d.yourName) ?: d.yourName,
|
||||
sound = store.getBoolean("sound", d.sound),
|
||||
recordGames = store.getBoolean("recordGames", d.recordGames),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -100,6 +103,7 @@ class Settings(context: Context) {
|
|||
.putInt("maiaColor", p.maiaColor)
|
||||
.putString("yourName", p.yourName)
|
||||
.putBoolean("sound", p.sound)
|
||||
.putBoolean("recordGames", p.recordGames)
|
||||
.apply()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSett
|
|||
val theApp = app()
|
||||
val adjourned by theApp.maiaGames.current.collectAsState()
|
||||
val playRemovedText = stringResource(R.string.play_removed)
|
||||
val keptText = stringResource(R.string.player_kept_unfinished)
|
||||
var playing by remember { mutableStateOf(false) }
|
||||
// A game put aside: asked about before a new one replaces it.
|
||||
var askingAdjourned by remember { mutableStateOf(false) }
|
||||
|
|
@ -276,6 +277,18 @@ fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSett
|
|||
)
|
||||
TextButton(onClick = onPlay) { Text(stringResource(R.string.play_continue)) }
|
||||
IconButton(onClick = {
|
||||
// Played on both sides: kept in the player's database,
|
||||
// unfinished (no «Undo»: it is there to be deleted).
|
||||
val kept = theApp.playerGames.keepUnfinished(theApp.maiaGames, theApp.settings.prefs.value.recordGames, scope) { w ->
|
||||
scope.launch {
|
||||
snackbar.currentSnackbarData?.dismiss()
|
||||
snackbar.showSnackbar(String.format(keptText, w.name))
|
||||
}
|
||||
}
|
||||
if (kept) {
|
||||
theApp.maiaGames.clear()
|
||||
return@IconButton
|
||||
}
|
||||
val pgn = theApp.maiaGames.pgn()
|
||||
theApp.maiaGames.clear()
|
||||
scope.launch {
|
||||
|
|
@ -321,6 +334,7 @@ fun DatabasesScreen(onOpen: (String) -> Unit, onAdded: (DbEntry) -> Unit, onSett
|
|||
items(own, key = { it.id }) { e ->
|
||||
OwnRow(
|
||||
e,
|
||||
player = theApp.playerGames.isPlayers(e.id),
|
||||
onOpen = { onOpen(e.id) },
|
||||
onRename = { renaming = e },
|
||||
onExport = {
|
||||
|
|
@ -526,7 +540,7 @@ private fun NewOwnDialog(suggested: String, onDismiss: () -> Unit, onCreate: (St
|
|||
/// An own database: its games are the user's, kept on the phone (android-play.md §30.2).
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
private fun OwnRow(e: DbEntry, onOpen: () -> Unit, onRename: () -> Unit, onExport: () -> Unit, onDelete: () -> Unit, modifier: Modifier) {
|
||||
private fun OwnRow(e: DbEntry, player: Boolean, onOpen: () -> Unit, onRename: () -> Unit, onExport: () -> Unit, onDelete: () -> Unit, modifier: Modifier) {
|
||||
var menu by remember { mutableStateOf(false) }
|
||||
val n = e.games ?: 0
|
||||
Box(modifier) {
|
||||
|
|
@ -541,11 +555,18 @@ private fun OwnRow(e: DbEntry, onOpen: () -> Unit, onRename: () -> Unit, onExpor
|
|||
Box(
|
||||
Modifier.size(40.dp).clip(RoundedCornerShape(8.dp)).background(MaterialTheme.colorScheme.primaryContainer),
|
||||
contentAlignment = Alignment.Center,
|
||||
) { Icon(Icons.Rounded.EditNote, null, tint = MaterialTheme.colorScheme.onPrimaryContainer) }
|
||||
) {
|
||||
// A player's database (games against Maia written by themselves): a knight.
|
||||
if (player) {
|
||||
Text("♞", style = MaterialTheme.typography.titleLarge, color = MaterialTheme.colorScheme.onPrimaryContainer)
|
||||
} else {
|
||||
Icon(Icons.Rounded.EditNote, null, tint = MaterialTheme.colorScheme.onPrimaryContainer)
|
||||
}
|
||||
}
|
||||
Column(Modifier.weight(1f).padding(start = 16.dp)) {
|
||||
Text(displayName(e), style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
Text(
|
||||
pluralStringResource(R.plurals.games_count, n, groupDigits(n)) + " · " + stringResource(R.string.own_on_phone),
|
||||
pluralStringResource(R.plurals.games_count, n, groupDigits(n)) + " · " + stringResource(if (player) R.string.player_db_row else R.string.own_on_phone),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 1,
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ import androidx.lifecycle.LifecycleEventObserver
|
|||
import androidx.lifecycle.compose.LocalLifecycleOwner
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import io.github.vrubelroman.chesspenguin.data.Source
|
||||
import io.github.vrubelroman.chesspenguin.data.Written
|
||||
import io.github.vrubelroman.chesspenguin.R
|
||||
import io.github.vrubelroman.chesspenguin.data.EngineSession
|
||||
import io.github.vrubelroman.chesspenguin.data.NetState
|
||||
|
|
@ -137,9 +138,19 @@ private data class Preview(val line: EngineLine, val step: Int, val best: Boolea
|
|||
/// under the thumb; ‹ › page the games of the list (android-ui.md §7).
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun GameScreen(db: String, startPlace: Int, query: String, onBack: () -> Unit, onSettings: () -> Unit, onPlayGame: () -> Unit = {}) {
|
||||
fun GameScreen(
|
||||
db: String,
|
||||
startPlace: Int,
|
||||
query: String,
|
||||
onBack: () -> Unit,
|
||||
onSettings: () -> Unit,
|
||||
onPlayGame: () -> Unit = {},
|
||||
onOpenDatabase: (String) -> Unit = {},
|
||||
) {
|
||||
val app = app()
|
||||
val context = LocalContext.current
|
||||
// Configuration-aware (the language can change while the screen is up).
|
||||
val resources = androidx.compose.ui.platform.LocalResources.current
|
||||
val prefs by app.settings.prefs.collectAsState()
|
||||
val libraryEntries by app.library.entries.collectAsState()
|
||||
val dbEntry = libraryEntries.firstOrNull { it.id == db }
|
||||
|
|
@ -184,7 +195,11 @@ fun GameScreen(db: String, startPlace: Int, query: String, onBack: () -> Unit, o
|
|||
return@LaunchedEffect
|
||||
}
|
||||
held.key = PLAY_GAME
|
||||
held.savedTo = null
|
||||
// A game written into its player's database is that database's game.
|
||||
val written = app.maiaGames.written()
|
||||
held.savedTo = written
|
||||
held.recordError.value = null
|
||||
held.recorded.value = written?.let { (id, n) -> Written(id, app.library.entry(id)?.name ?: "", n, false) }
|
||||
val s = GameSession.fromPgn(pgn)
|
||||
edit = s
|
||||
val d = s.data()
|
||||
|
|
@ -443,6 +458,7 @@ fun GameScreen(db: String, startPlace: Int, query: String, onBack: () -> Unit, o
|
|||
fun persist() {
|
||||
if (run != null) edit?.let { app.maiaGames.save(it.pgn()) }
|
||||
}
|
||||
val recordFailedText = stringResource(R.string.player_write_failed)
|
||||
fun finishGame(over: PlayOver) {
|
||||
val r = run ?: return
|
||||
val e = edit ?: return
|
||||
|
|
@ -452,7 +468,27 @@ fun GameScreen(db: String, startPlace: Int, query: String, onBack: () -> Unit, o
|
|||
e.setData(listOf(uniffi.mobile_api.Tag("Termination", "Normal")), over.result)
|
||||
game = e.data().copy(notes = held.notes)
|
||||
r.over.value = over
|
||||
app.maiaGames.finish(e.pgn())
|
||||
val pgn = e.pgn()
|
||||
app.maiaGames.finish(pgn)
|
||||
// Into the player's database by itself (player-games.md); a new one is said once.
|
||||
val serial = app.maiaGames.serial
|
||||
if (prefs.recordGames && app.maiaGames.written() == null) scope.launch {
|
||||
runCatching { app.playerGames.write(r.meta.name, pgn) }
|
||||
.onSuccess { w ->
|
||||
app.maiaGames.setWritten(w.id, w.index, serial)
|
||||
// The screen still shows that game (no rematch since).
|
||||
if (app.maiaGames.serial == serial) {
|
||||
if (edit === e && e.pgn() == pgn) e.markSaved()
|
||||
held.savedTo = w.id to w.index
|
||||
held.recorded.value = w
|
||||
}
|
||||
}
|
||||
.onFailure { err ->
|
||||
if (app.maiaGames.serial != serial) return@onFailure
|
||||
val name = app.playerGames.database(r.meta.name)?.name ?: app.playerGames.dbName(r.meta.name)
|
||||
held.recordError.value = String.format(recordFailedText, name, err.message ?: err.javaClass.simpleName)
|
||||
}
|
||||
}
|
||||
app.sounds.play(
|
||||
when (over.heading) {
|
||||
R.string.play_won -> io.github.vrubelroman.chesspenguin.data.Sound.Success
|
||||
|
|
@ -758,6 +794,7 @@ fun GameScreen(db: String, startPlace: Int, query: String, onBack: () -> Unit, o
|
|||
onResign = { resigning = true },
|
||||
onDraw = ::offerDraw,
|
||||
onAbort = {
|
||||
app.playerGames.keepUnfinished(app.maiaGames, prefs.recordGames, app.scope)
|
||||
app.maiaGames.clear()
|
||||
onBack()
|
||||
},
|
||||
|
|
@ -927,6 +964,7 @@ fun GameScreen(db: String, startPlace: Int, query: String, onBack: () -> Unit, o
|
|||
maiaRetry = true
|
||||
},
|
||||
onAbort = {
|
||||
app.playerGames.keepUnfinished(app.maiaGames, prefs.recordGames, app.scope)
|
||||
app.maiaGames.clear()
|
||||
onBack()
|
||||
},
|
||||
|
|
@ -934,6 +972,9 @@ fun GameScreen(db: String, startPlace: Int, query: String, onBack: () -> Unit, o
|
|||
runOver != null && !resultClosed -> ResultCard(
|
||||
runOver,
|
||||
saved = held.savedTo != null && !modified,
|
||||
recorded = held.recorded.value,
|
||||
recordError = held.recordError.value,
|
||||
onOpenRecorded = { id -> onOpenDatabase(id) },
|
||||
onAnalyse = {
|
||||
val e = edit
|
||||
// The report takes the place: the card would be squeezed.
|
||||
|
|
@ -1283,8 +1324,10 @@ fun GameScreen(db: String, startPlace: Int, query: String, onBack: () -> Unit, o
|
|||
onPlay = { strength, white, name ->
|
||||
playFrom = null
|
||||
val s = runCatching { edit?.playFrom(fromMove.toUInt()) }.getOrNull() ?: return@PlaySheet
|
||||
beginMaiaGame(app, s, strength, white, name, depth(g, fromMove), eventText, context.getString(R.string.play_note_from, strength.toString()))
|
||||
beginMaiaGame(app, s, strength, white, name, depth(g, fromMove), eventText, resources.getString(R.string.play_note_from, strength.toString()))
|
||||
s.close()
|
||||
// On the play screen itself the game in hand is read anew.
|
||||
held.key = null
|
||||
onPlayGame()
|
||||
},
|
||||
onDismiss = { playFrom = null },
|
||||
|
|
@ -1296,6 +1339,7 @@ fun GameScreen(db: String, startPlace: Int, query: String, onBack: () -> Unit, o
|
|||
if (askAt != null && adjournedMeta != null) {
|
||||
AdjournedQuestion(adjournedMeta, onContinue = {
|
||||
askFrom = null
|
||||
held.key = null
|
||||
onPlayGame()
|
||||
}, onNew = {
|
||||
askFrom = null
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
package io.github.vrubelroman.chesspenguin.ui
|
||||
|
||||
import androidx.compose.foundation.layout.wrapContentHeight
|
||||
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
|
|
@ -27,6 +33,7 @@ import androidx.compose.material3.Text
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.res.stringResource
|
||||
|
|
@ -164,7 +171,17 @@ fun OfferCard(onAccept: () -> Unit, onPlayOn: () -> Unit) {
|
|||
|
||||
/// The end of the game (§31.4): the result, then analyse, rematch, save.
|
||||
@Composable
|
||||
fun ResultCard(over: PlayOver, saved: Boolean, onAnalyse: () -> Unit, onRematch: () -> Unit, onSave: () -> Unit, onClose: () -> Unit) {
|
||||
fun ResultCard(
|
||||
over: PlayOver,
|
||||
saved: Boolean,
|
||||
recorded: io.github.vrubelroman.chesspenguin.data.Written?,
|
||||
recordError: String?,
|
||||
onOpenRecorded: (String) -> Unit,
|
||||
onAnalyse: () -> Unit,
|
||||
onRematch: () -> Unit,
|
||||
onSave: () -> Unit,
|
||||
onClose: () -> Unit,
|
||||
) {
|
||||
Card {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
|
|
@ -174,14 +191,32 @@ fun ResultCard(over: PlayOver, saved: Boolean, onAnalyse: () -> Unit, onRematch:
|
|||
)
|
||||
IconButton(onClick = onClose) { Icon(Icons.Rounded.Close, stringResource(R.string.close)) }
|
||||
}
|
||||
// Where the game went by itself: its player's database, opened by a tap.
|
||||
// A new database says so here, once (no snackbar over the buttons).
|
||||
recorded?.let { w ->
|
||||
Text(
|
||||
stringResource(if (w.created) R.string.player_written_new else R.string.player_written, w.name, (w.index + 1u).toString()),
|
||||
Modifier.fillMaxWidth().heightIn(min = 40.dp).clickable { onOpenRecorded(w.id) }.wrapContentHeight(Alignment.CenterVertically),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
recordError?.let {
|
||||
Text(it, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.error, maxLines = 3)
|
||||
}
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
val pad = androidx.compose.foundation.layout.PaddingValues(horizontal = 8.dp)
|
||||
Button(onClick = onAnalyse, modifier = Modifier.weight(1f), contentPadding = pad) { Text(stringResource(R.string.play_analyse_short), maxLines = 1, overflow = TextOverflow.Ellipsis) }
|
||||
OutlinedButton(onClick = onRematch, modifier = Modifier.weight(1f), contentPadding = pad) {
|
||||
Text(stringResource(R.string.play_rematch).removePrefix("↻ "), maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
OutlinedButton(onClick = onSave, enabled = !saved, modifier = Modifier.weight(1f), contentPadding = pad) {
|
||||
Text(stringResource(if (saved) R.string.play_saved else R.string.play_save), maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
// Written by itself: the line above says where; no third button.
|
||||
if (recorded == null) {
|
||||
OutlinedButton(onClick = onSave, enabled = !saved, modifier = Modifier.weight(1f), contentPadding = pad) {
|
||||
Text(stringResource(if (saved) R.string.play_saved else R.string.play_save), maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -220,6 +255,9 @@ fun beginMaiaGame(
|
|||
runCatching { session.addComment(lineEnd(data).toUInt(), note) }
|
||||
}
|
||||
session.markSaved()
|
||||
// The game it replaces, if left unfinished, is kept in its player's database.
|
||||
app.playerGames.keepUnfinished(app.maiaGames, app.settings.prefs.value.recordGames, app.scope)
|
||||
app.playerGames.remember(name)
|
||||
app.maiaGames.begin(session.pgn(), PlayMeta(strength, userWhite, name, floor))
|
||||
}
|
||||
|
||||
|
|
@ -239,10 +277,13 @@ fun FailureCard(onRetry: () -> Unit, onAbort: () -> Unit) {
|
|||
/// replaced).
|
||||
@Composable
|
||||
fun AdjournedQuestion(meta: PlayMeta, onContinue: () -> Unit, onNew: () -> Unit, onDismiss: () -> Unit) {
|
||||
val app = app()
|
||||
// Said only when the game will be kept (moves of both sides, writing on).
|
||||
val kept = remember { app.playerGames.wouldKeep(app.maiaGames, app.settings.prefs.value.recordGames) }
|
||||
androidx.compose.material3.AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text(stringResource(R.string.play_adjourned_q, meta.strength.toString())) },
|
||||
text = { Text(stringResource(R.string.play_adjourned_new_text)) },
|
||||
text = { Text(stringResource(if (kept) R.string.play_adjourned_new_text else R.string.play_adjourned_replaced)) },
|
||||
confirmButton = { androidx.compose.material3.TextButton(onClick = onContinue) { Text(stringResource(R.string.play_continue_it)) } },
|
||||
dismissButton = { androidx.compose.material3.TextButton(onClick = onNew) { Text(stringResource(R.string.play_start_new)) } },
|
||||
)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ import androidx.compose.foundation.verticalScroll
|
|||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.Close
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.ExposedDropdownMenuAnchorType
|
||||
import androidx.compose.material3.ExposedDropdownMenuBox
|
||||
import androidx.compose.material3.ExposedDropdownMenuDefaults
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
|
|
@ -123,7 +127,51 @@ fun PlaySheet(from: PlayFrom?, onPlay: (Int, Boolean, String) -> Unit, onDismiss
|
|||
}
|
||||
}
|
||||
Spacer(Modifier.height(12.dp))
|
||||
OutlinedTextField(name, { name = it }, Modifier.fillMaxWidth(), label = { Text(stringResource(R.string.play_your_name)) }, singleLine = true)
|
||||
// The name, with the players of this phone to pick from; under it, where the
|
||||
// games go (player-games.md §6).
|
||||
val players = remember { app.playerGames.players() }
|
||||
var picking by remember { mutableStateOf(false) }
|
||||
val line = if (!prefs.recordGames) {
|
||||
stringResource(R.string.player_line_off)
|
||||
} else {
|
||||
val db = app.playerGames.database(name)
|
||||
when {
|
||||
app.playerGames.tidy(name).isEmpty() -> stringResource(R.string.player_line_noname, db?.name ?: app.playerGames.dbName(""))
|
||||
db != null -> stringResource(R.string.player_line_existing, db.name) + " · " +
|
||||
androidx.compose.ui.res.pluralStringResource(R.plurals.games_count, db.games ?: 0, groupDigits(db.games ?: 0))
|
||||
else -> stringResource(R.string.player_line_new, app.playerGames.dbName(name))
|
||||
}
|
||||
}
|
||||
// The players whose names begin with what is typed (none once it is one of them).
|
||||
val typed = app.playerGames.tidy(name).lowercase()
|
||||
val matching = players.filter { it.lowercase().startsWith(typed) && it.lowercase() != typed }
|
||||
// Opened by typing or by its arrow, not by a tap in the field (it would cover «Play»).
|
||||
ExposedDropdownMenuBox(expanded = picking && matching.isNotEmpty(), onExpandedChange = { if (!it) picking = false }) {
|
||||
OutlinedTextField(
|
||||
name,
|
||||
{
|
||||
name = it
|
||||
picking = it.isNotBlank()
|
||||
},
|
||||
Modifier.fillMaxWidth().menuAnchor(ExposedDropdownMenuAnchorType.PrimaryEditable),
|
||||
label = { Text(stringResource(R.string.play_your_name)) },
|
||||
supportingText = { Text(line) },
|
||||
trailingIcon = {
|
||||
if (matching.isNotEmpty()) {
|
||||
IconButton(onClick = { picking = !picking }) { ExposedDropdownMenuDefaults.TrailingIcon(expanded = picking) }
|
||||
}
|
||||
},
|
||||
singleLine = true,
|
||||
)
|
||||
ExposedDropdownMenu(expanded = picking && matching.isNotEmpty(), onDismissRequest = { picking = false }) {
|
||||
matching.forEach { p ->
|
||||
DropdownMenuItem(text = { Text(p) }, onClick = {
|
||||
name = p
|
||||
picking = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
Spacer(Modifier.height(12.dp))
|
||||
// The state of Maia's file: always one line, so that nothing jumps.
|
||||
Row(Modifier.fillMaxWidth().height(40.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ class GameEdit : ViewModel() {
|
|||
var notes: List<String> = emptyList()
|
||||
/// Where a new game or a copy was saved: saving again replaces it there.
|
||||
var savedTo: Pair<String, UInt>? = null
|
||||
/// Where the game against Maia went by itself (its player's database), if it did.
|
||||
val recorded = mutableStateOf<io.github.vrubelroman.chesspenguin.data.Written?>(null)
|
||||
/// Why it did not (the card says so; «Save…» stays).
|
||||
val recordError = mutableStateOf<String?>(null)
|
||||
/// An opening being learned over the game (android-play.md §32), how far, the board's side.
|
||||
val trainer = mutableStateOf<uniffi.mobile_api.Trainer?>(null)
|
||||
/// The game against Maia, when this screen plays one (§31).
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ fun SettingsScreen(onBack: () -> Unit, onAbout: () -> Unit, onBoardStyle: () ->
|
|||
Toggle(stringResource(R.string.best_arrow), prefs.bestArrow) { v -> set { it.copy(bestArrow = v) } }
|
||||
Toggle(stringResource(R.string.sound), prefs.sound) { v -> set { it.copy(sound = v) } }
|
||||
Toggle(stringResource(R.string.vibration), prefs.vibration) { v -> set { it.copy(vibration = v) } }
|
||||
Toggle(stringResource(R.string.record_games), prefs.recordGames) { v -> set { it.copy(recordGames = v) } }
|
||||
|
||||
Group(stringResource(R.string.group_look))
|
||||
Item(stringResource(R.string.board_and_pieces), boardLabel(prefs.board) + " · " + prefs.pieces.dir, onClick = onBoardStyle)
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@
|
|||
<string name="color_black">Schwarz</string>
|
||||
<string name="color_random">Zufällig</string>
|
||||
<string name="play_opponent">Gegner — Maia %1$s</string>
|
||||
<string name="play_measured">Ihre gemessene Spielstärke, auf der Lichess-Blitz-Skala.</string>
|
||||
<string name="play_measured">Die eigene Wertung von Maia: sie entspricht nicht der Elo eines Menschen.</string>
|
||||
<string name="play_download_note">Maia wird einmalig heruntergeladen (%1$s MB, von huggingface.co, die Datei der Autoren selbst).</string>
|
||||
<string name="play_download_and_play">Herunterladen und spielen</string>
|
||||
<string name="play_play">Spielen</string>
|
||||
|
|
@ -497,7 +497,7 @@
|
|||
<string name="play_note_from">Ab hier eine Partie gegen Maia %1$s.</string>
|
||||
<string name="play_abort">Abbrechen</string>
|
||||
<string name="play_with_maia">Gegen Maia spielen</string>
|
||||
<string name="play_your_name">Ihr Name (für die Partie)</string>
|
||||
<string name="play_your_name">Ihr Name</string>
|
||||
<string name="play_maia_ready">Maia ist heruntergeladen</string>
|
||||
<string name="play_retry">Erneut versuchen</string>
|
||||
<string name="play_her_position_lost">Ihre Stellung ist verloren. Sieg annehmen oder weiterspielen?</string>
|
||||
|
|
@ -526,10 +526,23 @@
|
|||
<string name="play_adjourned_q">Eine Partie gegen Maia %1$s ist zurückgestellt</string>
|
||||
<string name="play_continue_it">Fortsetzen</string>
|
||||
<string name="play_start_new">Neue beginnen</string>
|
||||
<string name="play_adjourned_new_text">Eine neue Partie ersetzt sie.</string>
|
||||
<string name="play_adjourned_new_text">Eine neue Partie ersetzt sie; das Gespielte kommt unvollendet in die Datenbank des Spielers.</string>
|
||||
<string name="play_offer_draw">Remis</string>
|
||||
<string name="end_agreement">durch Einigung</string>
|
||||
<string name="play_draw_declined">Maia lehnt das Remis ab</string>
|
||||
<string name="play_draw_later">Maia hat abgelehnt; nach zwei ihrer Züge wieder anbieten</string>
|
||||
<string name="play_draw_no_engine">Maia beantwortet Remis mit Stockfish: über „Engine“ herunterladen</string>
|
||||
<string name="player_db_name">%1$s — Partien gegen den Computer</string>
|
||||
<string name="player_db_shared">Partien gegen den Computer</string>
|
||||
<string name="player_written">✓ In „%1$s“, Nr. %2$s ›</string>
|
||||
<string name="player_kept_unfinished">Partie unvollendet in „%1$s“ gespeichert</string>
|
||||
<string name="player_db_row">werden selbst gespeichert</string>
|
||||
<string name="record_games">Partien gegen Maia in die Datenbank des Spielers schreiben</string>
|
||||
<string name="player_line_existing">Partien werden in „%1$s“ gespeichert</string>
|
||||
<string name="player_line_new">Die Partien werden in eine neue Datenbank „%1$s“ gespeichert.</string>
|
||||
<string name="player_line_noname">Ohne Namen gehen die Partien in „%1$s“. Geben Sie einen Namen ein, um eine eigene Datenbank zu bekommen.</string>
|
||||
<string name="player_line_off">Partien werden nicht von selbst gespeichert (Einstellungen).</string>
|
||||
<string name="player_written_new">✓ Neue Datenbank „%1$s“, Nr. %2$s ›</string>
|
||||
<string name="player_write_failed">Konnte nicht in „%1$s“ schreiben: %2$s</string>
|
||||
<string name="play_adjourned_replaced">Eine neue Partie ersetzt sie.</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@
|
|||
<string name="color_black">Negras</string>
|
||||
<string name="color_random">Al azar</string>
|
||||
<string name="play_opponent">Rival — Maia %1$s</string>
|
||||
<string name="play_measured">Su fuerza medida, en la escala de blitz de Lichess.</string>
|
||||
<string name="play_measured">El rating propio de Maia: no equivale al Elo de una persona.</string>
|
||||
<string name="play_download_note">Maia se descarga una sola vez (%1$s MB, desde huggingface.co, el archivo de los propios autores).</string>
|
||||
<string name="play_download_and_play">Descargar y jugar</string>
|
||||
<string name="play_play">Jugar</string>
|
||||
|
|
@ -505,7 +505,7 @@
|
|||
<string name="play_note_from">A partir de aquí, una partida contra Maia %1$s.</string>
|
||||
<string name="play_abort">Abortar</string>
|
||||
<string name="play_with_maia">Jugar con Maia</string>
|
||||
<string name="play_your_name">Tu nombre (para la partida)</string>
|
||||
<string name="play_your_name">Tu nombre</string>
|
||||
<string name="play_maia_ready">Maia está descargada</string>
|
||||
<string name="play_retry">Reintentar</string>
|
||||
<string name="play_her_position_lost">Su posición está perdida. ¿Aceptar la victoria o seguir?</string>
|
||||
|
|
@ -534,10 +534,23 @@
|
|||
<string name="play_adjourned_q">Hay una partida aplazada contra Maia %1$s</string>
|
||||
<string name="play_continue_it">Continuarla</string>
|
||||
<string name="play_start_new">Empezar una nueva</string>
|
||||
<string name="play_adjourned_new_text">Una partida nueva la sustituye.</string>
|
||||
<string name="play_adjourned_new_text">Una partida nueva la sustituye; lo jugado va sin terminar a la base del jugador.</string>
|
||||
<string name="play_offer_draw">Tablas</string>
|
||||
<string name="end_agreement">por acuerdo</string>
|
||||
<string name="play_draw_declined">Maia rechaza las tablas</string>
|
||||
<string name="play_draw_later">Maia lo rechazó; ofrece de nuevo tras dos de sus jugadas</string>
|
||||
<string name="play_draw_no_engine">Maia responde a las tablas con Stockfish: descárgalo con «Motor»</string>
|
||||
<string name="player_db_name">%1$s — partidas contra el ordenador</string>
|
||||
<string name="player_db_shared">Partidas contra el ordenador</string>
|
||||
<string name="player_written">✓ En «%1$s», n.º %2$s ›</string>
|
||||
<string name="player_kept_unfinished">Partida guardada sin terminar en «%1$s»</string>
|
||||
<string name="player_db_row">se guardan solas</string>
|
||||
<string name="record_games">Guardar las partidas contra Maia en la base del jugador</string>
|
||||
<string name="player_line_existing">Las partidas se guardan en «%1$s»</string>
|
||||
<string name="player_line_new">Las partidas se guardarán en una base nueva «%1$s».</string>
|
||||
<string name="player_line_noname">Sin nombre, las partidas van a «%1$s». Escribe un nombre para tener tu propia base.</string>
|
||||
<string name="player_line_off">Las partidas no se guardan solas (Ajustes).</string>
|
||||
<string name="player_written_new">✓ Base nueva «%1$s», n.º %2$s ›</string>
|
||||
<string name="player_write_failed">No se pudo escribir en «%1$s»: %2$s</string>
|
||||
<string name="play_adjourned_replaced">Una partida nueva la sustituye.</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@
|
|||
<string name="color_black">Noirs</string>
|
||||
<string name="color_random">Au hasard</string>
|
||||
<string name="play_opponent">Adversaire — Maia %1$s</string>
|
||||
<string name="play_measured">Sa force mesurée, sur l’échelle du blitz Lichess.</string>
|
||||
<string name="play_measured">Le classement propre de Maia : il ne correspond pas à l’Elo d’une personne.</string>
|
||||
<string name="play_download_note">Maia est téléchargée une seule fois (%1$s Mo, depuis huggingface.co, le fichier des auteurs eux-mêmes).</string>
|
||||
<string name="play_download_and_play">Télécharger et jouer</string>
|
||||
<string name="play_play">Jouer</string>
|
||||
|
|
@ -505,7 +505,7 @@
|
|||
<string name="play_note_from">À partir d’ici, une partie contre Maia %1$s.</string>
|
||||
<string name="play_abort">Abandonner</string>
|
||||
<string name="play_with_maia">Jouer contre Maia</string>
|
||||
<string name="play_your_name">Votre nom (pour la partie)</string>
|
||||
<string name="play_your_name">Votre nom</string>
|
||||
<string name="play_maia_ready">Maia est téléchargée</string>
|
||||
<string name="play_retry">Réessayer</string>
|
||||
<string name="play_her_position_lost">Sa position est perdue. Accepter la victoire ou continuer ?</string>
|
||||
|
|
@ -534,10 +534,23 @@
|
|||
<string name="play_adjourned_q">Une partie contre Maia %1$s est en attente</string>
|
||||
<string name="play_continue_it">La continuer</string>
|
||||
<string name="play_start_new">En commencer une nouvelle</string>
|
||||
<string name="play_adjourned_new_text">Une nouvelle partie la remplace.</string>
|
||||
<string name="play_adjourned_new_text">Une nouvelle partie la remplace ; ce qui a été joué va, inachevé, dans la base du joueur.</string>
|
||||
<string name="play_offer_draw">Nulle</string>
|
||||
<string name="end_agreement">par accord mutuel</string>
|
||||
<string name="play_draw_declined">Maia refuse la nulle</string>
|
||||
<string name="play_draw_later">Maia a refusé ; reproposez après deux de ses coups</string>
|
||||
<string name="play_draw_no_engine">Maia répond à la nulle avec Stockfish : téléchargez-le avec « Moteur »</string>
|
||||
<string name="player_db_name">%1$s — parties contre l’ordinateur</string>
|
||||
<string name="player_db_shared">Parties contre l’ordinateur</string>
|
||||
<string name="player_written">✓ Dans « %1$s », n° %2$s ›</string>
|
||||
<string name="player_kept_unfinished">Partie enregistrée inachevée dans « %1$s »</string>
|
||||
<string name="player_db_row">enregistrées d’elles-mêmes</string>
|
||||
<string name="record_games">Enregistrer les parties contre Maia dans la base du joueur</string>
|
||||
<string name="player_line_existing">Les parties sont enregistrées dans « %1$s »</string>
|
||||
<string name="player_line_new">Les parties seront enregistrées dans une nouvelle base « %1$s ».</string>
|
||||
<string name="player_line_noname">Sans nom, les parties vont dans « %1$s ». Saisissez un nom pour avoir votre propre base.</string>
|
||||
<string name="player_line_off">Les parties ne sont pas enregistrées d’elles-mêmes (Réglages).</string>
|
||||
<string name="player_written_new">✓ Nouvelle base « %1$s », n° %2$s ›</string>
|
||||
<string name="player_write_failed">Impossible d’écrire dans « %1$s » : %2$s</string>
|
||||
<string name="play_adjourned_replaced">Une nouvelle partie la remplace.</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@
|
|||
<string name="color_black">Nero</string>
|
||||
<string name="color_random">Casuale</string>
|
||||
<string name="play_opponent">Avversario — Maia %1$s</string>
|
||||
<string name="play_measured">La sua forza misurata, sulla scala del blitz di Lichess.</string>
|
||||
<string name="play_measured">Il rating proprio di Maia: non corrisponde all’Elo di una persona.</string>
|
||||
<string name="play_download_note">Maia si scarica una sola volta (%1$s MB, da huggingface.co, il file degli autori stessi).</string>
|
||||
<string name="play_download_and_play">Scarica e gioca</string>
|
||||
<string name="play_play">Gioca</string>
|
||||
|
|
@ -505,7 +505,7 @@
|
|||
<string name="play_note_from">Da qui, una partita contro Maia %1$s.</string>
|
||||
<string name="play_abort">Annulla</string>
|
||||
<string name="play_with_maia">Gioca con Maia</string>
|
||||
<string name="play_your_name">Il tuo nome (per la partita)</string>
|
||||
<string name="play_your_name">Il tuo nome</string>
|
||||
<string name="play_maia_ready">Maia è scaricata</string>
|
||||
<string name="play_retry">Riprova</string>
|
||||
<string name="play_her_position_lost">La sua posizione è persa. Accettare la vittoria o continuare?</string>
|
||||
|
|
@ -534,10 +534,23 @@
|
|||
<string name="play_adjourned_q">C’è una partita sospesa contro Maia %1$s</string>
|
||||
<string name="play_continue_it">Continuala</string>
|
||||
<string name="play_start_new">Iniziarne una nuova</string>
|
||||
<string name="play_adjourned_new_text">Una nuova partita la sostituisce.</string>
|
||||
<string name="play_adjourned_new_text">Una nuova partita la sostituisce; quanto giocato va, non finito, nel database del giocatore.</string>
|
||||
<string name="play_offer_draw">Patta</string>
|
||||
<string name="end_agreement">per accordo</string>
|
||||
<string name="play_draw_declined">Maia rifiuta la patta</string>
|
||||
<string name="play_draw_later">Maia ha rifiutato; riproponi dopo due sue mosse</string>
|
||||
<string name="play_draw_no_engine">Maia risponde alla patta con Stockfish: scaricalo con «Motore»</string>
|
||||
<string name="player_db_name">%1$s — partite contro il computer</string>
|
||||
<string name="player_db_shared">Partite contro il computer</string>
|
||||
<string name="player_written">✓ In «%1$s», n. %2$s ›</string>
|
||||
<string name="player_kept_unfinished">Partita salvata non finita in «%1$s»</string>
|
||||
<string name="player_db_row">salvate da sole</string>
|
||||
<string name="record_games">Salvare le partite contro Maia nel database del giocatore</string>
|
||||
<string name="player_line_existing">Le partite vengono salvate in «%1$s»</string>
|
||||
<string name="player_line_new">Le partite saranno salvate in un nuovo database «%1$s».</string>
|
||||
<string name="player_line_noname">Senza nome le partite vanno in «%1$s». Inserisci un nome per avere un database tuo.</string>
|
||||
<string name="player_line_off">Le partite non vengono salvate da sole (Impostazioni).</string>
|
||||
<string name="player_written_new">✓ Nuovo database «%1$s», n. %2$s ›</string>
|
||||
<string name="player_write_failed">Impossibile scrivere in «%1$s»: %2$s</string>
|
||||
<string name="play_adjourned_replaced">Una nuova partita la sostituisce.</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@
|
|||
<string name="color_black">Қаралар</string>
|
||||
<string name="color_random">Кездейсоқ</string>
|
||||
<string name="play_opponent">Қарсылас — Maia %1$s</string>
|
||||
<string name="play_measured">Оның өлшенген күші, Lichess блиц шкаласы бойынша.</string>
|
||||
<string name="play_measured">Maia-ның өз рейтингі: ол адамның Эло рейтингіне сәйкес келмейді.</string>
|
||||
<string name="play_download_note">Maia бір рет жүктеледі (%1$s МБ, huggingface.co сайтынан — авторлардың өз файлы).</string>
|
||||
<string name="play_download_and_play">Жүктеп алып ойнау</string>
|
||||
<string name="play_play">Ойнау</string>
|
||||
|
|
@ -498,7 +498,7 @@
|
|||
<string name="play_note_from">Бұдан әрі — Maia %1$s-мен ойын.</string>
|
||||
<string name="play_abort">Тоқтату</string>
|
||||
<string name="play_with_maia">Maia-мен ойнау</string>
|
||||
<string name="play_your_name">Атыңыз (ойын жазбасы үшін)</string>
|
||||
<string name="play_your_name">Атыңыз</string>
|
||||
<string name="play_maia_ready">Maia жүктелді</string>
|
||||
<string name="play_retry">Қайталау</string>
|
||||
<string name="play_her_position_lost">Оның позициясы ұтылды. Жеңісті қабылдайсыз ба, әлде жалғастырасыз ба?</string>
|
||||
|
|
@ -527,10 +527,23 @@
|
|||
<string name="play_adjourned_q">Maia %1$s-мен кейінге қалдырылған ойын бар</string>
|
||||
<string name="play_continue_it">Жалғастыру</string>
|
||||
<string name="play_start_new">Жаңасын бастау</string>
|
||||
<string name="play_adjourned_new_text">Жаңа ойын оның орнын басады.</string>
|
||||
<string name="play_adjourned_new_text">Жаңа ойын оның орнын басады; ойналғаны аяқталмаған күйде ойыншы базасына жазылады.</string>
|
||||
<string name="play_offer_draw">Тең</string>
|
||||
<string name="end_agreement">келісім бойынша</string>
|
||||
<string name="play_draw_declined">Maia тең ойыннан бас тартады</string>
|
||||
<string name="play_draw_later">Maia бас тартты; оның екі жүрісінен кейін қайта ұсыныңыз</string>
|
||||
<string name="play_draw_no_engine">Maia тең ойынға Stockfish арқылы жауап береді: оны «Қозғалтқыш» батырмасымен жүктеңіз</string>
|
||||
<string name="player_db_name">%1$s — компьютермен ойындар</string>
|
||||
<string name="player_db_shared">Компьютермен ойындар</string>
|
||||
<string name="player_written">✓ «%1$s» базасында, № %2$s ›</string>
|
||||
<string name="player_kept_unfinished">Ойын аяқталмаған күйде «%1$s» базасына жазылды</string>
|
||||
<string name="player_db_row">өзі жазылады</string>
|
||||
<string name="record_games">Maia-мен ойындарды ойыншы базасына жазу</string>
|
||||
<string name="player_line_existing">Ойындар «%1$s» базасына жазылады</string>
|
||||
<string name="player_line_new">Ойындар жаңа «%1$s» базасына жазылады.</string>
|
||||
<string name="player_line_noname">Атсыз ойындар «%1$s» базасына түседі. Өз базаңыз болуы үшін атыңызды жазыңыз.</string>
|
||||
<string name="player_line_off">Ойындар өзі жазылмайды (Баптаулар).</string>
|
||||
<string name="player_written_new">✓ Жаңа база «%1$s», № %2$s ›</string>
|
||||
<string name="player_write_failed">«%1$s» базасына жазу мүмкін болмады: %2$s</string>
|
||||
<string name="play_adjourned_replaced">Жаңа ойын оның орнын басады.</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@
|
|||
<string name="color_black">Pretas</string>
|
||||
<string name="color_random">Aleatório</string>
|
||||
<string name="play_opponent">Adversário — Maia %1$s</string>
|
||||
<string name="play_measured">A força medida dela, na escala de blitz do Lichess.</string>
|
||||
<string name="play_measured">O rating próprio da Maia: não corresponde ao Elo de uma pessoa.</string>
|
||||
<string name="play_download_note">A Maia é baixada uma única vez (%1$s MB, de huggingface.co, o arquivo dos próprios autores).</string>
|
||||
<string name="play_download_and_play">Baixar e jogar</string>
|
||||
<string name="play_play">Jogar</string>
|
||||
|
|
@ -506,7 +506,7 @@
|
|||
<string name="play_note_from">A partir daqui, uma partida contra Maia %1$s.</string>
|
||||
<string name="play_abort">Abortar</string>
|
||||
<string name="play_with_maia">Jogar com a Maia</string>
|
||||
<string name="play_your_name">Seu nome (para a partida)</string>
|
||||
<string name="play_your_name">O seu nome</string>
|
||||
<string name="play_maia_ready">A Maia foi baixada</string>
|
||||
<string name="play_retry">Tentar de novo</string>
|
||||
<string name="play_her_position_lost">A posição dela está perdida. Aceitar a vitória ou continuar?</string>
|
||||
|
|
@ -535,10 +535,23 @@
|
|||
<string name="play_adjourned_q">Há uma partida adiada contra a Maia %1$s</string>
|
||||
<string name="play_continue_it">Continuá-la</string>
|
||||
<string name="play_start_new">Começar uma nova</string>
|
||||
<string name="play_adjourned_new_text">Uma nova partida a substitui.</string>
|
||||
<string name="play_adjourned_new_text">Uma nova partida a substitui; o que foi jogado vai, inacabado, para a base do jogador.</string>
|
||||
<string name="play_offer_draw">Empate</string>
|
||||
<string name="end_agreement">por acordo</string>
|
||||
<string name="play_draw_declined">A Maia recusa o empate</string>
|
||||
<string name="play_draw_later">A Maia recusou; ofereça de novo após dois lances dela</string>
|
||||
<string name="play_draw_no_engine">A Maia responde ao empate com o Stockfish: baixe-o com «Motor»</string>
|
||||
<string name="player_db_name">%1$s — partidas contra o computador</string>
|
||||
<string name="player_db_shared">Partidas contra o computador</string>
|
||||
<string name="player_written">✓ Em «%1$s», n.º %2$s ›</string>
|
||||
<string name="player_kept_unfinished">Partida gravada inacabada em «%1$s»</string>
|
||||
<string name="player_db_row">gravadas sozinhas</string>
|
||||
<string name="record_games">Gravar as partidas contra a Maia na base do jogador</string>
|
||||
<string name="player_line_existing">As partidas são gravadas em «%1$s»</string>
|
||||
<string name="player_line_new">As partidas serão gravadas numa nova base «%1$s».</string>
|
||||
<string name="player_line_noname">Sem nome, as partidas vão para «%1$s». Escreva um nome para ter a sua própria base.</string>
|
||||
<string name="player_line_off">As partidas não são gravadas sozinhas (Definições).</string>
|
||||
<string name="player_written_new">✓ Nova base «%1$s», n.º %2$s ›</string>
|
||||
<string name="player_write_failed">Não foi possível gravar em «%1$s»: %2$s</string>
|
||||
<string name="play_adjourned_replaced">Uma nova partida a substitui.</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@
|
|||
<string name="color_black">Чёрные</string>
|
||||
<string name="color_random">Случайно</string>
|
||||
<string name="play_opponent">Соперник — Maia %1$s</string>
|
||||
<string name="play_measured">Её измеренная сила, по шкале блица Lichess.</string>
|
||||
<string name="play_measured">Собственный рейтинг Maia: он не равен Эло человека.</string>
|
||||
<string name="play_download_note">Maia скачивается один раз (%1$s МБ, с huggingface.co — файл самих авторов).</string>
|
||||
<string name="play_download_and_play">Скачать и играть</string>
|
||||
<string name="play_play">Играть</string>
|
||||
|
|
@ -513,7 +513,7 @@
|
|||
<string name="play_note_from">Дальше — игра с Maia %1$s.</string>
|
||||
<string name="play_abort">Прервать</string>
|
||||
<string name="play_with_maia">Играть с Maia</string>
|
||||
<string name="play_your_name">Ваше имя (для записи партии)</string>
|
||||
<string name="play_your_name">Ваше имя</string>
|
||||
<string name="play_maia_ready">Maia скачана</string>
|
||||
<string name="play_retry">Повторить</string>
|
||||
<string name="play_her_position_lost">Её позиция проиграна. Принять победу или доиграть?</string>
|
||||
|
|
@ -542,10 +542,23 @@
|
|||
<string name="play_adjourned_q">Есть отложенная партия с Maia %1$s</string>
|
||||
<string name="play_continue_it">Продолжить её</string>
|
||||
<string name="play_start_new">Начать новую</string>
|
||||
<string name="play_adjourned_new_text">Новая партия заменит её.</string>
|
||||
<string name="play_adjourned_new_text">Новая партия заменит её; сыгранное запишется в базу игрока неоконченным.</string>
|
||||
<string name="play_offer_draw">Ничья</string>
|
||||
<string name="end_agreement">по соглашению</string>
|
||||
<string name="play_draw_declined">Maia отказывается от ничьей</string>
|
||||
<string name="play_draw_later">Maia отказалась; снова можно предложить через два её хода</string>
|
||||
<string name="play_draw_no_engine">Maia отвечает на ничью с помощью Stockfish: скачайте его кнопкой «Движок»</string>
|
||||
<string name="player_db_name">%1$s — партии с компьютером</string>
|
||||
<string name="player_db_shared">Партии с компьютером</string>
|
||||
<string name="player_written">✓ В «%1$s», № %2$s ›</string>
|
||||
<string name="player_kept_unfinished">Партия записана в «%1$s» неоконченной</string>
|
||||
<string name="player_db_row">пишутся сами</string>
|
||||
<string name="record_games">Записывать партии с Maia в базу игрока</string>
|
||||
<string name="player_line_existing">Партии записываются в «%1$s»</string>
|
||||
<string name="player_line_new">Партии будут записываться в новую базу «%1$s».</string>
|
||||
<string name="player_line_noname">Без имени партии идут в «%1$s». Впишите имя — заведём вашу базу.</string>
|
||||
<string name="player_line_off">Партии сами не записываются (Настройки).</string>
|
||||
<string name="player_written_new">✓ Создана база «%1$s», № %2$s ›</string>
|
||||
<string name="player_write_failed">Не удалось записать в «%1$s»: %2$s</string>
|
||||
<string name="play_adjourned_replaced">Новая партия заменит её.</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@
|
|||
<string name="color_black">Qoralar</string>
|
||||
<string name="color_random">Tasodifiy</string>
|
||||
<string name="play_opponent">Raqib — Maia %1$s</string>
|
||||
<string name="play_measured">Uning o‘lchangan kuchi, Lichess blits shkalasi bo‘yicha.</string>
|
||||
<string name="play_measured">Maia ning o‘z reytingi: u odamning Elo reytingiga teng emas.</string>
|
||||
<string name="play_download_note">Maia bir marta yuklab olinadi (%1$s MB, huggingface.co dan — mualliflarning o‘z fayli).</string>
|
||||
<string name="play_download_and_play">Yuklab olish va o‘ynash</string>
|
||||
<string name="play_play">O‘ynash</string>
|
||||
|
|
@ -496,7 +496,7 @@
|
|||
<string name="play_note_from">Bundan keyin — Maia %1$s bilan o‘yin.</string>
|
||||
<string name="play_abort">To‘xtatish</string>
|
||||
<string name="play_with_maia">Maia bilan o‘ynash</string>
|
||||
<string name="play_your_name">Ismingiz (o‘yin yozuvi uchun)</string>
|
||||
<string name="play_your_name">Ismingiz</string>
|
||||
<string name="play_maia_ready">Maia yuklab olindi</string>
|
||||
<string name="play_retry">Qayta urinish</string>
|
||||
<string name="play_her_position_lost">Uning pozitsiyasi yutqazilgan. G‘alabani qabul qilasizmi yoki davom etasizmi?</string>
|
||||
|
|
@ -525,10 +525,23 @@
|
|||
<string name="play_adjourned_q">Maia %1$s bilan to‘xtatilgan o‘yin bor</string>
|
||||
<string name="play_continue_it">Davom ettirish</string>
|
||||
<string name="play_start_new">Yangisini boshlash</string>
|
||||
<string name="play_adjourned_new_text">Yangi o‘yin uning o‘rnini oladi.</string>
|
||||
<string name="play_adjourned_new_text">Yangi o‘yin uning o‘rnini oladi; o‘ynalgani tugallanmagan holda o‘yinchi bazasiga yoziladi.</string>
|
||||
<string name="play_offer_draw">Durang</string>
|
||||
<string name="end_agreement">kelishuv bo‘yicha</string>
|
||||
<string name="play_draw_declined">Maia durangdan bosh tortadi</string>
|
||||
<string name="play_draw_later">Maia rad etdi; uning ikki yurishidan keyin yana taklif qiling</string>
|
||||
<string name="play_draw_no_engine">Maia durangga Stockfish bilan javob beradi: uni «Dvigatel» tugmasi bilan yuklab oling</string>
|
||||
<string name="player_db_name">%1$s — kompyuter bilan o‘yinlar</string>
|
||||
<string name="player_db_shared">Kompyuter bilan o‘yinlar</string>
|
||||
<string name="player_written">✓ «%1$s» da, № %2$s ›</string>
|
||||
<string name="player_kept_unfinished">O‘yin tugallanmagan holda «%1$s» ga yozildi</string>
|
||||
<string name="player_db_row">o‘zi yoziladi</string>
|
||||
<string name="record_games">Maia bilan o‘yinlarni o‘yinchi bazasiga yozish</string>
|
||||
<string name="player_line_existing">O‘yinlar «%1$s» ga yoziladi</string>
|
||||
<string name="player_line_new">O‘yinlar yangi «%1$s» bazasiga yoziladi.</string>
|
||||
<string name="player_line_noname">Ismsiz o‘yinlar «%1$s» ga tushadi. O‘z bazangiz bo‘lishi uchun ismingizni yozing.</string>
|
||||
<string name="player_line_off">O‘yinlar o‘zi yozilmaydi (Sozlamalar).</string>
|
||||
<string name="player_written_new">✓ Yangi baza «%1$s», № %2$s ›</string>
|
||||
<string name="player_write_failed">«%1$s» ga yozib bo‘lmadi: %2$s</string>
|
||||
<string name="play_adjourned_replaced">Yangi o‘yin uning o‘rnini oladi.</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@
|
|||
<string name="color_black">Black</string>
|
||||
<string name="color_random">Random</string>
|
||||
<string name="play_opponent">Opponent — Maia %1$s</string>
|
||||
<string name="play_measured">Her measured strength, on the Lichess blitz scale.</string>
|
||||
<string name="play_measured">Maia’s own rating: it does not match a person’s Elo.</string>
|
||||
<string name="play_download_note">Maia is downloaded once (%1$s MB, from huggingface.co, the authors\' own file).</string>
|
||||
<string name="play_download_and_play">Download and play</string>
|
||||
<string name="play_play">Play</string>
|
||||
|
|
@ -501,7 +501,7 @@
|
|||
<string name="play_note_from">From here on, a game against Maia %1$s.</string>
|
||||
<string name="play_abort">Abort</string>
|
||||
<string name="play_with_maia">Play with Maia</string>
|
||||
<string name="play_your_name">Your name (for the game’s record)</string>
|
||||
<string name="play_your_name">Your name</string>
|
||||
<string name="play_maia_ready">Maia is downloaded</string>
|
||||
<string name="play_retry">Try again</string>
|
||||
<string name="play_her_position_lost">Her position is lost. Accept the win or play on?</string>
|
||||
|
|
@ -530,10 +530,23 @@
|
|||
<string name="play_adjourned_q">There is a game put aside against Maia %1$s</string>
|
||||
<string name="play_continue_it">Continue it</string>
|
||||
<string name="play_start_new">Start a new one</string>
|
||||
<string name="play_adjourned_new_text">A new game replaces it.</string>
|
||||
<string name="play_adjourned_new_text">A new game replaces it; what was played goes into the player’s database, unfinished.</string>
|
||||
<string name="play_offer_draw">Draw</string>
|
||||
<string name="end_agreement">by agreement</string>
|
||||
<string name="play_draw_declined">Maia declines the draw</string>
|
||||
<string name="play_draw_later">Maia declined; offer again after two of her moves</string>
|
||||
<string name="play_draw_no_engine">Maia answers a draw offer with Stockfish: download it in the game screen («Engine»)</string>
|
||||
<string name="player_db_name">%1$s — games against the computer</string>
|
||||
<string name="player_db_shared">Games against the computer</string>
|
||||
<string name="player_written">✓ In “%1$s”, No. %2$s ›</string>
|
||||
<string name="player_kept_unfinished">Game written to “%1$s” unfinished</string>
|
||||
<string name="player_db_row">recorded automatically</string>
|
||||
<string name="record_games">Write games against Maia to the player’s database</string>
|
||||
<string name="player_line_existing">Games are written to “%1$s”</string>
|
||||
<string name="player_line_new">Games will be written to a new database “%1$s”.</string>
|
||||
<string name="player_line_noname">Without a name games go to “%1$s”. Enter a name to have a database of your own.</string>
|
||||
<string name="player_line_off">Games are not written by themselves (Settings).</string>
|
||||
<string name="player_written_new">✓ New database “%1$s”, No. %2$s ›</string>
|
||||
<string name="player_write_failed">Could not write to “%1$s”: %2$s</string>
|
||||
<string name="play_adjourned_replaced">A new game replaces it.</string>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue