Small Basic Download For Mac

  

LaTeX is free software under the terms of the LaTeX Project Public License (LPPL). LaTeX is distributed through CTAN servers or comes as part of many easily installable and usable TeX distributions provided by the TeX User Group (TUG) or third parties. If you run into trouble, visit the help section.

  1. Small Basic Microsoft
  2. Microsoft Small Basic
  3. Small Basic Download For Mac Os

LaTeX is not a stand-alone typesetting program in itself, but document preparation software that runs on top of Donald E. Knuth's TeX typesetting system. TeX distributions usually bundle together all the parts needed for a working TeX system and they generally add to this both configuration and maintenance utilities. Nowadays LaTeX, and many of the packages built on it, form an important component of any major TeX distribution.

Computer
  • The LaTeX Git Repository

Google Docs brings your documents to life with smart editing and styling tools to help you easily format text and paragraphs. Choose from hundreds of fonts, add links, images, and drawings. Sep 23, 2021 Download Microsoft Small Basic For Mac Software; Free Microsoft Word For Mac; Welcome to Small Basic! Small Basic is the only programming language created specially to help students transition from block-based coding to text-based coding. Microsoft Small Basic. There are currently 47 user(s) online: Google. YouTube FaceBook Twitter RSS /. Microsoft Small Basic Alternatives for Mac. Microsoft Small Basic is not available for Mac but there are plenty of alternatives that runs on macOS with similar functionality. The best Mac alternative is Microsoft Visual Studio. It's not free, so if you're looking for a free alternative, you could try Eclipse or Apache NetBeans. If that doesn't.

Download Ubuntu desktop, Ubuntu Server, Ubuntu for Raspberry Pi and IoT devices, Ubuntu Core and all the Ubuntu flavours. Ubuntu is an open-source software platform that runs everywhere from the PC to the server and the cloud.

The LaTeX team cannot guarantee that TeX distributions, even recent ones, contain the most recent version of LaTeX. It may happen that you need a more recent LaTeX than the one that your favourite TeX distribution carries, e.g., in order to get a particular bug fix. In that case you will need to fetch LaTeX from CTAN and install it on top of your distribution. See below for details.

TeX Distributions

If you’re new to TeX and LaTeX or just want an easy installation, geta full TeX distribution. The TeX Users Group (TUG) has a list of notable distributionsthat are entirely, or least primarily, free software.

Linux

Check your Linux distributions software source for a TeX distribution including LaTeX. You can also install the current TeX Live distribution directly---in fact this may be advisable as many Linux distributions only contain older versions of TeX Live, see Linux TeX Live package status for details.

Mac OS

The MacTeX distribution contains everything you need, including a complete TeX system with LaTeX itself and editors to write documents.

Windows

Check out the MiKTeX or proTeXt or TeX Live distributions; they contain a complete TeX system with LaTeX itself and editors to write documents.

Online

LaTeX online services like Papeeria, Overleaf, ShareLaTeX, Datazar, and LaTeX base offer the ability to edit, view and download LaTeX files and resulting PDFs.

CTAN

Basic

You can obtain LaTeX from CTAN, which is theprimary source of distribution for LaTeX. In order for your downloadedLaTeX to be of any use, you have to obtain and set up a TeX systemfirst. You can either install a TeX distribution (see above) or get aTeX system from CTAN. Ifyou use a TeX distribution then it will include a version of LaTeX sothis will probably make things easier for you; but you may have areason not to do this.

The LaTeX Git Repository

These days the LaTeX development sources are kept in a GitHubrepository (previously we used SVN).

Anyone can access it and download the files, butsubmission is restricted to team members. The repository is located at https://github.com/latex3/latex2eand from that browser page you may explore the files, clone therepository or download the files in a .zip archive (roughly 25Mb) byusing the appropriate buttons.

If you are familiar with Git you can also clone the repository using thecommand line or your favorite Git fontend tool, e.g.,

which needs about 50Mb of space.Alternatively, you can do a Subversion checkout from the command line, e.g.,

which will just checkout the current files.But be aware that a SVN checkout of the form

will download all files including theirhistory (back to 2009) and amounts to roughly 1.4Gb so that is quite large.

Note: If you had bookmarked the old SVN repository please update thatbookmark to the new GIT repository as we have finally removed it.

A note on Git pull requests

Git repositories support distributed development and allow people toprovide change sets that are made available through so called pullrequests, so that the maintainers of a program can “pull the suggestedchanges” into the main repository.

While we appreciate contributions, we think that for the core LaTeXsoftware pull requests are usually not a good approach (unless thechange has be already discussed and agreed upon).The stability of LaTeX is very important and this means that changes tothe kernel are necessarily very conservative. It also means that a lotof discussion has to happen before any changes are made. So if you dodecide to post a pull request, please bear this in mind: we doappreciate ideas, but cannot always integrate them into the kernel andit is quite likely that we reject updates made in this way.

If you want to discuss a possible contribution before (or instead of)making a pull request, we suggest you raise the topic first onthe LATEX-L list or drop aline to the team.

Historic LaTeX

