Preppie Posted February 19, 2021 Share Posted February 19, 2021 30 minutes ago, vitoco said: Wow, interesting benchmack results. It is also interesting that there are 47 entries in the contest so far, and only 3 of them are for the A8 (6%) and 1 for the 2600 (2%). ? I didn't start thinking about a game until the competition was announced, and there's over a month to go so there's no rush. 1 Quote Link to comment Share on other sites More sharing options...
vitoco Posted February 19, 2021 Share Posted February 19, 2021 (edited) 57 minutes ago, _The Doctor__ said: maybe hide what is being done till judgement day... I hope you are right. I have my own next entry in beta testing by friends. Another topic: Even when I have released all the sources and executables right after the contest results, I've seen during the latest contests that the entries are being published in websites, blogs or forums before the deadline (not sure if before the contest's call). I'm not saying that the entries should be kept in secret, but I find interesting to maintain the expectation until the contest. Or, at least, it was interesting while the voters were the people at the NOMAM meetup, but it might not be now, because it exists an experts comitee. What do you think about this? Edited February 19, 2021 by vitoco 2 Quote Link to comment Share on other sites More sharing options...
AMSDOS Posted February 19, 2021 Share Posted February 19, 2021 1 hour ago, Preppie said: Some nice ways of shortening there. I tested speed in FastBasic(cross compiler), to run them 10,000 times took: A=A+1:IF A>10 THEN A=1 (or a=a+1:if a>10:a=1:endif) 144 jiffies A=1+AAND(A<10) 245 jiffies A=A MOD 10+1 323 jiffies A=A*(A<10)+1 423 jiffies A=1-A*SGN(A-10) 565 jiffies Interesting AND beats MOD in FastBASIC. Based on a Loop 1000 times, my system completed MOD in 4.45 secs instead of 5.25 for AND. When I used A=1+A AND (A<10), A begins at 1, though when 10 is reached, A=0 as opposed to the MOD example which returns to 1, if just wondered if that was the same case in FastBASIC? 1 Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 19, 2021 Author Share Posted February 19, 2021 (edited) A=1 + A AND (A<10) is supposed to go through 1 to 10, but not on Atari BASIC because it doesn't support bitwise AND, only logical AND. It means it will work differently on nearly every other BASIC other than Atari, Sinclair and Enterprise 32/64. Also on all other BASIC versions I tried, the AND solution is slower than the SGN solution. I wonder if FastBASIC supports bitwise AND or simply replicates the logical AND in Atari BASIC, but faster? Besides, I agree that MOD would be ideal but it is a very uncommon operator to find in most 8-bit BASICs. Some have it indeed, but more often than not it is lacking from the language. Edited February 19, 2021 by carlsson 2 Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 19, 2021 Author Share Posted February 19, 2021 (edited) 1 hour ago, dmsc said: Shorter: A = A*(A<10)+1 Does that really work even on Atari? I tested it on VIC-20, and I need to do A = -A*(A<10)+1 (note the added minus sign) to get the right sequence 1..10. It is also about 1% slower than the SGN solution. If that really is faster on Atari BASIC, it must handle operators differently from all the Microsoft implementations. Edit: Aha, one should turn the expression around so it becomes A = 1-A*(A<10). Then it runs 1% faster than SGN, or only 8% slower than the IF version. I find it peculiar that FastBASIC would penalize the SGN variant by 33% compared to the other solution, when an interpreted BASIC (at least of the Microsoft variety) only differs 1%. Edited February 19, 2021 by carlsson 2 Quote Link to comment Share on other sites More sharing options...
AMSDOS Posted February 19, 2021 Share Posted February 19, 2021 Like the VIC-20, I also have to add minus to get numbers between 1 and 10 otherwise it's just 1s and 0s. To carry out 1000 times, that formula took 5.73 secs. 1 Quote Link to comment Share on other sites More sharing options...
vitoco Posted February 19, 2021 Share Posted February 19, 2021 15 minutes ago, carlsson said: A=1 + A AND (A<10) is supposed to go through 1 to 10, but not on Atari BASIC because it doesn't support bitwise AND, only logical AND. It means it will work differently on nearly every other BASIC other than Atari, Sinclair and Enterprise 32/64. A=1 + A AND (A<10) gets stuck in 1 when run in both Fastbasic and Atari BASIC, and that is because the whole expression evaluates to 1 (true) or 0 (false). You need to change the AND by a multiplication (much slower as it was shown in the benchmark) to get a value in the 1 .. 10 range, because only the subexpression in the parentheses evaluates as a logical condition to 1 or 0, and then that value is multiplied by A and added to 1. A bitwise AND won't have any sense in an expression like that. 1 Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 19, 2021 Author Share Posted February 19, 2021 Also, isn't having ENDIF kind of cheating? I mean then you no longer have to worry about the line is effectively terminated once the IF statement is executed. After your ENDIF you can continue the same line up to maximum line length and don't need half of the smart coding techniques to avoid exactly that. Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 19, 2021 Author Share Posted February 19, 2021 (edited) 14 minutes ago, vitoco said: A bitwise AND won't have any sense in an expression like that. Well, bitwise AND by -1 actually appears to work in every other BASIC that I tested (mainly VIC, Oric 1, MSX, BBC, TI Extended and MC-10), but indeed using AND is a bit slower than the other solutions. It might be true that it does not make sense to do a bitwise operation with a negative integer, but hey it works for most of the time. Besides I get a feeling it is treated at $FFFF = 65535 in two's complement. Actually even ZX Spectrum BASIC almost works in the same way despite it doesn't do bitwise AND. The only ones that stand on their own here are Atari BASIC, Enterprise BASIC and COMX BASIC (of which the later flat out refuses AND with negative numbers). Edited February 19, 2021 by carlsson Quote Link to comment Share on other sites More sharing options...
vitoco Posted February 19, 2021 Share Posted February 19, 2021 6 minutes ago, carlsson said: Well, bitwise AND by -1 actually appears to work in every other BASIC that I tested (mainly VIC, Oric 1, MSX, BBC, TI Extended and MC-10), but indeed using AND is a bit slower than the other solutions. It might be true that it does not make sense to do a bitwise operation with a negative integer, but hey it works for most of the time. A "bitwise AND" -1 is A, because integer -1 has all its bits set, so an AND operation gives the same bits of the other operand. BTW: Using bitwise AND in Fastbasic: A=1 + A & (A<10) gives the range 1 to 2. 18 minutes ago, carlsson said: Also, isn't having ENDIF kind of cheating? I mean then you no longer have to worry about the line is effectively terminated once the IF statement is executed. After your ENDIF you can continue the same line up to maximum line length and don't need half of the smart coding techniques to avoid exactly that. Many flavors of BASIC include ENDIF when there is an ELSE statement available. But you are right, I had to manage the code to get the most of each line in Atari BASIC for the PUR-80 category, including filling with the most of the instructions before the IF, or changing IFs by ON-GOTOs. Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 19, 2021 Author Share Posted February 19, 2021 (edited) Hm, I find that ELSE isn't super common neither but perhaps I've been fishing in the wrong BASIC ocean. Apparently the idea with 1+A AND (A<10) is that you get 1 + A AND $FFFF = 1 + A as long as A is below 10, and 1 + A AND 0 = 1 when it reaches 10. Is the truth values in Fastbasic really 0 and -1, or are those 0 and 1? If I use the syntax A = 1+A AND -(A<10), I also get an alternating range of 0 and 1. Edited February 19, 2021 by carlsson Quote Link to comment Share on other sites More sharing options...
AMSDOS Posted February 20, 2021 Share Posted February 20, 2021 31 minutes ago, carlsson said: Also, isn't having ENDIF kind of cheating? I mean then you no longer have to worry about the line is effectively terminated once the IF statement is executed. After your ENDIF you can continue the same line up to maximum line length and don't need half of the smart coding techniques to avoid exactly that. The only solution I could came up with when BASIC lacks ENDIF is WHILE..WEND. For me using WHILE..WEND was only really a solution when Speed isn't important because I have to setup a variable 'f' for flag and use AND, which looks like this: f=0 WHILE <problem=true> AND <f=0> dostuff, dostuff, dostuff f=1 WEND then continue along the same line. Though there could be a better way because AND is slow here it's quite noticable, I tried altering AND with other things like MOD, but had no luck with it. 1 Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 20, 2021 Author Share Posted February 20, 2021 Would this work? F=0 WHILE <problem=true> * (1-F) dostuff F=1 WEND How complex is problem=true, I suppose it is not as simple as PROBLEM=-1, otherwise you could do WHILE PROBLEM * (1-F). 1 Quote Link to comment Share on other sites More sharing options...
vitoco Posted February 20, 2021 Share Posted February 20, 2021 Try this when there is no REPEAT-UNTIL (or WHILE-WEND with at least one iteration being done): FOR F=0 TO 1 do_stuff F=conditional_expression NEXT F This loop can be placed in the middle of a single line (or span between multiple lines) between other statements in the same line(s). No IF, no GOTO, no need to adjust to a new numbered line. 1 Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 20, 2021 Author Share Posted February 20, 2021 Or described in classic BASIC: 5 A=0 10 FOR F=0 TO 1 20 A=A+0.5:F=-(A>5) 30 PRINT A,F 40 NEXT F which runs until A>5. Again check which values are used for true and false and the F condition apparently is the exit one, not the looping one. Quote Link to comment Share on other sites More sharing options...
AMSDOS Posted February 20, 2021 Share Posted February 20, 2021 1 hour ago, carlsson said: Would this work? F=0 WHILE <problem=true> * (1-F) dostuff F=1 WEND How complex is problem=true, I suppose it is not as simple as PROBLEM=-1, otherwise you could do WHILE PROBLEM * (1-F). It can be as complex as a condition in an IF <statement> THEN. I wasn't sure if your example would work with Strings, though it seems to work with those as well, performance wise it doesn't appear to be any slower than using AND (f=1), though it saves on space (6 characters) instead of 9. Examples: f=0:c$="1":WHILE (c$="2")*(1-f):PRINT"Hello":f=1:WEND f=0:c$="2":WHILE (c$="2")*(1-f):PRINT"Hello":f=1:WEND 1 Quote Link to comment Share on other sites More sharing options...
dmsc Posted February 20, 2021 Share Posted February 20, 2021 Hi! 2 hours ago, carlsson said: Does that really work even on Atari? I tested it on VIC-20, and I need to do A = -A*(A<10)+1 (note the added minus sign) to get the right sequence 1..10. It is also about 1% slower than the SGN solution. If that really is faster on Atari BASIC, it must handle operators differently from all the Microsoft implementations. Edit: Aha, one should turn the expression around so it becomes A = 1-A*(A<10). Then it runs 1% faster than SGN, or only 8% slower than the IF version. I find it peculiar that FastBASIC would penalize the SGN variant by 33% compared to the other solution, when an interpreted BASIC (at least of the Microsoft variety) only differs 1%. There are two different conventions in BASIC for the boolean results: - BBC BASIC, Microsoft BASIC and derivatives: false = 0, true = -1 - Sinclair BASIC, Apple Integer BASIC, Atari BASIC and derivatives: false = 0, true = 1 So, you can do "A=1+A*(A<10)" in Atari BASIC and "A=1-A*(A<10)" in MS BASIC, both will produce the same result. The other possibility is "A=1+A&-(A<10)" in FastBasic (or Turbo BASIC) and "A=1+A AND (A<10)" in MS BASIC. About speed of operations in FastBasic, the fastest should be: " IF A=11 : A=1 : ELSE : INC A : ENDIF ", this is because "=" comparison is faster than "<", and control flow is very fast, as boolean results have a different type internally. 2 Quote Link to comment Share on other sites More sharing options...
dmsc Posted February 20, 2021 Share Posted February 20, 2021 Hi! 1 hour ago, AMSDOS said: It can be as complex as a condition in an IF <statement> THEN. I wasn't sure if your example would work with Strings, though it seems to work with those as well, performance wise it doesn't appear to be any slower than using AND (f=1), though it saves on space (6 characters) instead of 9. Examples: f=0:c$="1":WHILE (c$="2")*(1-f):PRINT"Hello":f=1:WEND f=0:c$="2":WHILE (c$="2")*(1-f):PRINT"Hello":f=1:WEND In FastBasic, those evaluate as: - C$="2" gives a boolean result - 1-f gives an integer result - the boolean is converted to an integer because it is used in the multiplication, so (c$="2")*(1-f) is an integer. - the integer is compared with 0 to convert to a boolean as a parameter to the WHILE, basically it is the same as WHILE (c$="2")*(1-f) <> 0 All those conversions are produced by the parser/compiler, and the cross-compiler has optimizations that can remove unneeded conversions. All control-flow statements expect a boolean as parameter. In Microsoft BASIC (and derivatives), there is no "boolean" type, only numeric type, so the IF or WHILE statements always need to compare to 0. Have Fun! Quote Link to comment Share on other sites More sharing options...
vitoco Posted February 20, 2021 Share Posted February 20, 2021 1 hour ago, dmsc said: There are two different conventions in BASIC for the boolean results: - BBC BASIC, Microsoft BASIC and derivatives: false = 0, true = -1 - Sinclair BASIC, Apple Integer BASIC, Atari BASIC and derivatives: false = 0, true = 1 That explains a lot from the previous posts about non-Atari BASIC flavors. I think that from the languages I've ever used, almost all of them define 1 as true and 0 as false. The ones that do not, it's because they have an explicit boolean data type. 1 Quote Link to comment Share on other sites More sharing options...
vitoco Posted February 21, 2021 Share Posted February 21, 2021 On 2/19/2021 at 7:35 PM, vitoco said: Even when I have released all the sources and executables right after the contest results, I've seen during the latest contests that the entries are being published in websites, blogs or forums before the deadline (not sure if before the contest's call). I'm not saying that the entries should be kept in secret, but I find interesting to maintain the expectation until the contest. Or, at least, it was interesting while the voters were the people at the NOMAM meetup, but it might not be now, because it exists an experts comitee. What do you think about this? No comments about this topic? If I tell you that my next game is the following one, what are you expecting for it to be? Would you like to know more of this game now or after the contest results? Should I publish an ATR and the source code in my website or at least upload a gameplay to YouTube a month before the NOMAM event? Quote Link to comment Share on other sites More sharing options...
Preppie Posted February 21, 2021 Share Posted February 21, 2021 I like to see at least a pic or even a gif, and don't mind seeing a video gameplay. But I prefer to wait till the end to play the game and see the source code. I like to try and figure out how it's been written before actualy seeing how it was done. 4 Quote Link to comment Share on other sites More sharing options...
_The Doctor__ Posted February 21, 2021 Share Posted February 21, 2021 I prefer to have just the idea and outline of the offering, you want to get interest in your work but not give away anything until contest day. When it's all out there, it seems to discourage a great deal of competition... The only way around that is to make up levels... beginner through expert... for coders to compete in. 1 Quote Link to comment Share on other sites More sharing options...
+skr Posted February 21, 2021 Share Posted February 21, 2021 I also like to have that moment of surprise, when everything is released at once without people knowing what they can expect. Releasing a WIP image is ok, but it´s a two sided coin. For some people seeing such a game as "Patrol" might be demotivating and keep them away from participating, thinking, they would not meet the standards (there aren´t many, actually). On the other hand it might motivate some people to make something even cooler. Having nothing released beforehand might also give the "smaller" entries more fame, as they might be overseen when title after title gets released over some weeks. When I get a compilation with completely unknown stuff, I feel like exploring single title. Having seen the "highlights" already, I might skip some entries. 2 Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 21, 2021 Author Share Posted February 21, 2021 I prefer to see screenshots, perhaps even recordings of already submitted entries. I don't need downloads ahead of the contest is closed, and to be honest if it wasn't for the A8 HSC, I wouldn't have played anyone else's 10Liners entries anyway. Of course if zero information was to be spilled before the contest - no screenshots, no titles, no systems - it would be entirely safe for multiple people to independently come up with the same type of game or concept, without one feeling inferior and like a copycat. On the other hand the arranger of the contest would have very few means to promote that it is happening if nothing would be given out in advance. It sure is a double edged sword, but I believe downloads or browser playable versions is taking it one step too far. 1 Quote Link to comment Share on other sites More sharing options...
AMSDOS Posted February 22, 2021 Share Posted February 22, 2021 For me, displaying the BASIC source code from another system would necessarily help me code that game for my system. In 2017 a screenshot of a game (sorry I forget the name) for the C64 in the PUR-80 category, helped me write a similiar game on my system, there were differences and I threw in some levels. Later when @vitoco wrote 'Alby, the Albino Bat', I tried something like that, but soon realized it won't be a 10-Liner for my system as I had to throw in a whole M/C Subroutine to detect when the Bat was hitting the landscape and even with the source, I had trouble updating the difficulty as your Bat travels through the game. An entry for the VIC-20 'Don't Touch Twice', looks rather appealing and this year the same person wrote 'Silo' which looks appealing too, but I can't seem to read VIC-20 BASIC. However if I could see the games in Action in the form of a Video or Animated GIF, I'd probably be able to write them on my system, but have had trouble contacting the author. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.