Neural network - flappy bird

User projects written in or related to FreeBASIC.
Avata
Posts: 102
Joined: Jan 17, 2021 7:27

Re: Neural network - flappy bird

Post by Avata »

Yes. It is nice. the following code could save/load “run_counter”.

Code: Select all


Function saveToDisk(ByVal dataout As UByte Ptr, lengteout As Short, fileName As String) As UShort
	Dim As Integer fileNum = FreeFile()
	If Open(fileName, For Binary, Access Write, As fileNum) = 0 Then
		Put #fileNum, , run_counter
		Put #fileNum, , CLng(lengteout) 'force long (4 bytes)
		Put #fileNum, , dataout[0] ,lengteout
		Close #fileNum
	Else
		Print "error open": Return -1
	End If
	Return 0
End Function


Function loadFromDisk(ByVal datain As UByte Ptr, lengtein As Short, fileName As String) As Short
	Dim As Long fileSize = FileLen(fileName)
	If fileSize < 4 Then Print "error lengte header": Return -3
	Dim As Integer fileNum = FreeFile()
	Dim As Long getlengte
	If Open(fileName, For Binary, Access Read, As fileNum) = 0 Then
		Get #fileNum, , run_counter
		Get #fileNum, , getlengte
		If getlengte <> lengtein Then Close #fileNum: Print "error lengte": Return -2
		Get #fileNum, , datain[0], lengtein
		Close #fileNum
	Else
		Print "error open": Return -1
	End If
	Return 0
End Function
Luxan
Posts: 222
Joined: Feb 18, 2009 12:47
Location: New Zealand

Re: Neural network - flappy bird

Post by Luxan »

Hi

Obviously, the developer of Flappy Bird has a familiarity with Neural Networks.
At Beginners, Easy Matrix, I'm attempting to repurpose the routines for use as a very basic Neural Network.

Apart from what already appears there, I've written most of the code for the forward propagation portion of
a Neural Network; now I'm considering back propagation. Perhaps you'd like to contribute insight or code
for this purpose.
Gunslinger
Posts: 103
Joined: Mar 08, 2016 19:10
Location: The Netherlands

Re: Neural network - flappy bird

Post by Gunslinger »

Luxan wrote: Aug 08, 2022 20:50 Hi

Obviously, the developer of Flappy Bird has a familiarity with Neural Networks.
At Beginners, Easy Matrix, I'm attempting to repurpose the routines for use as a very basic Neural Network.

Apart from what already appears there, I've written most of the code for the forward propagation portion of
a Neural Network; now I'm considering back propagation. Perhaps you'd like to contribute insight or code
for this purpose.
I think it is a good idea to also implant sigmoid filters on notes
I recent watched a great video from Sebastian Lague.
https://www.youtube.com/watch?v=hfMk-kj ... stianLague
Luxan
Posts: 222
Joined: Feb 18, 2009 12:47
Location: New Zealand

Re: Neural network - flappy bird

Post by Luxan »

Hi Gunslinger

I watched all of the video , more viewings are required to glean some insight
into some features he mentioned.

After the completion of what has felt like half a marathon, I may now have a NN that
has the basic features performing as intended. With so many variations on this theme
though, I'm of course not 100% certain.

Rather than using a convolutional NN I'm using back propagation and matrices.
For various reasons I prefer back propagation; for now.

I don't know how you code, I tend to spawn many fragments of code, independently
test these then merge them back into other variants of the main code and also
repeatedly edit those; until provisionally deciding on which main variant to promote
to mostly completed status.
Post Reply