Commit 2e1c3f42 authored by mamat-rahmat's avatar mamat-rahmat
Browse files

find udah bisa, tapi belum minta ke server lain

parent 072ddf11
......@@ -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"]
......
{
"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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment