Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
1
142GameCenter
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
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
Nelson Phillips
142GameCenter
Commits
6949db4d
Commit
6949db4d
authored
Mar 13, 2019
by
Nelson Phillips
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
autosave
parent
3a943d72
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
15 deletions
+10
-15
Snake/Snake.cpp
Snake/Snake.cpp
+9
-14
Snake/Snake.h
Snake/Snake.h
+1
-0
Testings/CLICK TO PLAY.sh
Testings/CLICK TO PLAY.sh
+0
-1
No files found.
Snake/Snake.cpp
View file @
6949db4d
...
...
@@ -55,7 +55,8 @@ vector <Body> parts;
bool
Snake
::
draw
(){
for
(
int
i
=
0
;
i
<
29
;
i
++
){
for
(
int
i
=
0
;
i
<
29
;
i
++
){
for
(
int
q
=
0
;
q
<
60
;
q
++
){
if
(
x
<
1
)
return
false
;
if
(
y
<
1
)
return
false
;
...
...
@@ -65,12 +66,13 @@ vector <Body> parts;
if
(
h
==
i
||
o
==
q
)
grid
[
h
][
o
]
=
'*'
;
if
(
i
==
27
||
i
==
0
)
grid
[
i
][
q
]
=
'
|
'
;
grid
[
i
][
q
]
=
'
-
'
;
if
(
q
==
0
||
q
==
59
)
grid
[
i
][
q
]
=
'
_
'
;
grid
[
i
][
q
]
=
'
|
'
;
for
(
int
count
=
0
;
count
<
parts
.
size
();
count
++
){
for
(
int
count
=
0
;
count
<
parts
.
size
();
count
++
){
if
(
grid
[
parts
[
0
].
getX
()][
parts
[
0
].
getY
()]
==
'-'
)
return
false
;
if
(
count
==
0
){
if
(
direction
==
2
)
...
...
@@ -89,14 +91,10 @@ vector <Body> parts;
}
else
grid
[
parts
[
count
].
getX
()][
parts
[
count
].
getY
()]
=
'-'
;
}
}
}
}
for
(
int
i
=
0
;
i
<
29
;
i
++
){
cout
<<
endl
;
for
(
int
q
=
0
;
q
<
60
;
q
++
){
...
...
@@ -113,7 +111,7 @@ if (grid [x][y] == grid[h][o] ){
bdy
.
newBody
();
bonusBody
--
;
}
return
true
;
return
hi
;
}
int
Snake
::
snekoScore
(){
return
score
;
...
...
@@ -148,10 +146,7 @@ return true;
" |_____||__,_|_| |_| |_||___| |____/ |_/ |___|_|"
<<
endl
;
}
void
Body
::
changeX
(
bool
updown
){
...
...
Snake/Snake.h
View file @
6949db4d
...
...
@@ -17,6 +17,7 @@ class Snake {
int
getY
();
void
newBody
();
void
GameOver
();
bool
fillspace
();
private:
...
...
Testings/CLICK TO PLAY.sh
deleted
100644 → 0
View file @
3a943d72
g++
*
.cpp
-o
main.out
-pthread
-std
=
c++11
&&
./main.outf
\ 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