Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IDATT2003 Mappevurdering
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Håvard Johannes Versto Daleng
IDATT2003 Mappevurdering
Commits
22c6d84d
Commit
22c6d84d
authored
11 months ago
by
Håvard Daleng
Browse files
Options
Downloads
Patches
Plain Diff
Improved CLI-app to add super basic user input handling.
parent
48c09af2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/edu/ntnu/stud/chaosgame/Main.java
+34
-3
34 additions, 3 deletions
src/main/java/edu/ntnu/stud/chaosgame/Main.java
src/main/resources/descriptions/output.txt
+6
-0
6 additions, 0 deletions
src/main/resources/descriptions/output.txt
with
40 additions
and
3 deletions
src/main/java/edu/ntnu/stud/chaosgame/Main.java
+
34
−
3
View file @
22c6d84d
...
...
@@ -8,17 +8,21 @@ import edu.ntnu.stud.chaosgame.model.handling.ChaosCanvas;
import
edu.ntnu.stud.chaosgame.model.handling.ChaosGame
;
import
edu.ntnu.stud.chaosgame.model.transformations.AffineTransform2D
;
import
edu.ntnu.stud.chaosgame.model.transformations.Transform2D
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Scanner
;
/**
* Main class for the Chaos Game application.
*/
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
Scanner
sc
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"Hi"
);
String
path
=
"src/main/resources/descriptions/
S
ierpinski.txt"
;
String
path
=
"src/main/resources/descriptions/
s
ierpinski.txt"
;
ChaosGameDescription
description
=
null
;
// Declare description
...
...
@@ -34,7 +38,34 @@ public class Main {
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
// TODO: Alter error handling
}
game
.
runSteps
(
100000
);
boolean
exit
=
false
;
// While loop for simple cli-app.
while
(!
exit
)
{
System
.
out
.
println
(
"What would you like to do? Type 1 for displaying fractal, "
+
"or anything else for ending the program"
);
if
(
Objects
.
equals
(
sc
.
next
(),
"1"
))
{
game
.
runSteps
(
100000
);
System
.
out
.
println
(
"What would you like to do? Type 1 for saving the fractal, anything else for ending the program"
);
if
(
Objects
.
equals
(
sc
.
next
(),
"1"
))
{
ChaosGameFileHandler
handler
=
new
ChaosGameFileHandler
();
handler
.
writeToFile
(
description
,
"src/main/resources/descriptions/output.txt"
);
System
.
out
.
println
(
"Wrote to file output.txt."
);
}
else
{
exit
=
true
;
}
}
else
{
exit
=
true
;
}
}
System
.
out
.
println
(
"Terminated program."
);
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/descriptions/output.txt
0 → 100644
+
6
−
0
View file @
22c6d84d
Affine2D
0.0, 0.0
1.0, 1.0
0.5, 0.0, 0.0, 0.5, 0.0, 0.0
0.5, 0.0, 0.0, 0.5, 0.25, 0.5
0.5, 0.0, 0.0, 0.5, 0.5, 0.0
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