Code Monkey home page Code Monkey logo

coding-horror / basic-computer-games Goto Github PK

View Code? Open in Web Editor NEW
10.8K 161.0 1.3K 76.28 MB

An updated version of the classic "Basic Computer Games" book, with well-written examples in a variety of common MEMORY SAFE, SCRIPTING programming languages. See https://coding-horror.github.io/basic-computer-games/

License: The Unlicense

C# 18.87% Python 11.26% HTML 0.74% JavaScript 15.62% Perl 8.33% Java 14.76% Ruby 3.29% Pascal 0.49% BASIC 12.38% Visual Basic .NET 1.18% C 0.77% Kotlin 1.09% D 0.55% Rust 7.94% Go 1.41% Lua 0.81% CSS 0.07% Elm 0.34% Shell 0.05% C++ 0.06%
basic-computer-games classic-game basic

basic-computer-games's Introduction

What are we doing?

We’re updating the first million selling computer book, BASIC Computer Games, for 2022 and beyond!

Where can we discuss it?

Please see the discussion here for a worklog and conversation around this project.

Project structure

I have moved all the original BASIC source code into a folder for each project in the original book (first volume). Note that Lyle Kopnicky has generously normalized all the code (thanks Lyle!) to run against Vintage Basic circa 2009:

I’ve included all the games here for your tinkering pleasure. I’ve tested and tweaked each one of them to make sure they’ll run with Vintage BASIC, though you may see a few oddities. That’s part of the fun of playing with BASIC: it never works quite the same on two machines. The games will play better if you keep CAPS LOCK on, as they were designed to be used with capital-letter input.

Each project has subfolders corresponding to the languages we’d like to see the games ported to. This is based on the 2022 TIOBE index of top languages that are memory safe and general purpose scripting languages per this post:

  1. C#
  2. Java
  3. JavaScript
  4. Kotlin
  5. Lua
  6. Perl
  7. Python
  8. Ruby
  9. Rust
  10. VB.NET

📢 Note that in March 2022 we removed Pascal / Object Pascal and replaced it with Rust as we couldn’t determine if Pascal is effectively memory safe. We’ve also added Lua, as it made the top 20 in TIOBE (as of 2022) and it is both memory safe and a scripting language. The Pascal ports were moved to the alternate languages folder.

⚠️ Please note that we have decided, as a project, that we do not want any IDE-specific or build-specific files in the repository. Please refrain from committing any files to the repository that only exist to work with a specific IDE or a specific build system.

Alternate Languages

If you wish to port one of the programs to a language not in our list – that is, a language which is either not memory safe, or not a general purpose scripting language, you can do so via the 00_Alternate_Languages folder. Place your port in the appropriate game subfolder, in a subfolder named for the language. Please note that these ports are appreciated, but they will not count toward the donation total at the end of the project.

Project goals

Feel free to begin converting these classic games into the above list of modern, memory safe languages. In fact, courtesy of @mojoaxel, you can even view the JavaScript versions in your web browser at

https://coding-horror.github.io/basic-computer-games/

But first, a few guidelines:

  • These are very old games. They date from the mid-70s so they’re not exactly examples of what kids (or anyone, really?) would be playing these days. Consider them more like classic programming exercises to teach programming. We’re paying it forward by converting them into modern languages, so the next generation can learn from the programs in this classic book – and compare implementations across common modern languages.

  • Stay true to the original program. These are mostly unsophisticated, simple command line / console games, so we should strive to replicate the command line / console output and behavior illustrated in the original book. See the README in the project folder for links to the original scanned source input and output. Try running the game in your browser. Avoid the impulse to add features; keep it simple, except for modern conventions, see next item 👇

  • Please DO update for modern coding conventions. Support uppercase and lowercase. Use structured programming. Use subroutines. Try to be an example of good, modern coding practices!

  • Use lots of comments to explain what is going on. Comment liberally! If there were clever tricks in the original code, decompose those tricks into simpler (even if more verbose) code, and use comments to explain what’s happening and why. If there is something particularly tricky about a program, edit the Porting Notes section of the readme.md to let everyone know. Those GOTOs can be very pesky..

  • Please don’t get too fancy. Definitely use the most recent versions and features of the target language, but also try to keep the code samples simple and explainable – the goal is to teach programming in the target language, not necessarily demonstrate the cleverest one-line tricks, or big system "enterprise" coding techniques designed for thousands of lines of code.

  • Please don't check in any build specific or IDE specific files. We want the repository to be simple and clean, so we have ruled out including any IDE or build system specific files from the repository. Git related files are OK, as we are using Git and this is GitHub. 😉

