3.9 KiB
How to run the games
The games in this repository have been translated into a number of different languages. How to run them depends on the target language.
csharp
dotnet command-line
The best cross-platform method for running the csharp examples is with the dotnet command-line tool. This can be downloaded for MacOS, Windows and Linux from dotnet.microsoft.com.
From there, the program can be run by
- Opening a terminal window
- Navigating to the corresponding directory
- Starting with
dotnet run
Visual Studio
Alternatively, for non-dotnet compatible translations, you will need Visual Studio which can be used to both open the project and run the example.
- Open the corresponding
.csprojor.slnfile - Click
Runfrom within the Visual Studio IDE
java
TIP: You can build all the java and kotlin games at once using the instructions in the buildJvm directory
The Java translations can be run via the command line or from an IDE such as Eclipse or IntelliJ
To run from the command line, you will need a Java SDK (eg. Oracle JDK or Open JDK).
- Navigate to the corresponding directory.
- Compile the program with
javac:- eg.
javac AceyDuceyGame.java
- eg.
- Run the compiled program with
java:- eg.
java AceyDuceyGame
- eg.
or if you are using JDK11 or later you can now execute a self contained java file that has a main method directly with java <filename>.java.
javascript
The javascript examples can be run from within your web browser:
- Simply open the corresponding
.htmlfile from your web browser.
kotlin
Use the directions in buildJvm to build for kotlin. You can also use those directions to build java games.
pascal
The pascal examples can be run using Free Pascal. Additionally, .lsi project files can be opened with the Lazarus Project IDE.
The pascal examples include both simple (single-file) and object-oriented (in the /object-pascaldirectories) examples.
- You can compile the program from the command line with the
fpccommand.- eg.
fpc amazing.pas
- eg.
- The output is an executable file that can be run directly.
perl
The perl translations can be run using a perl interpreter (a copy can be downloaded from perl.org) if not already installed.
- From the command-line, navigate to the corresponding directory.
- Invoke with the
perlcommand.- eg.
perl aceyducey.pl
- eg.
python
The python translations can be run from the command line by using the py interpreter. If not already installed, a copy can be downloaded from python.org for Windows, MacOS and Linux.
- From the command-line, navigate to the corresponding directory.
- Invoke with the
pyorpythoninterpreter (depending on your python version).- eg.
py acey_ducey_oo.py - eg.
python aceyducey.py
- eg.
Note
Some translations include multiple versions for python, such as acey ducey which features versions for Python 2 (aceyducey.py) and Python 3 (acey_ducey.py) as well as an extra object-oriented version (acey_ducey_oo.py).
You can manage and use different versions of python with pip.
ruby
If you don't already have a ruby interpreter, you can download it from the ruby project site.
- From the command-line, navigate to the corresponding directory.
- Invoke with the
rubytool.- eg.
ruby aceyducey.rb
- eg.
vbnet
Follow the same steps as for the csharp translations. This can be run with dotnet or Visual Studio.