opatry / wordle-kt Goto Github PK
View Code? Open in Web Editor NEWWordle game clone made with Kotlin & Compose
License: MIT License
Wordle game clone made with Kotlin & Compose
License: MIT License
Maybe then we should add Enter & Backspace buttons.
Wordle 212 X/6
π¨ π¨ β¬ β¬ β¬
π¨ π¨ β¬ β¬ β¬
π¨ π¨ β¬ β¬ β¬
π¨ π¨ β¬ β¬ β¬
π¨ π¨ β¬ β¬ β¬
π¨ π¨ β¬ β¬ β¬
Instead of having as many booleans as dialogs types, given that only one of them can be displayed at once, define a (nullable or having a none
case) visible dialog state.
This would reduce the boilerplate and enforce sharing transition behavior.
Given https://github.com/hannahcode/wordle#wordle-clone it appears words list is available in front end in official game and that the today's word could be inferred with something like
WORDS[Math.floor((NOW_IN_MS - GAME_EPOCH_IN_MS) / ONE_DAY_IN_MS)]
The stats dialog should be the same for end of game or toolbar menu.
The criteria to display graph is only to determine if the last played game was a victory or not.
Maybe using JakeWharton/flip-tables.
In WordleViewModel
, when (re)starting a new game, chosen word should be compared to stored ones in WordleRepository
.
Will also fix
WordleRules
Currently, there is too much logic achieved at UI layer level.
Clipboard works around of the box thanks to #17 and LocalClipboardManager
, but having a real share intent on Android would be even better.
Either find a way to make the active row a full text field properly displaying characters or define it as focusable/focused but invisible /hidden.
At each input pushing word to view model would automatically update grid.
This would allow writing accented characters (out any diacritic) for french, Spanish, ...
See https://ftp.gnu.org/gnu/aspell/dict/0index.html
Ideally sharing as much code as possible.
Keeping strings hardcoded inline the code should help but not sure about image assets.
println
game instructions with Text()
ComposableEditText()
to replace readLine()
At least with azul JDK 11.
Alphabet
& WordleGrid
)Currently the how to play is displayed at each launch.
When transitioning from dictionary picker to loading to game to "how to play", there are several freezes.
Currently, the transition from dictionary picker to loading to game screen is a bit ad hoc and might be improved thanks to a screen abstraction.
Here is what was done for another POC game.
sealed class Screen {
object Home : Screen()
data class Progress(val maxRank: Int) : Screen()
data class Settings(val player: PlayerInfo) : Screen()
data class Scores(val player: PlayerInfo) : Screen()
object Inventory : Screen()
data class InGame(val mode: GameRules.Mode) : Screen() {
val rules = GameRules(mode)
}
data class Statistics(val player: PlayerInfo, val viewModel: GameRulesViewModel) : Screen()
}
@Composable
fun HuesApp() {
CheapHuesComposeTheme {
var screenState by remember { mutableStateOf<Screen>(Screen.Home) }
val player by remember { mutableStateOf(PlayerInfo.DEFAULT_PLAYER) }
val backToHome = { screenState = Screen.Home }
screenState.let { screen ->
when (screen) {
Screen.Home -> HomeScreen(player) { screenState = it }
is Screen.Inventory -> InventoryScreen(player, backToHome)
is Screen.Settings -> SettingsScreen(player, backToHome)
is Screen.Scores -> ScoresScreen(player, backToHome)
is Screen.Progress -> ProgressionScreen(3, backToHome)
is Screen.InGame -> {
val viewModel = GameRulesViewModel(player, screen.rules)
val status = rememberUpdatedState(viewModel.status)
when (status.value) {
GameRules.GameStatus.PLAYING -> GameScreen(viewModel, backToHome)
else -> EndOfGameScreen(viewModel) {
screenState = Screen.Statistics(player, viewModel)
}
}
}
is Screen.Statistics -> StatisticsScreen(
screen.player,
screen.viewModel,
onRestart = {
screen.viewModel.restart()
screenState = Screen.InGame(screen.viewModel.mode)
},
onQuit = backToHome
)
}
}
}
}
This is a bit tedious to achieve given that it's dependent on underlying platform internals.
"Copied results to clipboard"
pbcopy
call system?In this SO answer, it is suggested to use a CompositionLocalProvider
to delegate the impl: https://stackoverflow.com/a/68389985/2551689
We could either display it on left of the grid or below.
Check dlew/wordle-solver for details.
In official game, at the left of the Share button, there is a counter for the next word, we could use this place holder for our restart button and stay closed to original game design.
words_[a-z]{2}_[\d]+.txt
in app's data dir (esp. for Desktop)DictionaryPicker
(would need CompositionLocalProvider
for Desktop & Android)builtIn
attribute in Dictionary
Black vs white square is expected.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.