Board Logo
« getting started, Pigeon Breeders Records program »

Welcome Guest. Please Login or Register.
Jan 21st, 2018, 12:54am


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1 2 3 4  ...  11 Notify Send Topic Print
 veryhotthread  Author  Topic: getting started, Pigeon Breeders Records program  (Read 10847 times)
ezprogramming
Guest
xx Re: getting started with Prog for Pigeon Breeding
« Reply #15 on: Mar 9th, 2016, 1:36pm »

Post deleted
« Last Edit: Sep 15th, 2016, 2:02pm by ezprogramming » User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #16 on: Mar 9th, 2016, 3:36pm »

deleted
« Last Edit: Mar 9th, 2016, 3:47pm by stumpy » User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #17 on: Mar 9th, 2016, 3:43pm »

Edited
I really can't remember what I did for spectrum basic and amiga breeding list/pedigrees so will certainly look again...

As above, I need flexible side-by side-lists for about 50 pairs, cock's details on the left, hen's on the right.
The details would be entered by the user saved or loaded from disc, but it's understood that some data would need to be written ito the code, just for demonstration.

I will refer to Rod's second example:-
When run, there appears on screen a text box with a list box below it, and it's still not quite clear what the prog is designed to show on the screen.
For a start, which may be more than enough smiley this is what I got to understand/misunderstand, but only from the listing:-

'create an example database
maxbirds=20 ..................(maxbirds = a number, which I see could just as well be 50, and that 'max' is temporary and does not signify a limit)
dim bird$(maxbirds,5) .... (= dim bird$(20,5))
dim ring$(maxbirds).........(= dim ring$(20))
ring=1.............................(5x numeric variables in all: ring, named, info, but I believe that only the numbers 4 and 5, to represent father and mother, would actually need to be adjusted separately)
named=2
info=3
father=4
mother=5
data 1,"C","Adam",0,0........(each of the 14 items of data contains 5 components, so these could correspond to the 5 variables, as above, when perhaps only three are needed?)
data 2,"H","Eve",0,0........(I see how Cane, Able, and Mary are differentiated as sons and daughters of Adam and Eve (and vice versa) but am not sure if their sexes would need to be noted where, in each item of data, the 4th and 5th element are male and female respectively, or perhaps the cocks could be identified with even unique numbers and hens with odd ones instead, or just be C$'s and H$'s?)

data 3,"C","Cane",1,2
data 4,"C","Able",1,2
data 5,"H","Mary",1,2
data 6,"C","Dave",3,5
data 7,"C","Bill",3,5
data 8,"H","Jess",4,5
data 9,"H","Susy",4,5
data 10,"C","Dann",6,8
data 11,"C","John",6,8
data 12,"H","Pegg",7,9
data 13,"H","Joan",7,9
data 14,"H","Lady",10,9

maxbirds=14 .........................................................(here maxbirds is the number of items of data)
open "bird.dat" for random as #bird len = 17 [/i].........(not yet clear, but perhaps random is a scheme for searching, and follows?)
field #bird, 4 as id, 1 as sex$, 4 as name$, 4 as father, 4 as mother .....(ditto)

Reckon I see that the linking is through father and mother being items 4 and 5, but do not follow the bit about breaking and reforming the data.

Because of unfamiliar JB terms, I have not very far with following code which has several new things going on...and evidently I have even got stuck with using snippets from JB help section and had to cry for help!
« Last Edit: Mar 10th, 2016, 02:32am by stumpy » User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #18 on: Mar 10th, 2016, 03:27am »

Having failed to see how my own ideas could work, the light is beginning to dawn with Rod's code, and aha think I can see how it does it.

For now I have plenty to be getting on with, thanks:

- relationships using linked list
- layout, (partly addressed but stuck)
- GUI, (partly addressed but stuck)
- saving and loading.

Reckon I need to go back to school and will order the book "Programming for the Absolute Beginner" by Jerry Lee Ford

- should have done that first
« Last Edit: Mar 10th, 2016, 3:18pm by stumpy » User IP Logged

tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3636
xx Re: getting started with Prog for Pigeon Breeding
« Reply #19 on: Mar 11th, 2016, 07:55am »

Recursive version based on Rod's code.
It just keep searching for grand...parents until corresponding field is 0.
Sample output:
Code:
Bird Bill Sex:C Id:7
father
     Bird Cane Sex:C Id:3
gran father
          Bird Adam Sex:C Id:1
gran mother
          Bird Eve  Sex:H Id:2
mother
     Bird Mary Sex:H Id:5
gran father
          Bird Adam Sex:C Id:1
gran mother
          Bird Eve  Sex:H Id:2
 

Somehow failed to make
Code:
gran gran mother
               Bird Eve  Sex:H Id:2
 

appear on a single line.
Code:
'create an example database
maxbirds=20
dim bird$(maxbirds,5)
dim ring$(maxbirds)
ring=1
named=2
info=3
father=4
mother=5
data 1,"C","Adam",0,0
data 2,"H","Eve",0,0
data 3,"C","Cane",1,2
data 4,"C","Able",1,2
data 5,"H","Mary",1,2
data 6,"C","Dave",3,5
data 7,"C","Bill",3,5
data 8,"H","Jess",4,5
data 9,"H","Susy",4,5
data 10,"C","Dann",6,8
data 11,"C","John",6,8
data 12,"H","Pegg",7,9
data 13,"H","Joan",7,9
data 14,"H","Lady",10,9
maxbirds=14
open "bird.dat" for random as #bird len = 17
field #bird, 4 as id, 1 as sex$, 4 as name$, 4 as father, 4 as mother

dim index$(maxbirds)
for n= 1 to maxbirds
read id
read sex$
read name$
read father
read mother
put #bird, id
index$(id)=name$+" "+sex$
next


nomainwin
WindowWidth=400
WindowHeight=400
combobox #main.cbbirds, index$(), [selected], 26, 16, 300, 200
texteditor #main.ancestry, 26, 36, 300, 200
open "untitled" for dialog as #main
#main "trapclose [quit]"

'wait here for input event
wait


[selected]   'Perform action for the combobox
    #main.cbbirds "selectionindex? id"
    #main.ancestry "!cls"
    call getBerd id, 1
wait

[quit]
close #main
close #bird
end

sub getBerd id, level
    get #bird, id
    #main.ancestry space$((level -1)*5);"Bird ";name$;" Sex:";sex$;" Id:";id
    fatherid=father
    motherid=mother
    if fatherid <> 0 then
        gran$=""
        for i = 1 to level -1
            gran$=gran$+"gran "
        next
        #main.ancestry gran$; "father "
        call getBerd  fatherid, level+1
    end if

    if motherid <> 0 then
        gran$=""
        for i = 1 to level -1
            gran$=gran$+"gran "
        next
        #main.ancestry gran$; "mother "
        call getBerd  motherid, level+1
    end if
end sub
 
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: getting started with Prog for Pigeon Breeding
« Reply #20 on: Mar 11th, 2016, 08:13am »

Chicken and egg kinda problem smiley
User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #21 on: Mar 11th, 2016, 08:31am »

Nice one Rod and thank you tsh73.
The penny dropped and found that, in all versions, the subject first needed to be selected in the upper box (blank at first).....and then the output appears!

Great, and these examples will certainly do the most difficult bit of linking the individual birds in 'todo: relationships'.

Now I 'just' need to do the homework needed to work out how to do the other things cool
I'll be back when I have practiced with the book.
« Last Edit: Mar 11th, 2016, 08:33am by stumpy » User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #22 on: Mar 11th, 2016, 12:23pm »

Rod, when I run this:-
print str$(int(rnd(0)*3+1)) I find it always prints "2"

so, in the following bits of code to set up data in example1, what is the reason for 'str$(int(rnd(0)*3+1))', please?

....
bird$(n,father)="C001"+str$(int(rnd(0)*3+1)) 'the unique identifier of the birds father
bird$(n,mother)="H000"+str$(int(rnd(0)*3+1)) 'unique identifier of the birds mother
.....

User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: getting started with Prog for Pigeon Breeding
« Reply #23 on: Mar 11th, 2016, 12:24pm »

Best brains seem to say, with little conviction, that the egg came first. So be it. If we get to Adam and Eve we should just adopt a nebulous parent as a fail safe and programming convenience.
User IP Logged

tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3636
xx Re: getting started with Prog for Pigeon Breeding
« Reply #24 on: Mar 11th, 2016, 12:27pm »

Quote:
Rod, when I run this:-
print str$(int(rnd(0)*3+1)) I find it always prints "2"

It supposed to return different numbers
Code:
for i = 1 to 10
    print str$(int(rnd(0)*3+1))
next 

Code:
3
3
1
1
3
1
1
3
1
2 

And then I run it another time I do get different sequence.
(you will have same sequence if yo have "randomize" somewhere before in the program)
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: getting started with Prog for Pigeon Breeding
« Reply #25 on: Mar 11th, 2016, 12:33pm »

Don't get hung up on my code to create random bird data. Rnd(0) is a very precise command that returns a completely random float between 0 and 1 but it never equals 0 or 1 just something I between. By multiplying it or adding .5 or 1 we manipulate its value usually before rounding it down to an integer

So the code you see is creating random numbers in a restricted range.
« Last Edit: Mar 11th, 2016, 12:35pm by Rod » User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #26 on: Mar 11th, 2016, 1:00pm »

Right, move on.

Yes the egg obviously does precede the chicken while the egg itself is preceded by two different chickens (category error?).....the Adam and Eve metaphor is apt because a closely bred strain of birds has common ancestors and the pedigree means little, except to identify individuals which have the most influence downstream.
« Last Edit: Mar 11th, 2016, 1:03pm by stumpy » User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #27 on: Mar 12th, 2016, 06:22am »

'Query #1.)
'Puzzled as to why this runs only when this bit: " + " pa." + f$ + " ma." + m$", is left off the 6th line from the bottom, while f$ and m$ can be printed ok on their own

dim c$(50)
'......intended for another column for all the hens:- dim h$(50)
sex$="C" '....(or "H")
year$="2012" '....dummy
ringno$="0000" '....dummy
marking$="BB WF dark Tail" '....dummy
f$="father" '....dummy. It would eventually be the unique string: year$ + ringno$ of a cock in the list
m$="mother" '....dummy. It would eventually be the unique string: year$ + ringno$ of a hen in the list
n=0

while n<=49
n=n+1
p$= str$(n)
if n<10 then p$=" "+p$
c$(n) = sex$ + " " + year$ + "," + ringno$ + " " + marking$
'........the following extra bits were wanted, but it only runs if they are left off the previous line:- + " pa." + f$ + " ma." + m$"
print p$; ". "; c$(n)
wend
wait

'Query #2.)
'Would like this to run in a window, using 'nomainwin', as it does in 'mainwin' 'itself, but don't see a suitable type.
'How is that done please?

« Last Edit: Mar 12th, 2016, 06:31am by stumpy » User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: getting started with Prog for Pigeon Breeding
« Reply #28 on: Mar 12th, 2016, 06:51am »

Leave off the trailing " it is not required. "" are used in pairs.

Its not somuch the window type you want but the controls that you want. We have shown a couple of controls to display your text in. It depends on what user interaction you want. We have shown a listbox which allows a bird to be selected from a series of birds. We have shown a texteditor which simply lists the birds but does not allow clickable selection.

So you want two lists of birds side by side, you could have two listboxes side by side, you could have columns of textboxes side by side with buttons for selection or indeed checkboxes. A third control could display the selections made.

I think you need to play with some of the demo code that ships with Just BASIC to get a feel for what controls there are and how they work.
« Last Edit: Mar 12th, 2016, 06:53am by Rod » User IP Logged

stumpy
Full Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 148
xx Re: getting started with Prog for Pigeon Breeding
« Reply #29 on: Mar 12th, 2016, 07:17am »

Thanks, cured. Two list boxes side by side seem best but don't need the vertical scroll bars. Will play some more
User IP Logged

Pages: 1 2 3 4  ...  11 Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls