Jump to content
IGNORED

BASIC 10 Liner Contest 2021


carlsson

Recommended Posts

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.

  • Like 1
Link to comment
Share on other sites

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 by vitoco
  • Like 2
Link to comment
Share on other sites

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?

  • Like 1
Link to comment
Share on other sites

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 by carlsson
  • Like 2
Link to comment
Share on other sites

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 by carlsson
  • Like 2
Link to comment
Share on other sites

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.

 

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by carlsson
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by carlsson
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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.

 

  • Like 1
Link to comment
Share on other sites

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
 

  • Like 1
Link to comment
Share on other sites

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.

 

 

 

 

 

  • Like 2
Link to comment
Share on other sites

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!

 

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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?

 

child-00.png.256f18fa48debd0468b9c72879e3cedf.png

 

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?

 

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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. :(

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...