Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
police and thief
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9731075
police and thief
Commits
8e79b040
Commit
8e79b040
authored
Apr 15, 2019
by
hosein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playground -> show | void added
parent
9ae3085f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
PlayGround.java
src/PlayGround.java
+13
-2
No files found.
src/PlayGround.java
View file @
8e79b040
...
@@ -15,7 +15,18 @@ public class PlayGround {
...
@@ -15,7 +15,18 @@ public class PlayGround {
}
}
public
void
show
()
{
public
void
show
()
{
int
i
,
j
;
for
(
i
=
0
;
i
<
n
;
i
++)
{
for
(
j
=
0
;
j
<
m
;
j
++)
{
if
(
ground
[
i
][
j
]
==
0
)
System
.
out
.
print
(
"-"
);
else
if
(
ground
[
i
][
j
]
==
1
)
// police
System
.
out
.
print
(
"X"
);
else
// Dozd
System
.
out
.
print
(
"*"
);
}
System
.
out
.
println
(
""
);
}
}
}
public
void
putRandom
(
int
policeNumber
)
{
public
void
putRandom
(
int
policeNumber
)
{
...
@@ -27,7 +38,7 @@ public class PlayGround {
...
@@ -27,7 +38,7 @@ public class PlayGround {
j
=
rand
.
nextInt
();
j
=
rand
.
nextInt
();
if
(
ground
[
i
][
j
]
==
0
)
if
(
ground
[
i
][
j
]
==
0
)
ground
[
i
][
j
]
=
1
;
ground
[
i
][
j
]
=
1
;
else
k
--;
else
k
--;
}
}
else
System
.
out
.
println
(
"Error!! police numbers are higher than n*m"
);
else
System
.
out
.
println
(
"Error!! police numbers are higher than n*m"
);
}
}
...
...
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