Emulation and Bugfixes

We want the general behavior of the original programs to be preserved, however, we also want to update them, specifically:

  • allow both UPPERCASE and lowercase input and display
  • incorporate any bugfixes to the original programs; see the readme.md in the game folder
  • improved error handling for bad or erroneous input

Please note that on the back of the Basic Computer Games book it says Microsoft 8K Basic, Rev 4.0 was the version David Ahl used to test, so that is the level of compatibility we are looking for.  QBasic on the DOS emulation is a later version of Basic but one that retains downwards compatibility so far in our testing. To verify behavior, try running the programs in your browser with JS BASIC, effectively Applesoft BASIC.

Have fun!

Thank you for taking part in this project to update a classic programming book – one of the most influential programming books in computing history – for 2022 and beyond!

NOTE: per the official blog post announcement, I will be donating $5 for each contributed program in the 10 agreed upon languages to Girls Who Code.

Current Progress

toggle for game by language table
Name csharp java javascript kotlin lua perl python ruby rust vbnet
01_Acey_Ducey x x x x x x x x x x
02_Amazing x x x x x x x x
03_Animal x x x x x x x x x x
04_Awari x x x x x x x x
05_Bagels x x x x x x x x x x
06_Banner x x x x x x x x
07_Basketball x x x x x x x
08_Batnum x x x x x x x x
09_Battle x x x x x x
10_Blackjack x x x x x x x
11_Bombardment x x x x x x x x
12_Bombs_Away x x x x x x x
13_Bounce x x x x x x x
14_Bowling x x x x x x
15_Boxing x x x x x x
16_Bug x x x x x x
17_Bullfight x x x x x
18_Bullseye x x x x x x x
19_Bunny x x x x x x x
20_Buzzword x x x x x x x x x
21_Calendar x x x x x x x x
22_Change x x x x x x x
23_Checkers x x x x x x
24_Chemist x x x x x x x
25_Chief x x x x x x x x
26_Chomp x x x x x x
27_Civil_War x x x x x
28_Combat x x x x x x
29_Craps x x x x x x x x x
30_Cube x x x x x x x
31_Depth_Charge x x x x x x x
32_Diamond x x x x x x x x x
33_Dice x x x x x x x x x
34_Digits x x x x x x
35_Even_Wins x x x x x x
36_Flip_Flop x x x x x x x x
37_Football x x x x
38_Fur_Trader x x x x x x
39_Golf x x x x
40_Gomoko x x x x x x
41_Guess x x x x x x x x
42_Gunner x x x x x x
43_Hammurabi x x x x x
44_Hangman x x x x x x x
45_Hello x x x x x x x x
46_Hexapawn x x x
47_Hi-Lo x x x x x x x x x
48_High_IQ x x x x x
49_Hockey x x x x
50_Horserace x x x x
51_Hurkle x x x x x x x x
52_Kinema x x x x x x x
53_King x x x x x
54_Letter x x x x x x x x
55_Life x x x x x x x x
56_Life_for_Two x x x x x x
57_Literature_Quiz x x x x x x x
58_Love x x x x x x x
59_Lunar_LEM_Rocket x x x x x
60_Mastermind x x x x x x x
61_Math_Dice x x x x x x x x
62_Mugwump x x x x x x x
63_Name x x x x x x x x
64_Nicomachus x x x x x x x
65_Nim x x x x x x
66_Number x x x x x x x
67_One_Check x x x x x x
68_Orbit x x x x x x x x
69_Pizza x x x x x x x
70_Poetry x x x x x x x
71_Poker x x x x
72_Queen x x x x x x
73_Reverse x x x x x x x
74_Rock_Scissors_Paper x x x x x x x x x
75_Roulette x x x x x x x
76_Russian_Roulette x x x x x x x x x
77_Salvo x x x x
78_Sine_Wave x x x x x x x x x
79_Slalom x x x x
80_Slots x x x x x x x
81_Splat x x x x x x x
82_Stars x x x x x x x x
83_Stock_Market x x x x x
84_Super_Star_Trek x x x x x x
85_Synonym x x x x x x x
86_Target x x x x x x
87_3-D_Plot x x x x x x x
88_3-D_Tic-Tac-Toe x x x x
89_Tic-Tac-Toe x x x x x x x x
90_Tower x x x x x x x
91_Train x x x x x x x x
92_Trap x x x x x x x x
93_23_Matches x x x x x x x x
94_War x x x x x x x x x
95_Weekday x x x x x x x
96_Word x x x x x x x x