Ulrik Vieth has collected historic versions of LaTeX from LaTeX 2.0for TeX 1.0 (released on 11 December 1983) onwards. You can find thematftp://ftp.tug.org/historic/macros/latex-saildart/.There might even be some earlier versions. All files have been pulledfrom the SAILDART archive site at http://z.baumgart.org/ (no longeronline) which was based on archive tapes from SAIL at Stanford.

More historic material can be found at ftp://ftp.tug.org/historic (you may not be able to open this in all browsers — alternatively try https://www.math.utah.edu/pub/tex/historic/).

Small Basic can be run on Mac OS in a browser using the SIlverlight plug in. The Silverlight plug-in is supported by Safari and Firefox (browser for Mac OS X). Published Small Basic programs can be run in these browsers. Some fonts are common to both Mac and Windows such like Arial, Courier New, Times New Roman, Trebuchet MS and so on. Download SmallBASIC for free. SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for everyday calculations, scripts and prototypes.

The term BASIC, an acronym for Beginner's All-purpose Symbolic Instruction Code, actually describes a whole plethora ofcomputer languages, not all of which are actually compatible with each other. On many home computers, the earliestimplementations of the BASIC language was as a very simple line oriented interpreter. The simplicity of the original languagemade it easy for beginners to learn programming, giving rise to a whole generation of programmers who cut their teeth onthis language (although it must be said that the language's simplicity also led to a host of bad programming practicesas programmers tried to work around the language's limitations). Today, however, the language has grown very large and issplit into a number of different dialects (many of which bear little resemblance to the original BASIC language) andincludes support for many modern programming paradigms like structured programming (using functions or procedures) andobject-oriented programming, etc.

Listed on this page are some free BASIC compilers, interpreters, Visual Basic clones (and Visual Basic itself), anddevelopment environments (IDEs) which you can use to develop programs using the BASIC programming language. If youare looking for documentation or tutorials on learning or using the BASIC language, you may wish to search the selection ofBASIC programming booksat Amazon.com.

Related Pages

  • How to Make / Create a Website: The Beginner's A-Z Guide (start one for your software)

Free BASIC Compilers and Interpreters

Yabasic (Windows, Linux, Unix-like systems)

Yabasic, or Yet Another BASIC, is an open source BASIC interpreter for Windows, Linux and otherUnix-like systems. It does not have a built-in editor, so you will need to get aprogrammer's editor(or use the plain text editor that comes with your system, eg, Notepad on Windows). It featuresgoto, loops, named subroutines, libraries, graphics, printing, interfacing with libraries written in C,etc. The interpreter allows you to create standalone programs with it, by binding itself (ie, the interpreter)with your program source to form a single executable file. When the latter is run, the bound interpreter willautomatically execute the source that has been attached to it. Note: the above link points to theprogram's source code repository. To get the binary (ie, executable) Yabasic for your system, click the'www.yabasic.de' link on that page. (For those wondering why I did not simply link to it here:although the link says 'www.yabasic.de', it ultimately redirects to what appears to be a temporary website.I prefer to link to official sites rather than temporary ones that can, without notice, be deleted orreplaced by random third party sites.)

DarkBASIC Pro (Windows)

DarkBASIC Professional is an open source (though formerly commercial) BASIC implementation that supports astructured dialect of the BASIC language. It was designed as a game creation language, and supports themaking of 2D and 3D games using DirectX. It comes with an IDE and a debugger. It generates standaloneexecutables, which comprise your program, compiled into bytecode, and an interpreter. DarkBASIC islicensed under the MIT licence. You can download the executable package from thereleases page. The main pagewhich I linked to earlier only contains the source code, although it also links to a downloadable itemlabelled 'DarkPHYSICS'. There is no explicit explanation of what the latter does, but given its name,it sounds like a physics engine.

Microsoft Visual Studio (Windows)

For an individual programmer, Microsoft Visual Studio appears to include most of theimportant tools of its commercial cousins. You get the IDE, debugger, optimizing compiler of the full version,minus a few things in the editor, debugging and profiling facilities. With this suite, you can develop programs forthe desktop and mobile versions of Windows as well as Android. The software also comes with supportfor building programs with Visual Basic, C, C++, C#, F# and Python. At the time I wrote this, the site states thatVisual Studio Community is free for individual developers, open source projects, academic research, classroom learningand non-enterprise organizations with 5 or fewer users. Warning: the program requires thatyou sign in with a Microsoft account (which is free) to continue to use it beyond the evaluation periodof 30 days.

BaCon BASIC (Linux, macOS, *BSD)

Small Basic Microsoft

BaCon BASIC is a BASIC to C translator for Unix-based systems (like Linux, FreeBSD, macOS, etc), which means that it takes yourBASIC code and changes it into C source code. You will then need a C compilerto compile that code. At this time, the converter appears to be implemented using shell scripts, and you will need either theBASH or Korn shell to run it. (Note: if youare using Linux, chances are that youalready have BASH somewhere on your system. I'm not sure about the other systems, though.)

Vintage BASIC (Windows, Linux)

Vintage BASIC is an interpreter with a language that is close to Microsoft's BASIC version 2 as found in the Commodore 64. Itis 'informed by (but [does] not always stick to) the ANSI Minimal BASIC standard (ANSI X.360-1978)' (as noted in its user guide).You can enter your program using a normalprogrammer's / text editor. If you are nostalgicfor the old BASIC interpreters of bygone days, or simply want to learn to program in BASIC without having to master the event-driven,object-oriented and window/form-based programming metaphors present in many compilers today, this BASIC interpreter may interest you.The program works on Windows andLinux, and is open source.

Chipmunk BASIC Interpreter (Windows, macOS, Linux)

Chipmunk BASIC is a BASIC interpreter for macOS, Linux and Windows. There is also an older version forMac OS 9 Classic. The interpreter provides you a traditional BASIC command line interface where you can enter programsdirectly and execute them, although you can also use a text editor to write your program before passing it to theinterpreter.

Bas BASIC Interpreter (Unix)

Bas is a Unix-based BASIC interpreter that first tokenises your source code internally, resolving referencesto variables and jump targets, before running it. It supports certain BBC BASIC extensionslike procedures, local variables and 'better exception handling'. It is probably no longer beingmaintained any more.

Microsoft Small Basic (Windows)

Microsoft Small Basic (no relation to the other 'Small Basic' listed elsewhereon this Free Basic Compilers page) is a small language with about 15 or so keywords designed to making it easy and 'fun' for peoplelearning to write computer programs. It uses and creates programs for the .NET framework.(In case you think it is something like the old BASIC interpreters that you grew up with in the days ofDOS,CP/M and Apple II, it's not.) It comes with an IDEwith what Microsoft calls Intellisense (an autocomplete facility that gives suggestions how you can complete your keywords/function callsas you type) and context sensitive help.

FreeBASIC (Windows, Linux, DOS)

FreeBASIC is an open source (GNU GPL) BASIC compiler that is syntax compatible with QuickBASIC, QBASIC, PDS andVisual Basic for DOS. It generates 32-bit executables that run under Windows and DOS. At the time this was written, thecompiler is still very new, and has little documentation.

SDLBasic (Windows, Linux)

SDLBasic is a BASIC interpreter that integrates the WxBasic interpreter (see elsewhere on this page), theSDL graphics library, and a graphics engine, so that you can use it to write 2D games in BASIC.It is open source software, with the runtime engine licensed under the LGPL and the editor used in theIDE under Scintilla'slicence. It runs under Windows and Linux. Linux users can probably get it through theirdistribution'spackage manager (ie, the program that lets you install/uninstall software on the system).

QB64 (Windows, macOS, Linux)

This BASIC compiler aims to be 100% compatible with the QuickBasic 4.5 compiler and the QBasic interpreter, butbeing able to create executable files that will run on modern Windows, macOS andLinuxsystems. The language has also been extended to provide support for handlingTCP/IP (internet) connectionsand email, displaying graphic files, playing stereo sound and music files, using animation, displayingTrue Type fonts, handling mouse andgame controller input, integrating with C++,SDL and Windows API DLLs, etc. The compiler comes with its own IDE, although you can of course use some othereditor if you prefer.

ThinBasic Basic Interpreter (Windows)

ThinBasic is a BASIC interpreter for Windows that can be used to create and run BASIC applications on Windows as well as CGI scripts for a web serverrunning in Windows. It supports the addition of DLLs (called modules here) that provide additional functionality, such as the Crypto module which addscryptographic functions which you can call from your application,the SMTP, FTP, TCP modules which Internet-enables your applications,sound-playing modules, and so on.

PC-BASIC (Windows, macOS, Linux, Unix-like systems)

Microsoft Office Download For Mac

PC-BASIC is an interpreter for GW-BASIC, Advanced BASIC (BASICA or IBM BASIC from the old IBM PC computers),Catridge Basic (from the IBM PCJr) and Tandy 1000 GWBASIC. (For those of you who are born after that period, thosewere BASIC interpreters that came with or ran on computers from the 1980s or thereabouts. ) It emulates themost common hardware (video, audio, DOS disk drives, cassette tapes, serial and parallel ports, etc) at the time, canread and write binary data files created by the original GW-BASIC, and is able to run plain text, tokenisedand protected .BAS files. The interpreter/emulator is released under the GNU General Public License version 3.It runs on Windows, macOS, Linux and Unix-like systems.

GW-BASIC (source only)

Microsoft has released the source code for the 10 February 1983 version of GW-BASIC, a BASIC interpreterthat came with old versions ofMS-DOS(of which versions 1.25 and 2.0 are also open source). More details about this release can be foundin the blog post ofthe Microsoft developer who announced it. Note that this is just the source code. You will still needa compatible assemblerto produce a binary. (Yes, it was written in assembly language.) Unfortunately, information about the build environmenthistorically used appears to have been lost in the mists of time, but one commenter on the blog thinks that it was anIntel ASM86 assembler, based on comments embedded in the code. Important:if you are looking for a BASIC interpreter or compiler to learn BASIC programming, please try one of theother BASIC compilers or interpreters listed on this page, since they are more likely towork out-of-the-box on modern computers. This GW-BASIC release is meant for historical reference, and willprobably only interest the people who grew up with GW-BASIC (or its equivalent, BASICA) in the 1980s,and want to revisit it for nostalgic reasons.

Small Basic Download For Mac
Gambas - Gambas Almost Means Basic (Linux, *BSD)

Gambas is a Basic development environment supporting the Basic programming language with object extensions. It includes anIDE, a BASIC compiler, an interpreter,an archiver and a graphical user interface component. The archiver combines all the files in your project into a single executable file.Although not intended to be a Visual Basic clone, ithas a visual rapid application development interface like VB. Supported operating systems includeLinux andFreeBSD, OpenBSD.

Mono's VisualBasic.NET Compiler (Mono Visual Basic Compiler) (Linux, Windows)

Mono is an open source cross-platform implementation of Microsoft's .NET Development Framework.It includes a VB compiler (VB.NET compiler/Visual Basic compiler that generates .NET virtualmachine code, not native code) that was still under development at the time of this writing,a runtime for CLR (the Common Language Infrastructure) and a set of libraries. You can embedthe runtime into your applications. Mono currently works on Linux (both x86 and PPC), Windows,S390, with work being carried on for Strong/ARM and SPARC.

Decimal BASIC (Windows, macOS, Linux)

Download Microsoft Small Basic For Mac

Decimal BASIC supports the syntax and most of the core modules and the graphics module of the ANSI/ISO standard for Full BASIC.This BASIC interpreter includes a debugger that lets you step/trace through your program, set breakpoints andexamine the values held in your variables when it hits a breakpoint. Versions are available for Windows, macOS and Linux.There is also a BASIC to Object Pascaltranslator that runs on those systems.

GLBCC - GNU / Liberty Basic Compiler Collection (Windows, Linux)

The GNU Liberty Basic Compiler Collection allows Windows and Linux users to compile Liberty Basiccode on those platforms. Unlike the original Liberty Basic, this compiler creates standalone nativeexecutables that do not rely on an external interpreter. GNU / LibertyBasic is open source andlicensed under the GNU GPL and the GNU LGPL.

Download Microsoft Word For Mac Free

Just BASIC (Windows)

Just BASIC creates standalone programs from your BASIC source code. (I think it compiles to intermediate code whichis then executed by an interpreter.) It supports functions, subprograms, control structures like DO/LOOP and SELECT/CASE,has a GUI builder, supports sprite animation, sound and music, and comes with a source level debugger.

wxBasic (Windows, Linux)

wxBasic is a BASIC interpreter licensed under the GNU LGPL that runs on Windows and Linux.wxBasic code 'looks a lot like QBasic'. It has OpenGL support, among other things. This interpreter does notappear to be maintained any more.

SmallBASIC (Windows, Linux, N770/N800, PalmOS, eBookMan)

SmallBASIC is a language designed to handle mathematics and graphics. It includes trigonmetric, matrixand algebraic functions, system, sound and graphic commands, structured programming syntax, an IDE, etc.It works on Linux, Windows, Android, Nokia Internet Tablet, PalmOS and eBookMan. It is released under the GNU GPL.

MoonRock Compiler (DOS)

This Basic-like language with extensions produces executables (binaries) for MSDOS real-mode orDPMI protected mode. It comes with the ArrowSoft assembler, documentation andsample programs. It does not seem like it's being maintained any more.

Mole BASIC Interpreter (Linux, AIX, Sun, BSD)

Mole Basic, or Merty's Own Language Extension Basic, runs on Linux, AIX, Sun and BSD andcomes in (C?) source code form which you can modify to extend the language. Binariesfor Linux is also provided.

XBASIC BASIC Compiler (Windows, Linux)
For

This is a free BASIC compiler, integrated development environment, and debuggerthat runs on Windows, as well as Linux. You can actually write graphics and GUI programs that can be compiled by both theWindows and Linux versions without changing your source code.

Microsoft Word For Mac Student Download

Bywater BASIC Interpreter (source only)

This is a free BASIC interpreter that compiles and runs on Unix systems. It supports subsets of the ANSI Standardfor Minimal BASIC and the ANSI Standard for Full BASIC. It has been re-released under the GNU GPL (I think it wasin the public domain before) and supports MSDOS and POSIX systems (eg Unix, Linux, etc).

BCX BASIC Compiler (Windows)

Microsoft Small Basic

BCX is a Win32 console mode program that translates a BASIC source file into C source codewhich can be compiled using LCC-Win32 (see ourFree C/C++ Compilers page for more information about thisfree C compiler). It accepts a subset of modern BASIC, as well as extensions likeuser-defined functions and inline C code.

Basic4GL (Windows)

Basic4GL is a BASIC compiler for Windows with built-in OpenGL 1.1 support. It is also able to generate code foran Android phone or tablet (though you have to develop your programs on Windows first). It automatically handlesthings like initialising OpenGL, opening an OpenGL window, etc, allowing you to get straight into writing OpenGL code.The language has built-in support for vectors and matrices and you can perform mathematical operations on them(add, multiply) using vector and matrix notation algebra. Other features in Basic4GL include a 2D tile and sprite engine.The compiler generates intermediate code which is run by a virtual machine. The IDE comes with an integrated editor anddebugger.

TNT Basic (macOS)

[Update: the above link points to a blank page. I'm not sure if the site is dead, orthat there's a temporary misconfiguration of some sort. In any case, if it's really gone, there is alsoa source code repository for TNT Basic available, althoughthere are no downloadable executables there.]
TNT Basic is a BASIC interpreter for the Macintosh. It is geared towards programmers who are creating games for the Macintosh. Thedevelopment environment makes it easy for you to create and edit your code, add graphics and sprites to your program, sounds,music, maps, and define inputs for your game. TNT Basic works on Mac OS 8.6 and above (PowerPC Mac). At the time this briefreview was written, a beta version for macOS support is also available.

  • How to Register Your Own Domain Name - get one for your software
  • List of Web Hosts - put your software on the web

Small Basic Download For Mac Os

  • How to Register Your Own Domain Name - how to get your own domain name

It will appear on your page as:

GraphicsWindow.KeyDown = HandleKey
GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB( 253, 252, 251 )
While 'True'
BOXES = 4 ' number of boxes per piece
BWIDTH = 25 ' box width in pixels
XOFFSET = 40 ' Screen X offset in pixels of where the board starts
YOFFSET = 40 ' Screen Y offset in pixels of where the board starts
CWIDTH = 10 ' Canvas Width, in number of boxes
CHEIGHT = 20 ' Canvas Height, in number of boxes.
STARTDELAY = 800
ENDDELAY = 175
PREVIEW_xpos = 13
PREVIEW_ypos = 2
GraphicsWindow.Clear()
GraphicsWindow.Title = 'Small Basic Tetris'
GraphicsWindow.Height = 580
GraphicsWindow.Width = 700
GraphicsWindow.Show()
SetupTemplates()
SetupCanvas()
MainLoop()
GraphicsWindow.ShowMessage( 'Game Over', 'Small Basic Tetris' )
EndWhile
Sub MainLoop
template = Text.Append('template', Math.GetRandomNumber(7))
CreatePiece() ' in: template ret: h
nextPiece = h
end = 0
sessionDelay = STARTDELAY
While end = 0
If sessionDelay > ENDDELAY Then
sessionDelay = sessionDelay - 1
EndIf
delay = sessionDelay
thisPiece = nextPiece
template = Text.Append('template', Math.GetRandomNumber(7))
CreatePiece() ' in: template ret: h
nextPiece = h
DrawPreviewPiece()
h = thisPiece
ypos = 0
done = 0
xpos = 3 ' always drop from column 3
CheckStop() ' in: ypos, xpos, h ret: done
If done = 1 Then
ypos = ypos - 1
MovePiece() 'in: ypos, xpos, h
end = 1
EndIf
yposdelta = 0
While done = 0 Or yposdelta > 0
MovePiece() 'in: ypos, xpos, h
' Delay, but break if the delay get set to 0 if the piece gets dropped
delayIndex = delay
While delayIndex > 0 And delay > 0
Program.Delay(10)
delayIndex = delayIndex - 10
EndWhile
If yposdelta > 0 Then
yposdelta = yposdelta - 1 ' used to create freespin, when the piece is rotated
Else
ypos = ypos + 1 ' otherwise, move the piece down.
EndIf
' Check if the piece should stop.
CheckStop() ' in: ypos, xpos, h ret: done
EndWhile
EndWhile
EndSub
Sub HandleKey
' Stop game
If GraphicsWindow.LastKey = 'Escape' Then
Program.End()
EndIf
' Move piece left
If GraphicsWindow.LastKey = 'Left' Then
moveDirection = -1
ValidateMove() ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 if move is invalid, otherwise 0
If invalidMove = 0 Then
xpos = xpos + moveDirection
EndIf
MovePiece() 'in: ypos, xpos, h
EndIf
' Move piece right
If GraphicsWindow.LastKey = 'Right' Then
moveDirection = 1
ValidateMove() ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 if move is invalid, otherwise 0
If invalidMove = 0 Then
xpos = xpos + moveDirection
EndIf
MovePiece() 'in: ypos, xpos, h
EndIf
' Move piece down
If GraphicsWindow.LastKey = 'Down' or GraphicsWindow.LastKey = 'Space' Then
delay = 0
EndIf
' Rotate piece
If GraphicsWindow.LastKey = 'Up' Then
basetemplate = Array.GetValue(h, -1) ' Array.GetValue(h, -1) = the template name
template = 'temptemplate'
rotation = 'CW'
CopyPiece() 'in basetemplate, template, rotation
Array.SetValue(h, -1, template) ' Array.GetValue(h, -1) = the template name
moveDirection = 0
ValidateMove() ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 if move is invalid, otherwise 0
' See if it can be moved so that it will rotate.
xposbk = xpos
yposdelta = 0
While yposdelta = 0 And Math.Abs(xposbk - xpos) < 3 ' move up to 3 times only
' if the rotation move worked, copy the temp to 'rotatedtemplate' and use that from now on
If invalidMove = 0 Then
basetemplate = template
template = 'rotatedtemplate'
Array.SetValue(h, -1, template) ' Array.GetValue(h, -1) = the template name
rotation = 'COPY'
CopyPiece() 'in basetemplate, template, rotation
yposdelta = 1 ' Don't move down if we rotate
MovePiece() 'in: ypos, xpos, h
ElseIf invalidMove = 2 Then
' Don't support shifting piece when hitting another piece to the right or left.
xpos = 99 ' exit the loop
Else
' if the rotated piece can't be placed, move it left or right and try again.
xpos = xpos - invalidMove
ValidateMove() ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 if move is invalid, otherwise 0
EndIf
EndWhile
If invalidMove <> 0 Then
xpos = xposbk
Array.SetValue(h, -1, basetemplate) ' Array.GetValue(h, -1) = the template name
template = '
EndIf
EndIf
EndSub
Sub DrawPreviewPiece
xpos = PREVIEW_xpos
ypos = PREVIEW_ypos
h = nextPiece
XOFFSETBK = XOFFSET
YOFFSETBK = YOFFSET
XOFFSET = XOFFSET + Array.GetValue(Array.GetValue(h, -1), 'pviewx') ' Array.GetValue(h, -1) = the template name
YOFFSET = YOFFSET + Array.GetValue(Array.GetValue(h, -1), 'pviewy') ' Array.GetValue(h, -1) = the template name
MovePiece() 'in: ypos, xpos, h
XOFFSET = XOFFSETBK
YOFFSET = YOFFSETBK
EndSub
' creates template that's a rotated basetemplate
Sub CopyPiece 'in basetemplate, template, rotation
L = Array.GetValue(basetemplate, 'dim')
If rotation = 'CW' Then
For i = 0 to BOXES - 1 ' x' = y y' = L - 1 - x
v = Array.GetValue(basetemplate, i)
'x = Math.Floor(v/10)
'y = Math.Remainder(v, 10)
' new x and y
x = (Math.Remainder(v, 10))
y = (L - 1 - Math.Floor(v/10))
Array.SetValue(template, i, x * 10 + y)
EndFor
' Count-Cockwise is not currently used
ElseIf rotation = 'CCW' Then
For i = 0 to BOXES - 1 ' x' = L - 1 - y y' = x
v = Array.GetValue(basetemplate, i)
'x = Math.Floor(v/10)
'y = Math.Remainder(v, 10)
' new x and y
x = (L - 1 - Math.Remainder(v, 10))
y = Math.Floor(v/10)
Array.SetValue(template, i, x * 10 + y)
EndFor
ElseIf rotation = 'COPY' Then
For i = 0 to BOXES - 1
Array.SetValue(template, i, Array.GetValue(basetemplate, i))
EndFor
Else
GraphicsWindow.ShowMessage('invalid parameter', 'Error')
Program.End()
EndIf
' Copy the remain properties from basetemplate to template.
Array.SetValue(template, 'color', Array.GetValue(basetemplate, 'color'))
Array.SetValue(template, 'dim', Array.GetValue(basetemplate, 'dim'))
Array.SetValue(template, 'pviewx', Array.GetValue(basetemplate, 'pviewx'))
Array.SetValue(template, 'pviewy', Array.GetValue(basetemplate, 'pviewy'))
EndSub
Sub CreatePiece ' in: template ret: h
' Create a new handle, representing an arrayName, that will represent the piece
hcount = hcount + 1
h = Text.Append('piece', hcount)
Array.SetValue(h, -1, template) ' Array.GetValue(h, -1) = the template name
GraphicsWindow.PenWidth = 1
GraphicsWindow.PenColor = 'Black'
GraphicsWindow.BrushColor = Array.GetValue(template, 'color')
For i = 0 to BOXES - 1
s = Shapes.AddRectangle(BWIDTH, BWIDTH)
Shapes.Move(s, -BWIDTH, -BWIDTH) ' move off screen
Array.SetValue(h, i, s)
EndFor
EndSub
Sub MovePiece 'in: ypos, xpos, h. ypos/xpos is 0-19, representing the top/left box coordinate of the piece on the canvas. h returned by CreatePiece
For i = 0 to BOXES - 1
v = Array.GetValue(Array.GetValue(h, -1), i) ' Array.GetValue(h, -1) = the template name
x = Math.Floor(v/10)
y = Math.Remainder(v, 10)
' Array.GetValue(h, i) = box for piece h.
' xpos/ypos = are topleft of shape. x/y is the box offset within the shape.
Shapes.Move(Array.GetValue(h, i), XOFFSET + xpos * BWIDTH + x * BWIDTH, YOFFSET + ypos * BWIDTH + y * BWIDTH)
EndFor
EndSub
Sub ValidateMove ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 if move is invalid, otherwise 0
i = 0
invalidMove = 0
While i < BOXES
v = Array.GetValue(Array.GetValue(h, -1), i) ' Array.GetValue(h, -1) = the template name
'x/y is the box offset within the shape.
x = Math.Floor(v/10)
y = Math.Remainder(v, 10)
If (x + xpos + moveDirection) < 0 Then
invalidMove = -1
i = BOXES ' force getting out of the loop
EndIf
If (x + xpos + moveDirection) >= CWIDTH Then
invalidMove = 1
i = BOXES ' force getting out of the loop
EndIf
If Array.GetValue('c', (x + xpos + moveDirection) + (y + ypos) * CWIDTH) <> '.' Then
invalidMove = 2
i = BOXES ' force getting out of the loop
EndIf
i = i + 1
EndWhile
EndSub
Sub CheckStop ' in: ypos, xpos, h ret: done
done = 0
i = 0
While i < BOXES
v = Array.GetValue(Array.GetValue(h, -1), i) ' Array.GetValue(h, -1) = the template name
'x/y is the box offset within the shape.
x = Math.Floor(v/10)
y = Math.Remainder(v, 10)
If y + ypos > CHEIGHT Or Array.GetValue('c', (x + xpos) + (y + ypos) * CWIDTH) <> '.' Then
done = 1
i = BOXES ' force getting out of the loop
EndIf
i = i + 1
EndWhile
' If we need to stop the piece, move the box handles to the canvas
If done = 1 Then
For i = 0 to BOXES - 1
v = Array.GetValue(Array.GetValue(h, -1), i) ' Array.GetValue(h, -1) = the template name
'x = Math.Floor(v/10)
'y = Math.Remainder(v, 10)
Array.SetValue('c', (Math.Floor(v/10) + xpos) + (Math.Remainder(v, 10) + ypos - 1) * CWIDTH, Array.GetValue(h, i))
EndFor
' 1 points for every piece successfully dropped
score = score + 1
PrintScore()
' Delete clared lines
DeleteLines()
EndIf
EndSub
Sub DeleteLines
linesCleared = 0
' Iterate over each row, starting from the bottom
For y = CHEIGHT - 1 to 0 Step -1
' Check to see if the whole row is filled
x = CWIDTH
While x = CWIDTH
x = 0
While x < CWIDTH
piece = Array.GetValue('c', x + y * CWIDTH)
If piece = '.' then
x = CWIDTH
EndIf
x = x + 1
EndWhile
' if non of them were empty (i.e '.'), then remove the line.
If x = CWIDTH Then
' Delete the line
For x1 = 0 to CWIDTH - 1
Shapes.Remove(Array.GetValue('c', x1 + y * CWIDTH))
EndFor
linesCleared = linesCleared + 1
' Move everything else down one.
For y1 = y To 1 Step -1
For x1 = 0 to CWIDTH - 1
piece = Array.GetValue('c', x1 + (y1 - 1) * CWIDTH)
Array.SetValue('c', x1 + y1 * CWIDTH, piece)
Shapes.Move(piece, Shapes.GetLeft(piece), Shapes.GetTop(piece) + BWIDTH)
EndFor
EndFor
EndIf
EndWhile
EndFor
If linesCleared > 0 Then
score = score + 100 * Math.Round(linesCleared * 2.15 - 1)
PrintScore()
EndIf
EndSub
Sub SetupCanvas
' GraphicsWindow.DrawResizedImage( Flickr.GetRandomPicture( 'bricks' ), 0, 0, GraphicsWindow.Width, GraphicsWindow.Height)
GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor
GraphicsWindow.FillRectangle(XOFFSET, YOFFSET, CWIDTH*BWIDTH, CHEIGHT*BWIDTH)
Program.Delay(200)
GraphicsWindow.PenWidth = 1
GraphicsWindow.PenColor = 'Pink'
For x = 0 To CWIDTH-1
For y = 0 To CHEIGHT-1
Array.SetValue('c', x + y * CWIDTH, '.') ' '.' indicates spot is free
GraphicsWindow.DrawRectangle(XOFFSET + x * BWIDTH, YOFFSET + y * BWIDTH, BWIDTH, BWIDTH)
EndFor
EndFor
GraphicsWindow.PenWidth = 4
GraphicsWindow.PenColor = 'Black'
GraphicsWindow.DrawLine(XOFFSET, YOFFSET, XOFFSET, YOFFSET + CHEIGHT*BWIDTH)
GraphicsWindow.DrawLine(XOFFSET + CWIDTH*BWIDTH, YOFFSET, XOFFSET + CWIDTH*BWIDTH, YOFFSET + CHEIGHT*BWIDTH)
GraphicsWindow.DrawLine(XOFFSET, YOFFSET + CHEIGHT*BWIDTH, XOFFSET + CWIDTH*BWIDTH, YOFFSET + CHEIGHT*BWIDTH)
GraphicsWindow.PenColor = 'Lime'
GraphicsWindow.DrawLine(XOFFSET - 4, YOFFSET, XOFFSET - 4, YOFFSET + CHEIGHT*BWIDTH + 6)
GraphicsWindow.DrawLine(XOFFSET + CWIDTH*BWIDTH + 4, YOFFSET, XOFFSET + CWIDTH*BWIDTH + 4, YOFFSET + CHEIGHT*BWIDTH + 6)
GraphicsWindow.DrawLine(XOFFSET - 4, YOFFSET + CHEIGHT*BWIDTH + 4, XOFFSET + CWIDTH*BWIDTH + 4, YOFFSET + CHEIGHT*BWIDTH + 4)
GraphicsWindow.PenColor = 'Black'
GraphicsWindow.BrushColor = 'Pink'
x = XOFFSET + PREVIEW_xpos * BWIDTH - BWIDTH
y = YOFFSET + PREVIEW_ypos * BWIDTH - BWIDTH
GraphicsWindow.FillRectangle(x, y, BWIDTH * 5, BWIDTH * 6)
GraphicsWindow.DrawRectangle(x, y, BWIDTH * 5, BWIDTH * 6)
GraphicsWindow.FillRectangle(x - 20, y + 190, 310, 170)
GraphicsWindow.DrawRectangle(x - 20, y + 190, 310, 170)
GraphicsWindow.BrushColor = 'Black'
GraphicsWindow.FontItalic = 'False'
GraphicsWindow.FontName = 'Comic Sans MS'
GraphicsWindow.FontSize = 16
GraphicsWindow.DrawText(x, y + 200, 'Game control keys:')
GraphicsWindow.DrawText(x + 25, y + 220, 'Left Arrow = Move piece left')
GraphicsWindow.DrawText(x + 25, y + 240, 'Right Arrow = Move piece right')
GraphicsWindow.DrawText(x + 25, y + 260, 'Up Arrow = Rotate piece')
GraphicsWindow.DrawText(x + 25, y + 280, 'Down Arrow = Drop piece')
GraphicsWindow.DrawText(x, y + 320, 'Press to stop game')
Program.Delay(200) ' without this delay, the above text will use the fontsize of the score
GraphicsWindow.BrushColor = 'Black'
GraphicsWindow.FontName = 'Georgia'
GraphicsWindow.FontItalic = 'True'
GraphicsWindow.FontSize = 36
GraphicsWindow.DrawText(x - 20, y + 400, 'Small Basic Tetris')
Program.Delay(200) ' without this delay, the above text will use the fontsize of the score
GraphicsWindow.FontSize = 16
GraphicsWindow.DrawText(x - 20, y + 440, 'ver.0.1')
Program.Delay(200) ' without this delay, the above text will use the fontsize of the score
score = 0
PrintScore()
EndSub
Sub PrintScore
GraphicsWindow.PenWidth = 4
GraphicsWindow.BrushColor = 'Pink'
GraphicsWindow.FillRectangle(500, 65, 153, 50)
GraphicsWindow.BrushColor = 'Black'
GraphicsWindow.DrawRectangle(500, 65, 153, 50)
GraphicsWindow.FontItalic = 'False'
GraphicsWindow.FontSize = 32
GraphicsWindow.FontName = 'Impact'
GraphicsWindow.BrushColor = 'Black'
GraphicsWindow.DrawText(505, 70, Text.Append(Text.GetSubText( '00000000', 0, 8 - Text.GetLength( score ) ), score))
EndSub
Sub SetupTemplates
' each piece has 4 boxes.
' the index of each entry within a piece represents the box number (1-4)
' the value of each entry represents to box zero-based box coordinate within the piece: tens place is x, ones place y
'_X_
'_X_
'_XX
Array.SetValue('template1', 0, 10)
Array.SetValue('template1', 1, 11)
Array.SetValue('template1', 2, 12)
Array.SetValue('template1', 3, 22)
Array.SetValue('template1', 'color', 'Yellow')
Array.SetValue('template1', 'dim', 3)
Array.SetValue('template1', 'pviewx', -12)
Array.SetValue('template1', 'pviewy', 12)
'_X_
'_X_
'XX_
Array.SetValue('template2', 0, 10)
Array.SetValue('template2', 1, 11)
Array.SetValue('template2', 2, 12)
Array.SetValue('template2', 3, 02)
Array.SetValue('template2', 'color', 'Magenta')
Array.SetValue('template2', 'dim', 3)
Array.SetValue('template2', 'pviewx', 12)
Array.SetValue('template2', 'pviewy', 12)
'_X_
'XXX
'_
Array.SetValue('template3', 0, 10)
Array.SetValue('template3', 1, 01)
Array.SetValue('template3', 2, 11)
Array.SetValue('template3', 3, 21)
Array.SetValue('template3', 'color', 'Gray')
Array.SetValue('template3', 'dim', 3)
Array.SetValue('template3', 'pviewx', 0)
Array.SetValue('template3', 'pviewy', 25)
'XX_
'XX_
'_
Array.SetValue('template4', 0, 00)
Array.SetValue('template4', 1, 10)
Array.SetValue('template4', 2, 01)
Array.SetValue('template4', 3, 11)
Array.SetValue('template4', 'color', 'Cyan')
Array.SetValue('template4', 'dim', 2)
Array.SetValue('template4', 'pviewx', 12)
Array.SetValue('template4', 'pviewy', 25)
'XX_
'_XX
'_
Array.SetValue('template5', 0, 00)
Array.SetValue('template5', 1, 10)
Array.SetValue('template5', 2, 11)
Array.SetValue('template5', 3, 21)
Array.SetValue('template5', 'color', 'Green')
Array.SetValue('template5', 'dim', 3)
Array.SetValue('template5', 'pviewx', 0)
Array.SetValue('template5', 'pviewy', 25)
'_XX
'XX_
'_
Array.SetValue('template6', 0, 10)
Array.SetValue('template6', 1, 20)
Array.SetValue('template6', 2, 01)
Array.SetValue('template6', 3, 11)
Array.SetValue('template6', 'color', 'Blue')
Array.SetValue('template6', 'dim', 3)
Array.SetValue('template6', 'pviewx', 0)
Array.SetValue('template6', 'pviewy', 25)
'_X
'_X
'_X
'_X
Array.SetValue('template7', 0, 10)
Array.SetValue('template7', 1, 11)
Array.SetValue('template7', 2, 12)
Array.SetValue('template7', 3, 13)
Array.SetValue('template7', 'color', 'Red')
Array.SetValue('template7', 'dim', 4)
Array.SetValue('template7', 'pviewx', 0)
Array.SetValue('template7', 'pviewy', 0)
EndSub