-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b8853e
commit e3004a6
Showing
7 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<script lang="ts"> | ||
import type { Space, Property, Trait } from '@/types' | ||
import { Dice } from '../Shared/Icons' | ||
import Typeset from '../Shared/Typeset.svelte' | ||
import context from '@/context' | ||
const { spaces, traits } = context() | ||
let openQuestion: | ||
| { space: Space; property: Property; trait: Trait | undefined } | ||
| undefined = undefined | ||
const rollOpenQuestion = () => { | ||
openQuestion = undefined | ||
const ss = $spaces.all | ||
while (openQuestion == undefined) { | ||
const randomSpace = ss[Math.floor(Math.random() * ss.length)] | ||
const openQuestions = $traits | ||
.forSpaceAll(randomSpace) | ||
.map(([p, t]) => { | ||
return { | ||
space: randomSpace, | ||
property: p, | ||
trait: t, | ||
} | ||
}) | ||
.filter(question => question.trait === undefined) | ||
if (openQuestions.length === 0) { | ||
openQuestion = undefined | ||
} else { | ||
openQuestion = | ||
openQuestions[Math.floor(Math.random() * openQuestions.length)] | ||
} | ||
} | ||
} | ||
rollOpenQuestion() | ||
$: bodyMain = `Does {S${openQuestion?.space.id}} satisfy {P${openQuestion?.property.id}}?` | ||
$: bodySecondary = `Trait link: {S${openQuestion?.space.id}|P${openQuestion?.property.id}}` | ||
</script> | ||
|
||
<div class="text-center my-3"> | ||
<div class="mb-3"> | ||
<button | ||
type="button" | ||
class="btn btn-outline-secondary" | ||
on:click={() => rollOpenQuestion()} | ||
> | ||
<Dice /> Reroll question | ||
</button> | ||
</div> | ||
<div class="lead mb-3" style="font-size:2em"> | ||
<Typeset body={bodyMain} /> | ||
</div> | ||
<div class="mb-3"> | ||
<Typeset body={bodySecondary} /> | ||
</div> | ||
<p> | ||
<small> Disclaimer: some questions cannot be answered in ZFC! </small> | ||
</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as Questions } from './Questions.svelte' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<svg | ||
fill="currentColor" | ||
viewBox="0 0 640 512" | ||
height="1.5em" | ||
width="1.5em" | ||
xmlns="http://www.w3.org/2000/svg" | ||
><!--!Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path | ||
d="M592 192H473.3c12.7 29.6 7.1 65.2-17 89.3L320 417.6V464c0 26.5 21.5 48 48 48h224c26.5 0 48-21.5 48-48V240c0-26.5-21.5-48-48-48zM480 376c-13.3 0-24-10.8-24-24 0-13.3 10.8-24 24-24s24 10.7 24 24c0 13.3-10.8 24-24 24zm-46.4-186.7L258.7 14.4c-19.2-19.2-50.2-19.2-69.4 0L14.4 189.3c-19.2 19.2-19.2 50.2 0 69.4L189.3 433.6c19.2 19.2 50.2 19.2 69.4 0L433.6 258.7c19.2-19.2 19.2-50.2 0-69.4zM96 248c-13.3 0-24-10.8-24-24 0-13.3 10.8-24 24-24s24 10.7 24 24c0 13.3-10.8 24-24 24zm128 128c-13.3 0-24-10.8-24-24 0-13.3 10.8-24 24-24s24 10.7 24 24c0 13.3-10.8 24-24 24zm0-128c-13.3 0-24-10.8-24-24 0-13.3 10.8-24 24-24s24 10.7 24 24c0 13.3-10.8 24-24 24zm0-128c-13.3 0-24-10.8-24-24 0-13.3 10.8-24 24-24s24 10.7 24 24c0 13.3-10.8 24-24 24zm128 128c-13.3 0-24-10.8-24-24 0-13.3 10.8-24 24-24s24 10.7 24 24c0 13.3-10.8 24-24 24z" | ||
/></svg | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script> | ||
import Title from '@/components/Shared/Title.svelte' | ||
import Questions from '@/components/Questions/Questions.svelte' | ||
</script> | ||
|
||
<Title title="Questions" /> | ||
|
||
<Questions /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const prerender = true |