|
|
|
@ -3,7 +3,7 @@
|
|
|
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
|
|
|
<head>
|
|
|
|
|
<!-- 2024-12-12 čet 21:14 -->
|
|
|
|
|
<!-- 2024-12-14 sob 06:33 -->
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
|
<title>‎</title>
|
|
|
|
@ -200,31 +200,39 @@
|
|
|
|
|
<h2>Table of Contents</h2>
|
|
|
|
|
<div id="text-table-of-contents" role="doc-toc">
|
|
|
|
|
<ul>
|
|
|
|
|
<li><a href="#orgea1bc79">1. Plan za vajo</a></li>
|
|
|
|
|
<li><a href="#orgf3f8684">2. predlogi</a></li>
|
|
|
|
|
<li><a href="#org1415cea">3. tekstualna igra stavkov p</a>
|
|
|
|
|
<li><a href="#org3047d1b">1. Plan za vajo</a></li>
|
|
|
|
|
<li><a href="#orgc256234">2. predlogi</a></li>
|
|
|
|
|
<li><a href="#org8f4e818">3. tekstualna igra stavkov p</a>
|
|
|
|
|
<ul>
|
|
|
|
|
<li><a href="#org9ef178b">3.1. meta</a></li>
|
|
|
|
|
<li><a href="#org8b67be4">3.2. homepage</a></li>
|
|
|
|
|
<li><a href="#org75d0d17">3.3. seja igre</a></li>
|
|
|
|
|
<li><a href="#org260847d">3.4. program</a>
|
|
|
|
|
<li><a href="#orgf2e3d1f">3.1. meta</a></li>
|
|
|
|
|
<li><a href="#org9a5fa8f">3.2. homepage</a></li>
|
|
|
|
|
<li><a href="#org8e4a823">3.3. seja igre</a></li>
|
|
|
|
|
<li><a href="#org090645a">3.4. program</a>
|
|
|
|
|
<ul>
|
|
|
|
|
<li><a href="#orga36bb03">3.4.1. boilerplate</a></li>
|
|
|
|
|
<li><a href="#orga5cbc1c">3.4.2. navodila za igro</a></li>
|
|
|
|
|
<li><a href="#orgf180008">3.4.1. boilerplate</a></li>
|
|
|
|
|
<li><a href="#org91c5b7e">3.4.2. navodila za igro</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li><a href="#orgd29ba3f">3.5. Nova soba</a>
|
|
|
|
|
<ul>
|
|
|
|
|
<li><a href="#org5a1319f">3.5.1. (podatkovni) model sobe</a></li>
|
|
|
|
|
<li><a href="#orgc249def">3.5.2. krmilnik (controller) sobe</a></li>
|
|
|
|
|
<li><a href="#org39fdd0b">3.5.3. Forma za vprasanje</a></li>
|
|
|
|
|
<li><a href="#org610c156">3.5.4. Podatkovni model</a></li>
|
|
|
|
|
<li><a href="#org94b4a79">3.5.5. sablona za listek</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li><a href="#org57c0424">3.5. Nova soba</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-orgea1bc79" class="outline-2">
|
|
|
|
|
<h2 id="orgea1bc79"><span class="section-number-2">1.</span> Plan za vajo</h2>
|
|
|
|
|
<div id="outline-container-org3047d1b" class="outline-2">
|
|
|
|
|
<h2 id="org3047d1b"><span class="section-number-2">1.</span> Plan za vajo</h2>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="outline-container-orgf3f8684" class="outline-2">
|
|
|
|
|
<h2 id="orgf3f8684"><span class="section-number-2">2.</span> predlogi</h2>
|
|
|
|
|
<div id="outline-container-orgc256234" class="outline-2">
|
|
|
|
|
<h2 id="orgc256234"><span class="section-number-2">2.</span> predlogi</h2>
|
|
|
|
|
<div class="outline-text-2" id="text-2">
|
|
|
|
|
<ul class="org-ul">
|
|
|
|
|
<li>tekstualna igra stavkov
|
|
|
|
@ -251,20 +259,20 @@
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-org1415cea" class="outline-2">
|
|
|
|
|
<h2 id="org1415cea"><span class="section-number-2">3.</span> tekstualna igra stavkov p</h2>
|
|
|
|
|
<div id="outline-container-org8f4e818" class="outline-2">
|
|
|
|
|
<h2 id="org8f4e818"><span class="section-number-2">3.</span> tekstualna igra stavkov p</h2>
|
|
|
|
|
<div class="outline-text-2" id="text-3">
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-org9ef178b" class="outline-3">
|
|
|
|
|
<h3 id="org9ef178b"><span class="section-number-3">3.1.</span> meta</h3>
|
|
|
|
|
<div id="outline-container-orgf2e3d1f" class="outline-3">
|
|
|
|
|
<h3 id="orgf2e3d1f"><span class="section-number-3">3.1.</span> meta</h3>
|
|
|
|
|
<div class="outline-text-3" id="text-3-1">
|
|
|
|
|
<p>
|
|
|
|
|
Sem pišemo plan za program igranja igre. Poskušamo kratko in jedrnato opisati prvi prototip, ki naj čimprej deluje in je zavoljo enostavnosti karseda podoben igranju v živo. Ob pisanju se poraja veliko idej, za katere je bolje, da se potencialno uvedejo kasneje, sicer se cilj delujočega prototipa sproti prehitro oddaljuje.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-org8b67be4" class="outline-3">
|
|
|
|
|
<h3 id="org8b67be4"><span class="section-number-3">3.2.</span> homepage</h3>
|
|
|
|
|
<div id="outline-container-org9a5fa8f" class="outline-3">
|
|
|
|
|
<h3 id="org9a5fa8f"><span class="section-number-3">3.2.</span> homepage</h3>
|
|
|
|
|
<div class="outline-text-3" id="text-3-2">
|
|
|
|
|
<p>
|
|
|
|
|
Na home page imamo kratka navodila in formo nova igra s poljem stevilo igralcev.
|
|
|
|
@ -276,8 +284,8 @@ Na tem koraku se generira seja glede na število igralcev.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-org75d0d17" class="outline-3">
|
|
|
|
|
<h3 id="org75d0d17"><span class="section-number-3">3.3.</span> seja igre</h3>
|
|
|
|
|
<div id="outline-container-org8e4a823" class="outline-3">
|
|
|
|
|
<h3 id="org8e4a823"><span class="section-number-3">3.3.</span> seja igre</h3>
|
|
|
|
|
<div class="outline-text-3" id="text-3-3">
|
|
|
|
|
<p>
|
|
|
|
|
Meta Podatki
|
|
|
|
@ -301,8 +309,8 @@ Ko so vsi oddali odgovore, se ti izpiše stavek, ki ga lahko prebereš ostalim i
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-org260847d" class="outline-3">
|
|
|
|
|
<h3 id="org260847d"><span class="section-number-3">3.4.</span> program</h3>
|
|
|
|
|
<div id="outline-container-org090645a" class="outline-3">
|
|
|
|
|
<h3 id="org090645a"><span class="section-number-3">3.4.</span> program</h3>
|
|
|
|
|
<div class="outline-text-3" id="text-3-4">
|
|
|
|
|
<p>
|
|
|
|
|
Izbrali smo artanis web framework: <a href="https://artanis.dev/">https://artanis.dev/</a>
|
|
|
|
@ -313,8 +321,8 @@ Namestitev:
|
|
|
|
|
<li>Debian: <code>apt install guix; guix install artanis</code></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-orga36bb03" class="outline-4">
|
|
|
|
|
<h4 id="orga36bb03"><span class="section-number-4">3.4.1.</span> boilerplate</h4>
|
|
|
|
|
<div id="outline-container-orgf180008" class="outline-4">
|
|
|
|
|
<h4 id="orgf180008"><span class="section-number-4">3.4.1.</span> boilerplate</h4>
|
|
|
|
|
<div class="outline-text-4" id="text-3-4-1">
|
|
|
|
|
<p>
|
|
|
|
|
Artanis ima orodje za terminal, imenovano <code>art</code>. Z orodje mdr. pripravimo skelet novega projekta: <code>art create igra-stavkov</code>.
|
|
|
|
@ -333,7 +341,7 @@ Strežnik se nam odpre na naslovu <a href="http://127.0.0.1:3000">http://127.0.0
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div id="orgd80eba0" class="figure">
|
|
|
|
|
<div id="org78f09e6" class="figure">
|
|
|
|
|
<p><img src="./igra-stavkov-1.png" alt="igra-stavkov-1.png" />
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
@ -344,8 +352,8 @@ Drugi potem stran vidijo na naslovu <code>http://<ip_naslov>:3000</code>,
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-orga5cbc1c" class="outline-4">
|
|
|
|
|
<h4 id="orga5cbc1c"><span class="section-number-4">3.4.2.</span> navodila za igro</h4>
|
|
|
|
|
<div id="outline-container-org91c5b7e" class="outline-4">
|
|
|
|
|
<h4 id="org91c5b7e"><span class="section-number-4">3.4.2.</span> navodila za igro</h4>
|
|
|
|
|
<div class="outline-text-4" id="text-3-4-2">
|
|
|
|
|
<p>
|
|
|
|
|
Igro lahko igrata dva ali več igralcev. Igralci skupaj sestavljajo stavke, tako da vnaprej odgovarjajo na vprašanja:
|
|
|
|
@ -360,7 +368,7 @@ Igro lahko igrata dva ali več igralcev. Igralci skupaj sestavljajo stavke, tako
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<ol class="org-ol">
|
|
|
|
|
<li><a id="org2d9239a"></a>v živo<br />
|
|
|
|
|
<li><a id="org1c8bee7"></a>v živo<br />
|
|
|
|
|
<div class="outline-text-5" id="text-3-4-2-1">
|
|
|
|
|
<p>
|
|
|
|
|
Vsak igralec potrebuje listek in pisalo. Igralci skupaj odgovarjajo na
|
|
|
|
@ -371,7 +379,7 @@ igralcu in preberejo cel stavek.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
<li><a id="org4867869"></a>na naši aplikaciji<br />
|
|
|
|
|
<li><a id="org6f8954c"></a>na naši aplikaciji<br />
|
|
|
|
|
<div class="outline-text-5" id="text-3-4-2-2">
|
|
|
|
|
<p>
|
|
|
|
|
Na naši aplikaciji je igra zelo podobna. Izberete število igralcev in ustvarite
|
|
|
|
@ -385,42 +393,36 @@ Ustvarimo nov fajl na lokaciji <code>pub/index.html</code>:
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
|
<pre class="src src-html"> <<span style="color: #fabd2f;">html</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">head</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">meta</span> <span style="color: #83a598;">charset</span>=<span style="color: #b8bb26;">"UTF-8"</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">meta</span> <span style="color: #83a598;">name</span>=<span style="color: #b8bb26;">"viewport"</span> <span style="color: #83a598;">content</span>=<span style="color: #b8bb26;">"width=device-width, initial-scale=1.0"</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">title</span>><span style="font-weight: bold; text-decoration: underline;">igra stavkov</span></<span style="color: #fabd2f;">title</span>>
|
|
|
|
|
</<span style="color: #fabd2f;">head</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">body</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">h1</span>><span style="font-weight: bold; text-decoration: underline;">igra stavkov</span></<span style="color: #fabd2f;">h1</span>>
|
|
|
|
|
<pre class="src src-html"> <<span style="color: #fabd2f;">html</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">head</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">meta</span> <span style="color: #83a598;">charset</span>=<span style="color: #b8bb26;">"UTF-8"</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">meta</span> <span style="color: #83a598;">name</span>=<span style="color: #b8bb26;">"viewport"</span> <span style="color: #83a598;">content</span>=<span style="color: #b8bb26;">"width=device-width, initial-scale=1.0"</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">title</span>><span style="font-weight: bold; text-decoration: underline;">igra stavkov</span></<span style="color: #fabd2f;">title</span>>
|
|
|
|
|
</<span style="color: #fabd2f;">head</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">body</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">h1</span>><span style="font-weight: bold; text-decoration: underline;">igra stavkov</span></<span style="color: #fabd2f;">h1</span>>
|
|
|
|
|
|
|
|
|
|
<<span style="color: #fabd2f;">h2</span>><span style="font-weight: bold; font-style: italic; text-decoration: underline;">v živo</span></<span style="color: #fabd2f;">h2</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">p</span>>
|
|
|
|
|
Vsak igralec potrebuje listek in pisalo. Igralci skupaj odgovarjajo na
|
|
|
|
|
vprašanja, po vsakem odgovoru pa listek prepognejo in podajo naprej. Svoj
|
|
|
|
|
naslednji odgovor nato napišejo pod prepognjen del in spet podajo listek naprej.
|
|
|
|
|
Ko odogovorijo na vsa vprašanja, še enkrat podajo listek naprej naslednjemu
|
|
|
|
|
igralcu in preberejo cel stavek.
|
|
|
|
|
</<span style="color: #fabd2f;">p</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">h2</span>><span style="font-weight: bold; font-style: italic; text-decoration: underline;">v živo</span></<span style="color: #fabd2f;">h2</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">p</span>>
|
|
|
|
|
Vsak igralec potrebuje listek in pisalo. Igralci skupaj odgovarjajo na vprašanja, po vsakem odgovoru pa listek prepognejo in podajo naprej. Svoj naslednji odgovor nato napišejo pod prepognjen del in spet podajo listek naprej. Ko odogovorijo na vsa vprašanja, še enkrat podajo listek naprej naslednjemu igralcu in preberejo cel stavek.
|
|
|
|
|
</<span style="color: #fabd2f;">p</span>>
|
|
|
|
|
|
|
|
|
|
<<span style="color: #fabd2f;">h2</span>><span style="font-weight: bold; font-style: italic; text-decoration: underline;">prek spleta (naša varianta)</span></<span style="color: #fabd2f;">h2</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">p</span>>
|
|
|
|
|
Vsak igralec potrebuje računalnik z brskalnikom in internetno povezavo. Dobavna veriga obsega rudnike redkih kovin, silicij, proizvodnjo čipov, komunikacijsko mrežo, etcetera.
|
|
|
|
|
</<span style="color: #fabd2f;">p</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">h2</span>><span style="font-weight: bold; font-style: italic; text-decoration: underline;">prek spleta (naša varianta)</span></<span style="color: #fabd2f;">h2</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">p</span>>
|
|
|
|
|
Vsak igralec potrebuje računalnik z brskalnikom in internetno povezavo. Dobavna veriga obsega rudnike redkih kovin, silicij, proizvodnjo čipov, komunikacijsko mrežo, etcetera.
|
|
|
|
|
</<span style="color: #fabd2f;">p</span>>
|
|
|
|
|
|
|
|
|
|
<<span style="color: #fabd2f;">p</span>>
|
|
|
|
|
Na naši aplikaciji je igra zelo podobna. Izberete število igralcev in ustvarite
|
|
|
|
|
novo sobo za igranje. Povezavo do sobo pošljete soigralcem in po vrsti
|
|
|
|
|
odgovarjate na vprašanja, dokler ne izpolnite vseh. Vsakemu igralcu se na koncu
|
|
|
|
|
izpiše en sestavljen stavek.
|
|
|
|
|
<<span style="color: #fabd2f;">p</span>>
|
|
|
|
|
Na naši aplikaciji je igra zelo podobna. Izberete število igralcev in ustvarite novo sobo za igranje. Povezavo do sobo pošljete soigralcem in po vrsti odgovarjate na vprašanja, dokler ne izpolnite vseh. Vsakemu igralcu se na koncu izpiše en sestavljen stavek.
|
|
|
|
|
</<span style="color: #fabd2f;">p</span>>
|
|
|
|
|
|
|
|
|
|
<<span style="color: #fabd2f;">form</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">label</span> <span style="color: #83a598;">for</span>=<span style="color: #b8bb26;">"num-of-players"</span>>Izberi število igralcev</<span style="color: #fabd2f;">label</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">input</span> <span style="color: #83a598;">type</span>=<span style="color: #b8bb26;">"number"</span> <span style="color: #83a598;">min</span>=<span style="color: #b8bb26;">"1"</span> <span style="color: #83a598;">name</span>=<span style="color: #b8bb26;">"num-of-players"</span> <span style="color: #83a598;">id</span>=<span style="color: #b8bb26;">"num-of-players"</span>></<span style="color: #fabd2f;">input</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">input</span> <span style="color: #83a598;">type</span>=<span style="color: #b8bb26;">"submit"</span> <span style="color: #83a598;">value</span>=<span style="color: #b8bb26;">"igraj"</span>>
|
|
|
|
|
</<span style="color: #fabd2f;">form</span>>
|
|
|
|
|
</<span style="color: #fabd2f;">body</span>>
|
|
|
|
|
</<span style="color: #fabd2f;">html</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">form</span> <span style="color: #83a598;">method</span>=<span style="color: #b8bb26;">"POST"</span> <span style="color: #83a598;">action</span>=<span style="color: #b8bb26;">"/soba/ustvari"</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">label</span> <span style="color: #83a598;">for</span>=<span style="color: #b8bb26;">"num-of-players"</span>>Izberi število igralcev</<span style="color: #fabd2f;">label</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">input</span> <span style="color: #83a598;">type</span>=<span style="color: #b8bb26;">"number"</span> <span style="color: #83a598;">min</span>=<span style="color: #b8bb26;">"1"</span> <span style="color: #83a598;">name</span>=<span style="color: #b8bb26;">"num-of-players"</span> <span style="color: #83a598;">id</span>=<span style="color: #b8bb26;">"num-of-players"</span>></<span style="color: #fabd2f;">input</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">input</span> <span style="color: #83a598;">type</span>=<span style="color: #b8bb26;">"submit"</span> <span style="color: #83a598;">value</span>=<span style="color: #b8bb26;">"igraj"</span>>
|
|
|
|
|
</<span style="color: #fabd2f;">form</span>>
|
|
|
|
|
</<span style="color: #fabd2f;">body</span>>
|
|
|
|
|
</<span style="color: #fabd2f;">html</span>>
|
|
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
@ -441,7 +443,7 @@ Domača stran se nam zdaj naloži!
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div id="org99d57f7" class="figure">
|
|
|
|
|
<div id="orga999122" class="figure">
|
|
|
|
|
<p><img src="igra-stavkov-2.png" alt="igra-stavkov-2.png" />
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
@ -450,9 +452,13 @@ Domača stran se nam zdaj naloži!
|
|
|
|
|
</ol>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-org57c0424" class="outline-3">
|
|
|
|
|
<h3 id="org57c0424"><span class="section-number-3">3.5.</span> Nova soba</h3>
|
|
|
|
|
<div id="outline-container-orgd29ba3f" class="outline-3">
|
|
|
|
|
<h3 id="orgd29ba3f"><span class="section-number-3">3.5.</span> Nova soba</h3>
|
|
|
|
|
<div class="outline-text-3" id="text-3-5">
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-org5a1319f" class="outline-4">
|
|
|
|
|
<h4 id="org5a1319f"><span class="section-number-4">3.5.1.</span> (podatkovni) model sobe</h4>
|
|
|
|
|
<div class="outline-text-4" id="text-3-5-1">
|
|
|
|
|
<p>
|
|
|
|
|
Zavoljo enostavnosti v <code>conf/artanis.conf</code> omogočimo podporo za sqlite3 bazo (ki je v fajlu in tako nismo odvisno od dodatne programske opreme za shranjevanje stanja):
|
|
|
|
|
</p>
|
|
|
|
@ -472,8 +478,109 @@ Soba ima dve lastnosti; unikaten ID in število igralcev.
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
Ustvarimo model zanjo;
|
|
|
|
|
Ustvarimo model zanjo: <code>art draw model soba</code>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
Tako se generira skelet podatkovnega modela za sobo v <code>app/models/soba.scm</code>, ki ga dopolnimo s potrebnimi podatki:
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
|
<pre class="src src-scheme"><span style="color: #458588;">(</span><span style="color: #fb4933;">import</span> <span style="color: #b16286;">(</span>artanis mvc model<span style="color: #b16286;">)</span><span style="color: #458588;">)</span>
|
|
|
|
|
<span style="color: #458588;">(</span>create-artanis-model
|
|
|
|
|
soba <span style="color: #7c6f64;">;</span><span style="color: #7c6f64;">ime modela</span>
|
|
|
|
|
<span style="color: #b16286;">(</span>id auto <span style="color: #8ec07c;">(</span><span style="color: #fe8019;">#:primary-key</span><span style="color: #8ec07c;">)</span><span style="color: #b16286;">)</span>
|
|
|
|
|
<span style="color: #b16286;">(</span>stevilo_igralcev tinyint <span style="color: #8ec07c;">(</span><span style="color: #fe8019;">#:not-null</span><span style="color: #8ec07c;">)</span><span style="color: #b16286;">)</span><span style="color: #458588;">)</span>
|
|
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-orgc249def" class="outline-4">
|
|
|
|
|
<h4 id="orgc249def"><span class="section-number-4">3.5.2.</span> krmilnik (controller) sobe</h4>
|
|
|
|
|
<div class="outline-text-4" id="text-3-5-2">
|
|
|
|
|
<p>
|
|
|
|
|
Naloga krmilnika je, da ustvari novo sobo in igralko pelje na pravilni link za igranje, shranjuje odgovore in na koncu prikaže stavek.
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
Ustvarimo ga z ukazom: <code>art draw controller soba listek</code>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
To nam ustvari dva nova fajla, <code>app/controllers/soba.scm</code>, s katerim bomo omogočili obisk ustvarjene sobe ter <code>app/view/soba/listek.html.tpl</code>, šablono za formular vnosa odgovorov (listek).
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
Najprej pa moramo sobo narediti. V <code>ENTRY</code> dodamo pod prej ustvarjeno preusmeritev na index.html POST handler:
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-org39fdd0b" class="outline-4">
|
|
|
|
|
<h4 id="org39fdd0b"><span class="section-number-4">3.5.3.</span> Forma za vprasanje</h4>
|
|
|
|
|
<div class="outline-text-4" id="text-3-5-3">
|
|
|
|
|
<p>
|
|
|
|
|
Forma za posamezno vprasanje
|
|
|
|
|
</p>
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
|
<pre class="src src-html"><<span style="color: #fabd2f;">form</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">label</span> <span style="color: #83a598;">for</span>=<span style="color: #b8bb26;">"vprasanje"</span>>{vprasanje}</<span style="color: #fabd2f;">label</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">input</span> <span style="color: #83a598;">id</span>=<span style="color: #b8bb26;">"vprasanje"</span> <span style="color: #83a598;">name</span>=<span style="color: #b8bb26;">"vprasanje"</span> <span style="color: #83a598;">type</span>=<span style="color: #b8bb26;">"textarea"</span>></<span style="color: #fabd2f;">input</span>>
|
|
|
|
|
<<span style="color: #fabd2f;">input</span> <span style="color: #83a598;">type</span>=<span style="color: #b8bb26;">"submit"</span> <span style="color: #83a598;">value</span>=<span style="color: #b8bb26;">"odgovori"</span>>
|
|
|
|
|
</<span style="color: #fabd2f;">form</span>>
|
|
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
Forma se submita glede na session cookie, ki ga ima igralec, k dolocenemu igralcu.
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
Submitanje vrne tip podatka listek. Ce listek nima vseh odgovorov, vrnemo formo
|
|
|
|
|
z vprasanjem. Ce ima vse odgovore, prikazemo stavek.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-org610c156" class="outline-4">
|
|
|
|
|
<h4 id="org610c156"><span class="section-number-4">3.5.4.</span> Podatkovni model</h4>
|
|
|
|
|
<div class="outline-text-4" id="text-3-5-4">
|
|
|
|
|
<p>
|
|
|
|
|
listek:
|
|
|
|
|
</p>
|
|
|
|
|
<ul class="org-ul">
|
|
|
|
|
<li>id od sobe (tip: string)</li>
|
|
|
|
|
<li>kaj (tip odogovor - uuid)</li>
|
|
|
|
|
<li>kdaj (tip odogovor)</li>
|
|
|
|
|
<li>kje</li>
|
|
|
|
|
<li>zakaj</li>
|
|
|
|
|
<li>kako</li>
|
|
|
|
|
<li>kaj</li>
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
odgovor:
|
|
|
|
|
</p>
|
|
|
|
|
<ul class="org-ul">
|
|
|
|
|
<li>vrednost (text)</li>
|
|
|
|
|
<li>session igralca</li>
|
|
|
|
|
<li>uuid</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="outline-container-org94b4a79" class="outline-4">
|
|
|
|
|
<h4 id="org94b4a79"><span class="section-number-4">3.5.5.</span> sablona za listek</h4>
|
|
|
|
|
<div class="outline-text-4" id="text-3-5-5">
|
|
|
|
|
<p>
|
|
|
|
|
Ce je listek ze izpolnjen - prikazi cel listek, to je sestavljen stavek.
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
Ce listek ni izponjen, prikazi samo zadnje neizpoljneno vprasanje.
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
Submitanje forme ti vrne naslednji listek (ce ga je igralec pred tabo izpolnil).
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|