English Amiga Board Hi Soft Basic help wanted
 Register Amiga FAQ Rules & Help Members List  /  Moderators List Today's Posts Mark Forums Read

 07 September 2012, 10:28 #1 alphagemini Registered User   Join Date: Nov 2011 Location: Folkestone, Kent Posts: 119 Hi Soft Basic help wanted I am trying to write a routine to sort listed data into time difference groups such that any group of data with a fixed time difference will have a line of space before the next group as follows:- Basic data list a b c d e f g h etc If a-b < 5 then print a and b, if b-c < 5 print a,b and c etc If c-d > 5 then print a line of space and start again at d this will then look like this:- a b c d e f g h etc Any item without a close neighbour is to be unlisted Can anyone help?
 07 September 2012, 12:40 #2 Leffmann   Join Date: Jul 2008 Location: Sweden Posts: 2,265 You can do this by starting at the first value and search forward while the difference is lower than your threshold. If the interval you searched in covers more than one value then you print these and a blank line after. If the next value after the interval is still inside your list then you repeat the whole procedure. EDIT: assuming you have a list sorted in ascending order: Code: ```' set the threshold and number of items in our list t = 5 n = 10 list(n) = list(n-1)+t ' search through the whole list s = 0 while s < n ' find the end of the current interval e = s while list(e+1)-list(e) < t e = e+1 wend ' if there were more than 1 item we print them if e-s > 0 for i = s to e print list(i) next print end if ' step to the next item and repeat s = e+1 wend``` Last edited by Leffmann; 07 September 2012 at 12:51.
 07 September 2012, 17:00 #3 alphagemini Registered User   Join Date: Nov 2011 Location: Folkestone, Kent Posts: 119 Thanks. I will ponder on your answer and see if I can make it applicable. If not, may I ask for more help? regards Dan
 07 September 2012, 20:18 #4 Leffmann   Join Date: Jul 2008 Location: Sweden Posts: 2,265 Sure, no problem. This code should work with HiSoft Basic v2.0 from 1994, I'm not sure how compatible the other versions are.
 11 September 2012, 10:11 #5 alphagemini Registered User   Join Date: Nov 2011 Location: Folkestone, Kent Posts: 119 Hi Leffmann, my HiSoft basic program is V2.0, so it should work. My data generated from another program is filed in the following format:- Day 11 9 Time 0 0 4 Har 12 22 35 Day 11 9 Time 10 10 40 Har 16 52 48 This makes the line lengths different. If we need the length of the file to use in the formula you gave me, we need the number of lines and not just the file length. Typically my files have between 3500 and 4000 lines. I tried using the following code to find the file length:- Open for input as #1 : length&=LOF(1) FileBuf\$=INPUT\$(length&,#1) PRINT LOF(1) I use the print statement to check LOF. The result is a large number 155378 is an example. To find the number of lines we need to divide this by the number of data bits in a line (I think). Therefore the line lengths must be equal. How can I file data so that all of the items are tabbed in columns? This would be useful also for visual inspection of the data. I use the following code in my data generation program. OPEN ans2\$ for APPEND AS #1 thanks for your help
 11 September 2012, 18:03 #6 Leffmann   Join Date: Jul 2008 Location: Sweden Posts: 2,265 You can achieve both tabulation and fixed-width lines if you write your data with the print using-statement, f.ex: Code: `print #1, using "### ### ### \ \", x, y, 10, "test"` The # specifies where you want to fit digits and the \\ including the space in between specifies where you want strings. These are the only formatting specifiers I remember off the top of my head. Do you have the v2.0 manual btw? I'd like to add it to my own files but can't find a download anywhere. EDIT: if the lines in your file are already sorted, and you're not doing anything else with the file but reading it in to group the lines and print them, then you can probably do this in one go and print as you read. Last edited by Leffmann; 11 September 2012 at 18:14.
12 September 2012, 00:33   #7
prowler
Global Moderator

Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
Quote:
 Originally Posted by Leffmann Do you have the v2.0 manual btw? I'd like to add it to my own files but can't find a download anywhere.
HiSoft Basic 2.0 Manual-on-disk is in The Zone for you.

12 September 2012, 07:02   #8
alphagemini
Registered User

Join Date: Nov 2011
Location: Folkestone, Kent
Posts: 119
Quote:
 Originally Posted by Leffmann You can achieve both tabulation and fixed-width lines if you write your data with the print using-statement, f.ex: Code: `print #1, using "### ### ### \ \", x, y, 10, "test"` The # specifies where you want to fit digits and the \\ including the space in between specifies where you want strings. These are the only formatting specifiers I remember off the top of my head. Do you have the v2.0 manual btw? I'd like to add it to my own files but can't find a download anywhere. EDIT: if the lines in your file are already sorted, and you're not doing anything else with the file but reading it in to group the lines and print them, then you can probably do this in one go and print as you read.

