mirror of
https://github.com/appinfosapienza/so-un-bot.git
synced 2025-05-06 04:12:34 +02:00
Downloaded 0721 questions
This commit is contained in:
parent
eb8ea2909c
commit
935d4532aa
162 changed files with 1435 additions and 2 deletions
4
0721_4/quest.txt
Normal file
4
0721_4/quest.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
L'input ad un sistema è costituito da un utente (umano) che preme due pulsanti etichettati, rispettivamente, con 1 ed 2.
|
||||
L'utente può anche decidere di non premere alcun pulsante.
|
||||
Con probabilità 0.2 l'utente preme il pulsante 1, con probabilità 0.3 l'utente preme il pulsante 2, con probabilità 0.5 non fa nulla (pulsante 0 per convenzione).
|
||||
Quale dei seguenti modelli Modelica fornisce un modello ragionevole per l'utente di cui sopra?
|
19
0721_4/wrong1.txt
Normal file
19
0721_4/wrong1.txt
Normal file
|
@ -0,0 +1,19 @@
|
|||
model Env
|
||||
Integer x; // Pulsante premuto dall'utente (0 nessun pulsante)
|
||||
Real r1024;
|
||||
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
|
||||
algorithm
|
||||
when initial() then
|
||||
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
|
||||
x := 0;
|
||||
r1024 := 0;
|
||||
elsewhen sample(0,1) then
|
||||
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
|
||||
if (r1024 <= 0.5)
|
||||
then x := 0;
|
||||
else
|
||||
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
|
||||
if (r1024 <= 0.3) then x := 0; else x:= 1; end if;
|
||||
end if;
|
||||
end when;
|
||||
end Env;
|
19
0721_4/wrong2.txt
Normal file
19
0721_4/wrong2.txt
Normal file
|
@ -0,0 +1,19 @@
|
|||
model Env
|
||||
Integer x; // Pulsante premuto dall'utente (0 nessun pulsante)
|
||||
Real r1024;
|
||||
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
|
||||
algorithm
|
||||
when initial() then
|
||||
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
|
||||
x := 0;
|
||||
r1024 := 0;
|
||||
elsewhen sample(0,1) then
|
||||
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
|
||||
if (r1024 <= 0.5)
|
||||
then x := 0;
|
||||
else
|
||||
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
|
||||
if (r1024 <= 0.4) then x := 1; else x:= 0; end if;
|
||||
end if;
|
||||
end when;
|
||||
end Env;
|
19
0721_4/wrong3.txt
Normal file
19
0721_4/wrong3.txt
Normal file
|
@ -0,0 +1,19 @@
|
|||
model Env
|
||||
Integer x; // Pulsante premuto dall'utente (0 nessun pulsante)
|
||||
Real r1024;
|
||||
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
|
||||
algorithm
|
||||
when initial() then
|
||||
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
|
||||
x := 0;
|
||||
r1024 := 0;
|
||||
elsewhen sample(0,1) then
|
||||
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
|
||||
if (r1024 <= 0.5)
|
||||
then x := 0;
|
||||
else
|
||||
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
|
||||
if (r1024 <= 0.2) then x := 1; else x:= 0; end if;
|
||||
end if;
|
||||
end when;
|
||||
end Env;
|
Loading…
Add table
Add a link
Reference in a new issue