basic-computer-games's People

Contributors

aldrinm avatar anthonymichaeltdm avatar breedx2 avatar chinhouse avatar chrispritchard avatar coding-horror avatar danielpiron avatar darrencardenas avatar dave-burke avatar drew-cooper avatar drewjcooper avatar dyegomaas avatar havoclad avatar jnellis avatar joestrout avatar journich avatar kstolen0 avatar littletealeaf avatar martinthoma avatar nanochess avatar nezumironin avatar pcholt avatar pczajkowski avatar poblish avatar qequ avatar rbamforth avatar stevebosman avatar tsmaster avatar ugurkupeli avatar zspitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

basic-computer-games's Issues

JavaScript rendering target

More a question than an Issue - do we have opinions on the rendering target (and template for it) of JavaScript implementations?

I saw a few solutions in here that appear to render text into the browser on a simple HTML page (example https://github.com/coding-horror/basic-computer-games/blob/main/73%20Reverse/javascript/reverse.js#L8 ).

Conversely the language selection process (https://discourse.codinghorror.com/t/updating-101-basic-computer-games-for-2021/7927/34) included the determination if a language is "scripting appropriate" by "running on the command line", which is true for JS, if you run it against #!/usr/bin/env node.

So I am thinking either
a) don't render it into the browser, but write ES6 for the command line OR
b) we come up with some sort of template for how interacting with the browser should work.

Thoughts?

BASIC compiler for Linux

Anyone knows a BASIC compiler working on Linux? I couldn't find any compiler working to run the .bas files

[Suggestion] Add instructions for running projects

Since this is geared towards beginners/people learning new languages, a nice idea might be to add instructions on how to actually run the examples.

This could possibly work best at a global level, to avoid too much unnecessary repetition.

Java version of Animal does not work

It is using the list of questions as a pure list instead of a tree. So the questions will continue, instead of terminate:
THINK OF AN ANIMAL AND THE COMPUTER WILL TRY TO GUESS IT.
ARE YOU THINKING OF AN ANIMAL ? Y
DOES IT SWIM ? N
IS IT A BIRD ? N
THE ANIMAL YOU WERE THINKING OF WAS A DOG
PLEASE TYPE IN A QUESTION THAT WOULD DISTINGUISH A DOG FROM A BIRD DOES IT FLY
FOR A DOG THE ANSWER WOULD BE N
ARE YOU THINKING OF AN ANIMAL ? Y
DOES IT SWIM ? Y
IS IT A FISH ? N
DOES IT FLY ?

The "DOES IT FLY" should not appear.

95 Weekday: Handles 1582 dates incorrectly

The following line in the original code leads to an error if dates before 1582 are supplied (which is fine)
290 IF Y-1582 <0 THEN 1300

However it means the day of week calculation is performed on days in 1582, but before 15 October 1582 (the date the Gregorian calendar started).

I think the test should be changed to check that the supplied date is on or after 15 October 1582.

Bug in King.bas

I think I've found a bug in the incredibly difficult game "King".

Variable A is tracking the amount of money the player has, and V3 seems to be recording the previous turn's tourist income. In any case, on line 170 and 171, we find these two lines

1450 V3=INT(A+V3)
1451 A=INT(A+V3)

So... if V3 begins as zero, the player doubles their money?

I think this is solved by changing the code in line 170

1450 V3=INT(ABS(V1-V2))

Maybe the original typist made a mistake by repeating the expression from line 171 in line 170?

Which Python version should I use?

There was already a bit of discussion on the Python version to use for this project. I would be happy if we could find a general rule for the whole project.

Important Facts

Which Python versions are still officially supported? 3.7, 3.8, 3.9, 3.10. 3.6 no longer receives security updates and 3.11 is not stable jet.

What do people run? Using pyenv it's pretty easy to switch between Python versions. However, for beginners it might not be so easy. They might use whatever their system has installed. For Ubuntu 20.04, the default Python 3 version is 3.8 (link)

My article Killer Features by Python version lists a few more, but those are the ones I think are interesting for this project:

  • 3.7: Dataclasses
  • 3.8: f-strings❗❗, TypedDict,
  • 3.9: -
  • 3.10: structural pattern matching - we have one project that (79 slalom)

Proposal

My proposal would be the following:

  1. Try to keep code runnable on Python 3.8+ to make it easy for people to run.
  2. If the original author makes use of a feature like structural pattern matching, the support for older Python versions can be dropped, but it must be clearly stated in the README that this is Python 3.10 only (or similar)
  3. PRs which just would adjust existing code and remove support for Python 3.8 / Python 3.9 would be declined, if the new version is not noticably simpler to understand.

Thus CI should support 3.10 so that people are free to use it.

US and/or metric units?

I noticed that the units used are miles/hour, ft/sec^2, which makes perfect/no sense depending on where you grow up. Should we keep these to be true to the original or should we try to cater to both worlds?

I can't say I remember this as a problem as a kid but anyway : )

Removing spaces from the directory names.

As someone who uses Unix-style command-line tools a lot, I find that spaces in file paths tend to make filename completion and basic scripting harder. This is not a real impediment, just a persistent low-grade annoyance. That being said, it's trivial to rename the directories to have (e.g.) underscores instead of spaces. Would you be willing to make the change?

Should every language be included in the project?

Hey Jeff(@coding-horror),

Could you please open discussions so we can have an adult conversation about Object Pascal without me coming out as a troll?

I would really appreciate having a non inflamed, factually full type of conversation about it.

At the end, if I can't convince you, I'll gladly close my PRs and we'll never talk about it 😃

Many thanks for your time and please excuse my zeal on the PR comments. I'm a tad old and I have to admit some bias towards my favourite language, Pascal. It's not my intention to come as a troll AND if I did, please accept my deepest apologies!!

Cheers,
Gus

Bring Back the Bots

I was thinking about a coding contest called "Bring Back the Bots"--maybe as an add-on pack around the logic of the original text BASIC Trek game--sprucing up the interface with a couple of 3D modeling and scene graph packages I wrote in Common Lisp, laying around on the other git site. Use the game play of the original game with some retro, but stunning 3D graphics.

Could be a fun way for other to showcase their different languages (using 3D packages from their own languages of course).

One story line I thought of is the starship is on a mission to rescue a robot artist from some villians who are forcing him to forge copies of the original drawings in the book (not too far from the truth).

[I should be digging through dmesg logs, finding out why SSH doesn't let me connect to TinyCore Linux, but this is more fun and my boss is out of town.]

By the way, this issue was prompted by trying to get illustrator who did the awesome robot drawings from the BASIC game books to participate:

https://news.ycombinator.com/item?id=26293462

Beeker's site is:

http://www.bekerbots.com/

Is it correct to emulate basics features

In the C# implementation for the Calendar program, the author emulated the basic function TAB, but if I understood it correctly, this repository should build up a reference for learning the various langauges and therefor emulate the behaviour of the original program. While using the native features of the language.

So I think this should be replaced with a simple call to just new string(' ', n).

And if one would want to show how can build up a string incrementally, then the implementation should be

var strBuilder = new StringBuilder(n);

for (int i = 0; i < n; i++)
{
    strBuilder.Append(' ');
}

because using + on strings in a loop is an anti-pattern which no one should learn.

//basic has a TAB function. We do not by default, so we make our own!
static string Tab(int numspaces)
{
string space = "";
//loop as many times as there are spaces specified, and add a space each time
while (numspaces > 0)
{
//add the space
space += " ";
//decrement the loop variable so we don't keep going forever!
numspaces--;
}
return space;
}

possible logic error in 60_mastermind

while porting 60_mastermind to rust, I came across a peculiar issue, here in mastermind.bas (the flawed logic is present in every other port I looked at too):

1010 FOR X=1 TO P
1020 GOSUB 3500
1030 IF I(X)=0 THEN 1070
1035 GOSUB 6500
1040 GOSUB 4000
1050 GOSUB 4500
1060 IF B1<>B OR W1<>W THEN I(X)=0
1070 NEXT

this code basically looks through every possible combination,
for all that haven't already been marked as impossible (with previously given player feedback),
it checks whether or not the black and white pins that that combination should get are not-equal to what the previous guess got ... if they are equal, the combination is marked as possible, if they aren't equal then the combination is marked as impossible

the issue is, this almost always will mark the correct answer as impossible, unless its first guess happens to be right

a potential fix (that I can't test but did work in my rust port), is changing that logic from 1060 IF B1<>B OR W1<>W THEN I(X)=0 to 1060 IF B1>B OR W1>W THEN I(X)=0 which, as compared to 1060 IF B1>B OR W1>W THEN I(X)=0, makes the computer a bit more powerful, and actually able to win with some consistency

note: it could very well be that I messed something up in my implementation, hence why I'm making this issue, in case people agree that this is a problem I'll be making a PR to fix it that I'll link to in the comments

edit: typo

Kotlin Animal goes into an infinite loop on EOF

Animal.kt goes into an infinite loop, on end-of-file.
readLine returns null when end-of-file is reached, so looping back to try readline again will not work, it will not prompt again after an end-of-file.
Best to throw an exception on interactive readLine sessions returning null:

return readLine()?.uppercase() ?: throw EndOfInputException()

Can I add games writed on the rust?

I know python but now I learn rust and I wanna add in your repo rust games
Can I do It?

I didn't see rust in README.dm
Thank you for your project

Large files in git

I've noticed some astonishingly large files in this repository (in the git history):

81ebba90f411  1,4MiB buildJvm/build_53_King_kotlin/build/install/build_53_King_kotlin/lib/kotlin-stdlib-1.6.0.jar -- added via fe4219dc5a847f919d35b965789026ffdc3b40b3
eeb85bc8ea11  4,4MiB 53_King/kotlin/king.jar -- added via fe4219dc5a847f919d35b965789026ffdc3b40b3
7c624e47ff0f   25MiB 89_Tic-Tac-Toe/python/TicTacToe_exe/TicTacToe.exe -- added via 3efe6e3ae260800beae7c28ed095960939344581
65c61eb509d6   34MiB 39 Golf/csharp/compiled/linux_x86/golf -- added via 0dbb491ff9b2b22744cb7b5ddf6e6241938b70f0
5222483d2f8c   66MiB 39 Golf/csharp/compiled/windows_x86/golf.exe -- added via 0dbb491ff9b2b22744cb7b5ddf6e6241938b70f0

They are all already deleted, but still in the git history. This makes this repository way bigger than necessary. I've just seen a warning by Github about which I was confused ... and especially about the executable in 89_Tic-Tac-Toe/python. I initially thought I had done something wrong.

Re-write history

We could remove those from the git history: https://stackoverflow.com/a/2158271/562769
However, I have to admit that re-writing git history always feels scary to me

Prevent it in future

I would like to do two things:

  1. Add the pre-commit hook check-added-large-files
  2. Check in the CI if a large file was added (the simplest way to do it would be to run pre-commit in CI, but I would like to avoid that ... I need to check how to do this)

Does this sound like a good idea to you?

What would be a good maximum file size?

Straight port or reimplement?

This looks to be a fun project (I remember these books fondly!).

Looking at some of the conversions already added, I'm questioning whether we should be converting these to other languages literally as close as possible to the BASIC versions or is it more like "implement Acey Ducey with the same simple behavior as the original, in various languages"? There are some uploads that look like they're trying to keep the BASIC behavior (close to line for line) even though it's not how things would often be done in the new target language if it were being written from scratch.

As an example (and not meaning to single this particular one out, it's the first one I found), the Perl implementation of Buzzword keeps the look and feel of the original code with all caps text and uses short variable names and hardcoded array lengths based on (the human) having counted the items in the list ahead of time. That's a very straightforward port from BASIC to Perl, but it's not how it would probably be written from scratch. From scratch, I'm guessing most people would use lowercase in the text (and probably in the variable names) and dynamically determine the number of elements in the array when choosing a random element (or use a built-in module to do it rather than rolling their own). In modern languages, those would be a best practices.

Which way would you prefer? I'm (obviously 😊) partial to "re-implement" over "port it straight" in the interest of teaching new programmers, but I'll defer to you.

Use top-level statements for C#

For instance, this:

using System;
using System.Threading;

namespace AceyDucey
{
    /// <summary>
    /// The application's entry point
    /// </summary>
    class Program
    {
        /// <summary>
        /// This function will be called automatically when the application begins
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            // Create an instance of our main Game class
            Game game = new Game();

            // Call its GameLoop function. This will play the game endlessly in a loop until the player chooses to quit.
            game.GameLoop();
        }
   }
}

could be reduced to this:

// Create an instance of our main Game class
Game game = new Game();

// Call its GameLoop function. This will play the game endlessly in a loop until the player chooses to quit.
game.GameLoop();

On the other hand, using top-level statements obscures the basic "entry-point" nature of C# and .NET, which may not be a good idea from an educational standpoint.

Blank build.gradle has no guidance and shouldn't exist.

Surprising on opening this project with Intellij it started making the gradle wrapper, scripts and directory structure. There is no wrapper task or gradle-wrapper.properties in this directory so it defaults to whatever version of gradle is installed on the local machine which may or may not be compatible with whatever jvm is currently running. This blank build.gradle file should not exist. It creates 23 files that just need to then be ignored.

12 BombsAway java version always asks for gunner hit rate

To reproduce

  1. java BombsAwayGame
  2. What side - 1
  3. Target - 1
  4. Missions - 1
  5. What does the enemy have - 2

The response is "What's the percent rate of enemy gunners (10 to 50)?"
This should only happen for choices 1 and 3, compare to the basic, javascript or perl versions.

Screen Shot 2022-01-07 at 9 47 01 PM

Multiple Java Implementations of 75 Roulette

Just something I noticed, It seems that two different versions of 75 Roulette were implemented. There's one in a src sub-directory, and another in the base directory. Thoughts?

My initial thoughts is to separate them into individual folders, but still unsure how to categorize each one

Specifically referring to the #481 and #486 merged pull requests
@andrewmcguinness was the author of the other one.

39 Golf includes compiled csharp code

Cloning the repository takes a long time, because entry 39 Golf contains a "compiled" version of the game for Windows and Linux. This adds something like 100mb to the repository.

Due to the way Git works I'm not sure it's possible to remove that without force push and mucking up people's forks, but it'd be nice if that could be taken out so git clone goes faster. I leave it to you to sort that out :)

AwariGame.java a faithful translation?

@suetanvil I was wondering if your Awari Java implementation is a faithful algorithmic recreation of awari.bas ? I notice references to Random but there are no random numbers generated in the original.
I only ask because I was thinking of adding tests to the game, and if the game is non deterministic then that makes the problem more difficult.

Approach question

So, is the idea here to reproduce the original game as published as faithfully as possible with respect to verbiage, spacing, etc., and to keep the code a simple and straight-forward translation? Or, is it to get all fancy, add features, and cram code full of "better" things such as objects, etc.?

Standardize format of links to external implementations

Current Examples

There are currently multiple formats for linking to another implementation in an external repository.

From /01_Acey_Ducey/README.md

A Common Lisp port is [here](https://github.com/koalahedron/lisp-computer-games/blob/master/01%20Acey%20Ducey/common-lisp/acey-deucy.lisp).

From /24_Chemist/README.md

[Conversion to C](https://github.com/ericfischer/basic-computer-games/blob/main/24%20Chemist/c/chemist.c)

From /43_Hammurabi/README.md

[Port to C language](https://github.com/beyonddream/hamurabi)

[Port to Rust language](https://github.com/beyonddream/hamurabi.rs)

From /84_Super_Star_Trek/README.md

#### External Links
 - Super Star Trek in C++ : https://www.codeproject.com/Articles/28399/The-Object-Oriented-Text-Star-Trek-Game-in-C

Template Proposal

I would suggest the following as a template with the list alphabetized by implementation language.

#### External Links
 - C: https://github.com/beyonddream/hamurabi
 - Rust: https://github.com/beyonddream/hamurabi.rs

script finding current implementations misreads vbnet

@MartinThoma ...script which can automatically generate a markdown file with the current implementations...

TLDR: vbnet games are falsely marked complete. Ignore two files: *.sln and *.vbproj

Script output is here:

https://github.com/coding-horror/basic-computer-games/blob/main/00_Utilities/TODO.md

Apparently, vbnet games are incomplete. At least "Nim" is incomplete. I was curious how much needed to change for modern basic, thinking it was probably a trivial effort. When I looked into the Nim/vbnet folder, I see two shortish metadata files and no basic code anywhere. Examining the merge that created the project files, I see that someone did a great job of creating them for every game in the vbnet folder. So if you can amend your script to skip these files:

*.sln
*.vbproj

(merge comment: Add sln and csroj/vbproj files where missing)

Your script is quite good, thanks for doing it.
david.

Newbie

I'm a newbie playing github, please teach me how?

Game only, or interpreter behaviour as well?

You stated that you'd like the game play to the true to the original, and I whole-heartedly agree. But I'm wondering how far you want to take that?

Should we be recreating the BASIC interpreter's input behaviour? The INPUT statement takes keyboard input into one or more variables, allowing input as comma-separated values, or single values per line, or a mix. Should this behaviour, and the built-in BASIC prompts and error messages be duplicated?

Additional languages?

Is there any desire for additional languages to be added here as well, or are the predefined 8 as far as we want to go here?

Personally I think it'd be useful to include PowerShell as one of the languages here, and potentially even something a bit more adventurous like Rust. Both are pretty well suited to the command-line nature of these games, and I think it'd be very interesting to have those ports around.

Keeping track of Rust implementations of various games

As it seems like this project is heading towards including Rust, I thought it'd be useful to track our progress in one centralized location

Note: these are just the ones I know of, feel free to comment corrections, and the like, I'll try to keep this list up-to-date for the foreseeable future :)

Games Completed

Games Being worked on

  • 10_Blackjack but with splitting
  • 69_pizza
  • 82_stars

games not yet started

  • everything else

Multiple versions of a game

Hi @coding-horror (Jeff),

I wrote Bagels for Java today not realizing you already had a version in the repo. My bad for not looking first.

Is it worthwhile for me to upload it? My version is historically very accurate and close to the Basic code i.e. pretty much identical output to the original basic version. Same with my first submission, I based it on the existing version as much as possible.

Not to say the version submitted isn't good also, of course.

Let me know.

I am actually pretty keen on writing a version of most of these games in Java, aiming to knock out one game a day (5 a week or so).

Cheers

Tim

Normalized and alternate folders

Thoughts on having a normalized game version across languages?

A normalized folder for each where things are implemented in similar ways across different languages by using the same variables and methods names (given language conventions) would lend itself more to learning across languages.

And an alternate folder could capture alternate ways people have converted the game.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.