Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasGITH authored Sep 18, 2019
1 parent 5be607f commit bb36013
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Flappy_NN/Flappy_NN.pde
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ boolean enablePlayer;

void draw()
{
background(102, 255, 255);

//background(102, 255, 255);
background(255);
barSpawnTimer++;
if(barSpawnTimer > 200)
{
Expand Down Expand Up @@ -57,7 +57,7 @@ void draw()
stroke(10);
ellipse(posX,posY,25,25);
fill(250);

heightDifference = barList.get(0).y - posY;
lengthDifference = barList.get(0).x - posX;

Expand Down
20 changes: 4 additions & 16 deletions Flappy_NN/NN.pde
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@

float target(float HD, float LD)
{
//medium height = calculate ideal height-for-(ideal length-for-HD)
//difference_from_medium = HD - medium height
//if(difference_from_medium < range)
//return 1
//else
//return 0

//Tip: de 1 & 0 moeten misschien andersom zijn
if(LD >= 56 && (HD >= -75))
{
//print(1);
//print("\n");
return 1;
}
else
{
//print(0);
//print("\n");
return 0;
}

Expand Down Expand Up @@ -49,9 +37,11 @@ jump_or_not(output);
float train(){

for(int i = 0; i < 5000; i++){
//Geef input

//Geef input
float[] point = dataList.get(round(random(0,dataList.size() - 1)));
float target = point[2];

//Maak (training) voorspelling
float z = w1 * point[0] + w2 * point[1] + b;
float pred = sigmoid(z);
Expand Down Expand Up @@ -87,13 +77,11 @@ void jump_or_not(float output)
{
if(output > 0.5)
{

//doe niks
}
else
{
velocityY = 0;
accelerationY -= jumpforce;
}
}

//Geef input (& target)

0 comments on commit bb36013

Please sign in to comment.