Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Bipedal Walker Evo
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Philip Maas
Bipedal Walker Evo
Commits
fb475df6
Commit
fb475df6
authored
Jan 30, 2022
by
Philip Maas
Browse files
Options
Downloads
Patches
Plain Diff
Deleted brain.py, shouldnt be here and came from merging
parent
8e99066b
No related branches found
No related tags found
1 merge request
!2
Evo neuro
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
brain.py
+0
-51
0 additions, 51 deletions
brain.py
with
0 additions
and
51 deletions
brain.py
deleted
100644 → 0
+
0
−
51
View file @
8e99066b
import
numpy
as
np
import
random
import
copy
import
pickle
class
Brain
:
def
__init__
(
self
,
size
,
load_brain
):
self
.
directions
=
[]
self
.
step
=
0
if
load_brain
:
self
.
load
()
else
:
self
.
increase_moves
(
size
)
def
get_move
(
self
):
move
=
self
.
directions
[
self
.
step
]
self
.
step
+=
1
return
move
# we want different and random movements
def
increase_moves
(
self
,
size
):
for
i
in
range
(
size
):
self
.
directions
.
append
(
np
.
random
.
uniform
(
-
1
,
1
,
4
))
# returns a copy of the given brain
def
clone
(
self
):
clone
=
Brain
(
len
(
self
.
directions
),
False
)
for
i
in
range
(
len
(
self
.
directions
)):
clone
.
directions
[
i
]
=
copy
.
copy
(
self
.
directions
[
i
])
return
clone
def
mutate
(
self
,
mutation_factor
):
# mutates the brain by setting some of the directions to random movements
for
i
in
range
(
len
(
self
.
directions
)):
if
random
.
random
()
<=
mutation_factor
:
self
.
directions
[
i
]
=
np
.
random
.
uniform
(
-
1
,
1
,
4
)
def
save
(
self
):
with
open
(
'
best_brain
'
,
'
wb
'
)
as
fp
:
pickle
.
dump
(
self
.
directions
,
fp
)
def
load
(
self
):
with
open
(
'
best_brain
'
,
'
rb
'
)
as
fp
:
self
.
directions
=
pickle
.
load
(
fp
)
if
__name__
==
'
__main__
'
:
# for debugging
brain_inst
=
Brain
(
100
,
True
)
print
(
brain_inst
.
directions
)
print
(
len
(
brain_inst
.
directions
))
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