Fix issue where solution is in perfect order
This commit is contained in:
74
.run/Android.run.xml
Normal file
74
.run/Android.run.xml
Normal file
@@ -0,0 +1,74 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Android" type="AndroidRunConfigurationType" factoryName="Android App">
|
||||
<module name="YAEP.android" />
|
||||
<option name="ANDROID_RUN_CONFIGURATION_SCHEMA_VERSION" value="1" />
|
||||
<option name="DEPLOY" value="true" />
|
||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
<option name="ARTIFACT_NAME" value="" />
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="ALL_USERS" value="false" />
|
||||
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
||||
<option name="ALLOW_ASSUME_VERIFIED" value="false" />
|
||||
<option name="CLEAR_APP_STORAGE" value="false" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<option name="MODE" value="default_activity" />
|
||||
<option name="RESTORE_ENABLED" value="false" />
|
||||
<option name="RESTORE_FILE" value="" />
|
||||
<option name="RESTORE_FRESH_INSTALL_ONLY" value="false" />
|
||||
<option name="CLEAR_LOGCAT" value="false" />
|
||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
|
||||
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
<option name="DEBUGGER_TYPE" value="Java" />
|
||||
<Auto>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
|
||||
<option name="DEBUG_SANDBOX_SDK" value="false" />
|
||||
</Auto>
|
||||
<Hybrid>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
|
||||
<option name="DEBUG_SANDBOX_SDK" value="false" />
|
||||
</Hybrid>
|
||||
<Java>
|
||||
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
|
||||
<option name="DEBUG_SANDBOX_SDK" value="false" />
|
||||
</Java>
|
||||
<Native>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
|
||||
<option name="DEBUG_SANDBOX_SDK" value="false" />
|
||||
</Native>
|
||||
<Profilers>
|
||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Java/Kotlin Method Sample (legacy)" />
|
||||
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
|
||||
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||
</Profilers>
|
||||
<option name="DEEP_LINK" value="" />
|
||||
<option name="ACTIVITY" value="" />
|
||||
<option name="ACTIVITY_CLASS" value="" />
|
||||
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
|
||||
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
||||
<method v="2">
|
||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
24
.run/Desktop.run.xml
Normal file
24
.run/Desktop.run.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Desktop" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/desktop" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="run" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>false</RunAsTest>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -26,10 +26,10 @@ kotlin {
|
||||
implementation(compose.components.resources)
|
||||
implementation(compose.runtime)
|
||||
implementation(compose.foundation)
|
||||
implementation(compose.material3)
|
||||
implementation(compose.ui)
|
||||
implementation(compose.components.uiToolingPreview)
|
||||
// implementation(libs.compose.ui.text.googlefonts)
|
||||
|
||||
implementation(compose.material3)
|
||||
|
||||
implementation(libs.bundles.logging)
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class Game(
|
||||
return Game(
|
||||
grid = Grid(
|
||||
rows = options.values
|
||||
.map { createRow<ItemClass<*>>(it) }
|
||||
.map { createRow<ItemClass<*>>(it.sorted()) }
|
||||
.toList()
|
||||
),
|
||||
clues = clues
|
||||
|
||||
@@ -19,7 +19,7 @@ class GameCell<C : ItemClass<C>>(
|
||||
selectionChangedListeners.forEach { listener -> listener(value) }
|
||||
}
|
||||
}
|
||||
val options: ObservableSet<Item<C>> = ObservableSet(options.toMutableSet()) { before, after ->
|
||||
val options: ObservableSet<Item<C>> = ObservableSet(options) { before, after ->
|
||||
optionsChangedListeners.forEach { listener ->
|
||||
listener(after)
|
||||
}
|
||||
@@ -40,12 +40,13 @@ class GameCell<C : ItemClass<C>>(
|
||||
}
|
||||
}
|
||||
|
||||
fun <C : ItemClass<C>> GameCell<C>?.mayBe(item: Item<C>, mayHaveSelection: Boolean = true) =
|
||||
fun <C : ItemClass<C>> GameCell<C>?.mayBe(item: Item<C>, mayHaveSelection: Boolean = true): Boolean =
|
||||
this != null &&
|
||||
((mayHaveSelection && selection == item) || (selection == null && options.contains(item)))
|
||||
|
||||
fun <C : ItemClass<C>> GameCell<C>?.isA(item: Item<C>) =
|
||||
fun <C : ItemClass<C>> GameCell<C>?.isA(item: Item<C>): Boolean =
|
||||
this != null && selection == item
|
||||
|
||||
fun <C : ItemClass<C>> GameCell<C>?.hasNoSelection(): Boolean = this != null && this.selection == null
|
||||
fun <C : ItemClass<C>> GameCell<C>?.hasNoSelection(): Boolean =
|
||||
this != null && this.selection == null
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ fun List<List<Item<ItemClass<*>>>>.toGrid() = Grid(
|
||||
map { row ->
|
||||
GameRow(
|
||||
category = row.first().itemType.companion,
|
||||
options = row,
|
||||
options = row.sorted(),
|
||||
cells = row.map {
|
||||
GameCell(
|
||||
selection = null,
|
||||
|
||||
@@ -4,7 +4,7 @@ package ch.dissem.yaep.domain
|
||||
class Item<C : ItemClass<C>>(
|
||||
val itemType: C,
|
||||
val symbol: String = itemType.symbols.random()
|
||||
) {
|
||||
) : Comparable<Item<C>> {
|
||||
constructor(itemType: C) : this(itemType, itemType.symbols.random())
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
@@ -20,4 +20,6 @@ class Item<C : ItemClass<C>>(
|
||||
override fun toString(): String {
|
||||
return itemType.toString() + symbol
|
||||
}
|
||||
|
||||
override fun compareTo(other: Item<C>): Int = itemType.compareTo(other.itemType)
|
||||
}
|
||||
|
||||
@@ -138,6 +138,7 @@ enum class Transportation(symbol: String) : ItemClass<Transportation> {
|
||||
companion object : ItemClassCompanion<Transportation> {
|
||||
override val items: List<Transportation> = entries
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private val GENDERS = arrayOf("\uD83E\uDDD1", "\uD83D\uDC68", "\uD83D\uDC69")
|
||||
@@ -150,13 +151,17 @@ private fun idic(symbol: String): Array<String> = Array(GENDERS.size * SKIN_TONE
|
||||
g + t + symbol
|
||||
}
|
||||
|
||||
sealed interface ItemClass<out SELF : ItemClass<SELF>> {
|
||||
sealed interface ItemClass<out SELF : ItemClass<SELF>>: Comparable<ItemClass<*>> {
|
||||
val symbols: Array<String>
|
||||
|
||||
val name: String
|
||||
|
||||
val companion: ItemClassCompanion<SELF>
|
||||
|
||||
val ordinal: Int
|
||||
|
||||
override fun compareTo(other: ItemClass<*>): Int = ordinal.compareTo(other.ordinal)
|
||||
|
||||
companion object {
|
||||
val classes: List<ItemClassCompanion<*>> = listOf(
|
||||
Nationality,
|
||||
|
||||
@@ -5,7 +5,7 @@ agp = "8.10.1"
|
||||
jdk = "21"
|
||||
android-compileSdk = "35"
|
||||
android-minSdk = "24"
|
||||
android-targetSdk = "35"
|
||||
android-targetSdk = "36"
|
||||
androidx-activityCompose = "1.10.1"
|
||||
androidx-compose = "1.8.2"
|
||||
compose-plugin = "1.7.0"
|
||||
|
||||
Reference in New Issue
Block a user