Py.Cafe

malavika.a2022/

malus-quiz-adventure

Malus Quiz Adventure

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
import streamlit as st
import time

# Page configuration
st.set_page_config(page_title="Malus Quiz πŸ’•", page_icon="πŸ˜€", layout="centered")

# Initialize session state
if 'page' not in st.session_state:
    st.session_state.page = 1
if 'score' not in st.session_state:
    st.session_state.score = 0
if 'answers' not in st.session_state:
    st.session_state.answers = {}
if 'slider_value' not in st.session_state:
    st.session_state.slider_value = 50

# Correct answers
correct_answers = {
    'q1': 'a',
    'q2': 'c', 
    'q3': 'a',
    'q4': 'c'
}

# Custom CSS for animations and styling
st.markdown("""
<style>
    .big-font {
        font-size: 30px !important;
        font-weight: bold;
        text-align: center;
    }
    .emoji-rain {
        font-size: 50px;
        animation: fall 3s linear infinite;
    }
    @keyframes fall {
        0% { transform: translateY(-100px); opacity: 1; }
        100% { transform: translateY(600px); opacity: 0; }
    }
    .stButton>button {
        width: 100%;
        height: 60px;
        font-size: 20px;
    }
</style>
""", unsafe_allow_html=True)

# Page 1: Welcome
if st.session_state.page == 1:
    st.markdown("<h1 style='text-align: center;'>Hello Good Mornaftvening πŸ˜€πŸ˜€</h1>", unsafe_allow_html=True)
    st.markdown("<h2 style='text-align: center;'>WELCOME TO MALUS QUIZ πŸ˜€πŸ₯°</h2>", unsafe_allow_html=True)
    st.markdown("<br><br>", unsafe_allow_html=True)

    col1, col2, col3 = st.columns([1, 2, 1])
    with col2:
        if st.button("NEXT ➑️", key="page1_next"):
            st.session_state.page = 2
            st.rerun()

# Page 2: Duvilme slider
elif st.session_state.page == 2:
    st.markdown("<h1 style='text-align: center;'>Hooooooow much duvilme?πŸ‘€πŸ‘€</h1>", unsafe_allow_html=True)
    st.markdown("<br>", unsafe_allow_html=True)

    slider_value = st.slider("", 1, 100, st.session_state.slider_value, key="duvilme_slider")
    st.session_state.slider_value = slider_value

    st.markdown(f"<h2 style='text-align: center;'>{slider_value}</h2>", unsafe_allow_html=True)
    st.markdown("<br>", unsafe_allow_html=True)

    col1, col2, col3 = st.columns([1, 2, 1])
    with col2:
        if st.button("SUBMIT πŸ’•", key="page2_submit"):
            if slider_value != 100:
                st.error("error 404 not found☠️☠️ πŸ¦₯")
                time.sleep(1)
            else:
                st.session_state.page = 3
                st.rerun()

# Page 3: Celebration
elif st.session_state.page == 3:
    st.balloons()
    st.markdown("<h1 style='text-align: center;'>yay kissie bullets upcoming πŸ˜ƒπŸ˜ƒπŸ˜ƒ</h1>", unsafe_allow_html=True)

    # Display 100 kiss emojis
    emoji_grid = "😘 " * 50
    st.markdown(f"<div style='text-align: center; font-size: 20px; line-height: 1.5;'>{emoji_grid}</div>", unsafe_allow_html=True)

    st.markdown("<br><br>", unsafe_allow_html=True)
    col1, col2, col3 = st.columns([1, 2, 1])
    with col2:
        if st.button("CONTINUE ➑️", key="page3_next"):
            st.session_state.page = 4
            st.rerun()

# Page 4: Qualification
elif st.session_state.page == 4:
    st.markdown("<h1 style='text-align: center;'>Hmm good boy pat patπŸ₯°πŸ₯°</h1>", unsafe_allow_html=True)
    st.markdown("<h2 style='text-align: center;'>You're qualified to play the quizπŸ€“</h2>", unsafe_allow_html=True)
    st.markdown("<br><br>", unsafe_allow_html=True)

    col1, col2, col3 = st.columns([1, 2, 1])
    with col2:
        if st.button("START QUIZ 🎯", key="page4_next"):
            st.session_state.page = 5
            st.rerun()

# Page 5: Question 1
elif st.session_state.page == 5:
    st.markdown("<h2 style='text-align: center;'>What is malus favourite snacks πŸ₯πŸž?</h2>", unsafe_allow_html=True)
    st.markdown("<br>", unsafe_allow_html=True)

    answer = st.radio("Choose one:", 
                     ["a. Dubu lips fry", "b. Dubi face omlette", "c. Dubdu cheek pastry"],
                     key="q1_radio")

    st.markdown("<br>", unsafe_allow_html=True)
    col1, col2, col3 = st.columns([1, 2, 1])
    with col2:
        if st.button("NEXT ➑️", key="page5_next"):
            st.session_state.answers['q1'] = answer[0]
            st.session_state.page = 6
            st.rerun()

# Page 6: Question 2
elif st.session_state.page == 6:
    st.markdown("<h2 style='text-align: center;'>What is malus fav thing to do?πŸ‘€πŸ‘€</h2>", unsafe_allow_html=True)
    st.markdown("<br>", unsafe_allow_html=True)

    answer = st.radio("Choose one:", 
                     ["a. Irritate dudu", "b. Irritaaaaaaaaate dudu", "c. Irritateeeeeeeeee dudu"],
                     key="q2_radio")

    st.markdown("<br>", unsafe_allow_html=True)
    col1, col2, col3 = st.columns([1, 2, 1])
    with col2:
        if st.button("NEXT ➑️", key="page6_next"):
            st.session_state.answers['q2'] = answer[0]
            st.session_state.page = 7
            st.rerun()

# Page 7: Question 3
elif st.session_state.page == 7:
    st.markdown("<h2 style='text-align: center;'>Why do u always think about me?🌝🌝</h2>", unsafe_allow_html=True)
    st.markdown("<br>", unsafe_allow_html=True)

    answer = st.radio("Choose one:", 
                     ["a. Cus duvilme", "b. Cus ivillums", "c. Cus ily", "d. Cus ylm"],
                     key="q3_radio")

    st.markdown("<br>", unsafe_allow_html=True)
    col1, col2, col3 = st.columns([1, 2, 1])
    with col2:
        if st.button("NEXT ➑️", key="page7_next"):
            st.session_state.answers['q3'] = answer[0]
            st.session_state.page = 8
            st.rerun()

# Page 8: Question 4
elif st.session_state.page == 8:
    st.markdown("<h2 style='text-align: center;'>Choose the best optionπŸ„πŸ„</h2>", unsafe_allow_html=True)
    st.markdown("<br>", unsafe_allow_html=True)

    answer = st.radio("Choose one:", 
                     ["a. Dubis is cuteπŸ˜—", "b. Dubis is cuterπŸ˜™", "c. Dubis is cuttest😚"],
                     key="q4_radio")

    st.markdown("<br>", unsafe_allow_html=True)
    col1, col2, col3 = st.columns([1, 2, 1])
    with col2:
        if st.button("SEE RESULTS 🎊", key="page8_next"):
            st.session_state.answers['q4'] = answer[0]

            # Calculate score
            score = 0
            for q, ans in st.session_state.answers.items():
                if ans == correct_answers[q]:
                    score += 1
            st.session_state.score = score

            st.session_state.page = 9
            st.rerun()

# Page 9: Score Display
elif st.session_state.page == 9:
    st.markdown("<h2 style='text-align: center;'>Your score isπŸ™€πŸ™€</h2>", unsafe_allow_html=True)
    st.markdown(f"<h1 style='text-align: center; font-size: 60px;'>{st.session_state.score}/4</h1>", unsafe_allow_html=True)
    st.markdown("<br>", unsafe_allow_html=True)

    score = st.session_state.score

    if score == 1:
        st.markdown("<h2 style='text-align: center;'>I hate you *1πŸ˜’</h2>", unsafe_allow_html=True)
    elif score == 2:
        st.markdown("<h2 style='text-align: center;'>I hate you * 2πŸ˜’πŸ˜’</h2>", unsafe_allow_html=True)
    elif score == 3:
        st.markdown("<h2 style='text-align: center;'>woww πŸ™‚</h2>", unsafe_allow_html=True)
    elif score == 4:
        st.markdown("<h2 style='text-align: center;'>SuperrrrrπŸ˜„πŸ˜„πŸ˜„πŸ˜„πŸ˜˜πŸ˜˜</h2>", unsafe_allow_html=True)

    st.markdown("<br><br>", unsafe_allow_html=True)
    col1, col2, col3 = st.columns([1, 2, 1])
    with col2:
        if st.button("CONTINUE ➑️", key="page9_next"):
            st.session_state.page = 10
            st.rerun()

# Page 10: Valentine Proposal
elif st.session_state.page == 10:
    st.markdown("<h1 style='text-align: center;'>Will u be my valentine πŸ’?πŸ‘€πŸ‘€</h1>", unsafe_allow_html=True)
    st.markdown("<h2 style='text-align: center;'>Ik you will -😁😁</h2>", unsafe_allow_html=True)
    st.markdown("<br><br>", unsafe_allow_html=True)
    
    # Show error message if they clicked NO before
    if st.session_state.get('no_clicked', False):
        st.markdown("<h2 style='text-align: center; color: #FF4444;'>Ivanethaaa πŸ˜’πŸ˜’</h2>", unsafe_allow_html=True)
        st.markdown("<br>", unsafe_allow_html=True)
    
    # Two buttons side by side
    col1, col2 = st.columns(2)
    
    with col1:
        if st.button("❌ NO", key="page10_no"):
            st.session_state.no_clicked = True
            st.rerun()
    
    with col2:
        if st.button("πŸ’• YES!", key="page10_yes"):
            st.session_state.page = 11
            st.session_state.no_clicked = False  # Reset the flag
            st.rerun()


# Page 11: Final Message
elif st.session_state.page == 11:
    st.balloons()
    st.markdown("<h1 style='text-align: center; color: #FF1493;'>πŸŽ‰ Advanced Happy Birthday πŸŽ‰</h1>", unsafe_allow_html=True)
    st.markdown("<h2 style='text-align: center;'>πŸŽŠπŸŽˆπŸŽ‚β€οΈ I LOVE YOU ❀️🎁πŸ₯³</h2>", unsafe_allow_html=True)

    # Display party emojis
    party_emojis = "πŸŽ‰πŸŽŠπŸŽˆπŸŽπŸ₯³" * 10
    st.markdown(f"<div style='text-align: center; font-size: 30px; line-height: 1.5;'>{party_emojis}</div>", unsafe_allow_html=True)

    st.markdown("<br><br>", unsafe_allow_html=True)
    col1, col2, col3 = st.columns([1, 2, 1])
    with col2:
        if st.button("RESTART πŸ”„", key="restart"):
            st.session_state.page = 1
            st.session_state.score = 0
            st.session_state.answers = {}
            st.session_state.slider_value = 50
            st.rerun()