Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tdenning_comp30023_2019_project-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Terence Denning
tdenning_comp30023_2019_project-1
Commits
500d04c2
Commit
500d04c2
authored
6 years ago
by
Terence Denning
Browse files
Options
Downloads
Patches
Plain Diff
game fully functional w/o cookie and list display
parent
ec976823
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
http-server.c
+12
-8
12 additions, 8 deletions
http-server.c
server
+0
-0
0 additions, 0 deletions
server
with
12 additions
and
8 deletions
http-server.c
+
12
−
8
View file @
500d04c2
...
...
@@ -44,6 +44,8 @@ static int user2_start = 0;
char
user2_guesses
[
100
][
100
];
int
user2_guess_number
=
0
;
int
gameover
=
0
;
static
char
*
webpage
;
// represents the types of method
...
...
@@ -157,6 +159,7 @@ static bool handle_http_request(int sockfd)
struct
stat
st
;
if
(
strstr
(
buff
,
"quit=Quit"
)
!=
NULL
){
webpage
=
"html/7_gameover.html"
;
stat
(
webpage
,
&
st
);
// Reset User
if
(
sockfd
==
user1
){
...
...
@@ -176,8 +179,6 @@ static bool handle_http_request(int sockfd)
return
false
;
}
webpage
=
"html/7_gameover.html.html"
;
int
filefd
=
open
(
webpage
,
O_RDONLY
);
n
=
read
(
filefd
,
buff
,
2048
);
if
(
n
<
0
)
...
...
@@ -216,6 +217,7 @@ static bool handle_http_request(int sockfd)
for
(
int
i
=
0
;
i
<
user2_guess_number
;
i
++
)
{
if
(
strcmp
(
user2_guesses
[
i
],
keyword
)
==
0
){
gameover
=
1
;
user1
=
-
1
;
user2
=
-
1
;
user1_guess_number
=
0
;
...
...
@@ -230,9 +232,9 @@ static bool handle_http_request(int sockfd)
}
}
}
else
if
(
user2
==
-
1
){
webpage
=
"html/7_
gameover
.html"
;
}
else
if
(
gameover
==
1
){
webpage
=
"html/6_endgame.html"
;
gameover
=
0
;
}
else
{
webpage
=
"html/5_discarded.html"
;
...
...
@@ -247,6 +249,7 @@ static bool handle_http_request(int sockfd)
for
(
int
i
=
0
;
i
<
user1_guess_number
;
i
++
)
{
if
(
strcmp
(
user1_guesses
[
i
],
keyword
)
==
0
){
gameover
=
1
;
user1
=
-
1
;
user2
=
-
1
;
user1_guess_number
=
0
;
...
...
@@ -261,8 +264,9 @@ static bool handle_http_request(int sockfd)
}
}
}
else
if
(
user1
==
-
1
){
webpage
=
"html/7_gameover.html"
;
else
if
(
gameover
==
1
){
webpage
=
"html/6_endgame.html"
;
gameover
=
0
;
}
else
{
webpage
=
"html/5_discarded.html"
;
...
...
This diff is collapsed.
Click to expand it.
server
+
0
−
0
View file @
500d04c2
No preview for this file type
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment