Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 18
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 18
22_23-J 18
Commits
9d6e4630
Commit
9d6e4630
authored
Apr 18, 2023
by
Lelkada L L P S M
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backend file for card flip game
parent
6eefc77c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
App/Backend/server.py
App/Backend/server.py
+2
-1
App/Backend/word_card_game.py
App/Backend/word_card_game.py
+20
-0
No files found.
App/Backend/server.py
View file @
9d6e4630
import
numpy
as
np
from
flask
import
Flask
,
request
,
jsonify
from
flask
import
Flask
,
request
,
jsonify
,
request
import
pickle
from
word_card_game
import
wordGameData
app
=
Flask
(
__name__
)
...
...
App/Backend/word_card_game.py
0 → 100644
View file @
9d6e4630
import
random
def
wordGameData
(
w1
,
w2
,
w3
):
words
=
[
w1
,
w2
,
w3
]
main_word
=
random
.
choice
(
words
)
card_words
=
random
.
sample
(
words
,
len
(
words
))
card_word1
,
card_word2
,
card_word3
=
card_words
def
create_links
(
word
):
image_link
=
f
'https://fyp-word-images.s3.us-east-2.amazonaws.com/{word}.png'
audio_link
=
f
'https://fyp-word-audio.s3.us-east-2.amazonaws.com/{word}.m4a'
return
{
'word'
:
word
,
'image_link'
:
image_link
,
'audio_link'
:
audio_link
}
return
{
'main_word'
:
create_links
(
main_word
),
'card_word1'
:
create_links
(
card_word1
),
'card_word2'
:
create_links
(
card_word2
),
'card_word3'
:
create_links
(
card_word3
)
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment