Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
lancarjodoh
IF3230-Tugas-Besar-Sister-2015
Commits
2e1c3f42
Commit
2e1c3f42
authored
Apr 26, 2015
by
mamat-rahmat
Browse files
find udah bisa, tapi belum minta ke server lain
parent
072ddf11
Changes
2
Hide whitespace changes
Inline
Side-by-side
bin/server/mainserver_thread.py
View file @
2e1c3f42
...
...
@@ -115,7 +115,8 @@ def handler(a, c):
#process request
method
=
dataJSON
[
'method'
]
response
=
""
# response from server to client
response
=
'{"status" : "error"}'
# response from server to client
if
(
method
==
"signup"
):
username
=
dataJSON
[
"username"
]
password
=
dataJSON
[
"password"
]
...
...
@@ -307,7 +308,7 @@ def handler(a, c):
else
:
response
=
'{"status" : "fail", "time" : "FAILURE MESSAGE HERE"}'
elif
(
method
==
'
map
'
):
elif
(
method
==
"
map
"
):
#random number for width and height
#width = randint(5,15)
#height = width
...
...
@@ -343,13 +344,8 @@ def handler(a, c):
with
open
(
'map'
,
'w'
)
as
f
:
json
.
dump
(
data
,
f
,
indent
=
4
,
separators
=
(
','
,
': '
))
#for update
#kriteria1Object = {"$set":{"width":5}}
#kriteria2Object = {"$set":{"height":5}}
#database.playerCollection.update(kriteriaObject,kriteria1Object)
#database.playerCollection.update(kriteriaObject,kriteria2Object)
#response = '{"status" : "ok", "name" : ' + username + ', "width" : ' + str(width) + ', "height" : ' + str(height) + '}'
response
=
'{"status" : "ok", "name" : '
+
username
+
', "width" : 5, "height" : 5}'
response
=
'{"status" : "ok", "name" : "'
+
username
+
'", "width" : 5, "height" : 5}'
elif
(
method
==
"offer"
):
token
=
dataJSON
[
"token"
]
...
...
bin/server/map
View file @
2e1c3f42
{
"height": 5,
"name": "tiga",
"map": [
[
2,
8,
4,
7,
9
],
[
5,
7,
7,
0,
6,
6,
1
],
[
8
,
3
,
1
,
1
,
1
0
,
5
,
5
,
9
,
8
],
[
7,
2,
9,
5,
8,
3,
0
5,
6
],
[
5,
9,
0,
4,
6,
1
],
[
4,
1,
9,
4,
3
]
],
"width": 5
"height": 5,
"width": 5,
"name": "tujuh"
}
\ No newline at end of file
Write
Preview
Supports
Markdown
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