Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TA2_SWT
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nick-Luis Achtmann
TA2_SWT
Commits
a5cdffce
Commit
a5cdffce
authored
2 months ago
by
Jan
Committed by
Nick
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
updated Actor interface
parent
fdb47d92
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Fehler fix
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/logic/Actor.java
+15
-0
15 additions, 0 deletions
src/logic/Actor.java
src/logic/Enemy.java
+0
-11
0 additions, 11 deletions
src/logic/Enemy.java
src/logic/Player.java
+0
-4
0 additions, 4 deletions
src/logic/Player.java
with
15 additions
and
15 deletions
src/logic/Actor.java
+
15
−
0
View file @
a5cdffce
...
...
@@ -8,4 +8,19 @@ public interface Actor {
public
char
getSymbol
();
public
void
setSymbol
(
char
symbol
);
// Methode für Spieler mit Koordinaten
default
boolean
makeMove
(
Board
board
,
int
x
,
int
y
)
{
return
board
.
placeToken
(
x
,
y
,
symbol
);
}
// Methode für Gegner (Zufallsgenerator)
default
boolean
makeMove
(
Board
board
)
{
Random
random
=
new
Random
();
int
x
,
y
;
do
{
x
=
random
.
nextInt
(
3
);
y
=
random
.
nextInt
(
3
);
}
while
(!
board
.
placeToken
(
x
,
y
,
symbol
));
return
true
;
}
}
This diff is collapsed.
Click to expand it.
src/logic/Enemy.java
+
0
−
11
View file @
a5cdffce
...
...
@@ -18,16 +18,5 @@ public class Enemy implements Actor {
this
.
symbol
=
symbol
;
}
// Methode, um den nächsten Zug des Akteurs zu machen
public
boolean
makeMove
(
Board
board
)
{
Random
random
=
new
Random
();
int
x
;
int
y
;
do
{
x
=
random
.
nextInt
(
3
);
y
=
random
.
nextInt
(
3
);
}
while
(!
board
.
placeToken
(
x
,
y
,
symbol
));
return
true
;
}
}
This diff is collapsed.
Click to expand it.
src/logic/Player.java
+
0
−
4
View file @
a5cdffce
...
...
@@ -18,8 +18,4 @@ public class Player implements Actor {
// Methode, um den nächsten Zug des Akteurs zu machen
public
boolean
makeMove
(
Board
board
,
int
x
,
int
y
)
{
return
board
.
placeToken
(
x
,
y
,
symbol
);
}
}
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