Yes I have the original manual in hard copy. I find it hard to use because I'm not really a programmer. I'm just starting to learn but have a research

12 September 2012, 07:04   #9
alphagemini
Registered User

Join Date: Nov 2011
Location: Folkestone, Kent
Posts: 119
Quote:
 Originally Posted by prowler HiSoft Basic 2.0 Manual-on-disk is in The Zone for you.

I have the original in hard copy. Using it with all that jargon is a big task for a
a starter!

12 September 2012, 14:45   #10
alphagemini
Registered User

Join Date: Nov 2011
Location: Folkestone, Kent
Posts: 119
Quote:
 Originally Posted by Leffmann You can achieve both tabulation and fixed-width lines if you write your data with the print using-statement, f.ex: Code: `print #1, using "### ### ### \ \", x, y, 10, "test"` The # specifies where you want to fit digits and the \\ including the space in between specifies where you want strings. These are the only formatting specifiers I remember off the top of my head. Do you have the v2.0 manual btw? I'd like to add it to my own files but can't find a download anywhere. EDIT: if the lines in your file are already sorted, and you're not doing anything else with the file but reading it in to group the lines and print them, then you can probably do this in one go and print as you read.

Thanks. I have now managed to get the files right and can calculate the number of lines of text. Next is to get the search routine right.

13 September 2012, 12:43   #11
Leffmann

Join Date: Jul 2008
Location: Sweden
Posts: 2,265
Quote:
 Originally Posted by prowler HiSoft Basic 2.0 Manual-on-disk is in The Zone for you.
Thanks a lot! Been looking for this everywhere.

Quote:
 Originally Posted by alphagemini Yes I have the original manual in hard copy. I find it hard to use because I'm not really a programmer. I'm just starting to learn but have a research project to complete. I shall try your advice. Thanks for your help
Yes I understand, the manual is more of a reference and not so much a guide to programming for someone just starting out. Glad you got the formatting sorted out.

 Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 Similar Threads Thread Thread Starter Forum Replies Last Post alphagemini Coders. General 6 07 March 2013 22:35 ricky500 request.Apps 20 12 February 2013 21:06 alphagemini Coders. General 4 11 January 2013 11:39 alphagemini Coders. General 6 05 August 2012 18:00 redblade Coders. General 16 24 December 2005 05:41

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home News Main     Amiga scene     Retrogaming General Discussion     Nostalgia & memories Support     New to Emulation or Amiga scene         Member Introductions     support.WinUAE     support.WinFellow     support.OtherUAE     support.FS-UAE         project.AmigaLive     support.Hardware         Hardware mods         Hardware pics     support.Games     support.Demos     support.Apps     support.Amiga Forever     support.Amix     support.Other Requests     request.UAE Wishlist     request.Old Rare Games     request.Demos     request.Apps     request.Modules     request.Music     request.Other     Looking for a game name ?     Games images which need to be WHDified abime.net - Hall Of Light     HOL news     HOL suggestions and feedback     HOL data problems     HOL contributions abime.net - Amiga Magazine Rack     AMR news     AMR suggestions and feedback     AMR data problems     AMR contributions abime.net - Home Projects     project.Amiga Lore     project.EAB     project.IRC     project.Mods Jukebox     project.Wiki abime.net - Hosted Projects     project.aGTW     project.APoV     project.ClassicWB     project.Jambo!     project.Green Amiga Alien GUIDES     project.Maptapper     project.Sprites     project.WinUAE - Kaillera Other Projects     project.Amiga Demo DVD     project.Amiga Game Factory     project.CARE     project.EAB File Server     project.CD32 Conversion     project.Game Cover Art         GCA.Feedback and Suggestions         GCA.Work in Progress         GCA.Cover Requests         GCA.Usefull Programs         GCA.Helpdesk     project.KGLoad     project.MAGE     project.Missing Full Shareware Games     project.SPS (was CAPS)     project.TOSEC (amiga only)     project.WHDLoad         project.Killergorilla's WHD packs Misc     Amiga websites reviews     MarketPlace         Swapshop     Kinky Amiga Stuff     Collections     EAB's competition Coders     Coders. General         Coders. Releases         Coders. Tutorials     Coders. Asm / Hardware     Coders. System         Coders. Scripting         Coders. Nextgen     Coders. Language         Coders. C/C++         Coders. AMOS         Coders. Blitz Basic     Coders. Contest         Coders. Entries Off Topic     OT - General     OT - Entertainment     OT - Sports     OT - Technical     OT - Gaming

All times are GMT +2. The time now is 19:20.

 -- EAB3 skin ---- EAB2 skin ---- Mobile skin Archive - Top