Skip to content

Commit

Permalink
feat: Killer Sudoku
Browse files Browse the repository at this point in the history
  • Loading branch information
kaajjo committed Jul 14, 2024
1 parent 982d0c5 commit ca49250
Show file tree
Hide file tree
Showing 24 changed files with 909 additions and 103 deletions.
267 changes: 267 additions & 0 deletions app/schemas/com.kaajjo.libresudoku.data.database.AppDatabase/6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
{
"formatVersion": 1,
"database": {
"version": 6,
"identityHash": "f0a74afcb17b9a4b4078f0765a30360d",
"entities": [
{
"tableName": "record",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`board_uid` INTEGER NOT NULL, `type` INTEGER NOT NULL, `difficulty` INTEGER NOT NULL, `date` INTEGER NOT NULL, `time` INTEGER NOT NULL, PRIMARY KEY(`board_uid`), FOREIGN KEY(`board_uid`) REFERENCES `board`(`uid`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "board_uid",
"columnName": "board_uid",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "difficulty",
"columnName": "difficulty",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "time",
"columnName": "time",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"board_uid"
]
},
"indices": [],
"foreignKeys": [
{
"table": "board",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"board_uid"
],
"referencedColumns": [
"uid"
]
}
]
},
{
"tableName": "board",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uid` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `initial_board` TEXT NOT NULL, `solved_board` TEXT NOT NULL, `difficulty` INTEGER NOT NULL, `type` INTEGER NOT NULL, `folder_id` INTEGER DEFAULT null, `killer_cages` TEXT DEFAULT null, FOREIGN KEY(`folder_id`) REFERENCES `Folder`(`uid`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "uid",
"columnName": "uid",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "initialBoard",
"columnName": "initial_board",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "solvedBoard",
"columnName": "solved_board",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "difficulty",
"columnName": "difficulty",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "folderId",
"columnName": "folder_id",
"affinity": "INTEGER",
"notNull": false,
"defaultValue": "null"
},
{
"fieldPath": "killerCages",
"columnName": "killer_cages",
"affinity": "TEXT",
"notNull": false,
"defaultValue": "null"
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"uid"
]
},
"indices": [],
"foreignKeys": [
{
"table": "Folder",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"folder_id"
],
"referencedColumns": [
"uid"
]
}
]
},
{
"tableName": "saved_game",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`board_uid` INTEGER NOT NULL, `current_board` TEXT NOT NULL, `notes` TEXT NOT NULL, `timer` INTEGER NOT NULL, `completed` INTEGER NOT NULL DEFAULT false, `give_up` INTEGER NOT NULL DEFAULT false, `mistakes` INTEGER NOT NULL DEFAULT 0, `can_continue` INTEGER NOT NULL, `last_played` INTEGER, `started_at` INTEGER, `finished_at` INTEGER, PRIMARY KEY(`board_uid`), FOREIGN KEY(`board_uid`) REFERENCES `board`(`uid`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "uid",
"columnName": "board_uid",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "currentBoard",
"columnName": "current_board",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "timer",
"columnName": "timer",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "completed",
"columnName": "completed",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "false"
},
{
"fieldPath": "giveUp",
"columnName": "give_up",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "false"
},
{
"fieldPath": "mistakes",
"columnName": "mistakes",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "canContinue",
"columnName": "can_continue",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastPlayed",
"columnName": "last_played",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "startedAt",
"columnName": "started_at",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "finishedAt",
"columnName": "finished_at",
"affinity": "INTEGER",
"notNull": false
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"board_uid"
]
},
"indices": [],
"foreignKeys": [
{
"table": "board",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"board_uid"
],
"referencedColumns": [
"uid"
]
}
]
},
{
"tableName": "Folder",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uid` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `date_created` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "uid",
"columnName": "uid",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "createdAt",
"columnName": "date_created",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"uid"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'f0a74afcb17b9a4b4078f0765a30360d')"
]
}
}
3 changes: 3 additions & 0 deletions app/src/main/java/com/kaajjo/libresudoku/core/Cell.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.kaajjo.libresudoku.core

import kotlinx.serialization.Serializable

@Serializable
data class Cell(
val row: Int,
val col: Int,
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/com/kaajjo/libresudoku/core/qqwing/Cage.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.kaajjo.libresudoku.core.qqwing

import com.kaajjo.libresudoku.core.Cell
import kotlinx.serialization.Serializable

@Serializable
data class Cage(
val id: Int = 0,
val sum: Int = 0,
val cells: List<Cell> = emptyList()
) {
fun size() = cells.size
}
Loading

0 comments on commit ca49250

Please sign in to comment.