Skip to content

Commit 8c83e77

Browse files
committed
Moving from local gitea to github.
1 parent 1972bf3 commit 8c83e77

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+16498
-0
lines changed

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# ---> Go
2+
# Binaries for programs and plugins
3+
*.exe
4+
*.exe~
5+
*.dll
6+
*.so
7+
*.dylib
8+
basicbots
9+
basicbots_windows64.exe
10+
basicbots-linux64
11+
12+
# Test binary, built with `go test -c`
13+
*.test
14+
15+
# Output of the go coverage tool, specifically when used with LiteIDE
16+
*.out
17+
18+
# Dependency directories (remove the comment below to include it)
19+
# vendor/
20+
l.txt
21+
ll.txt
22+
23+
notes.txt

BASIC.md

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
# basicbots *BASIC*
2+
3+
**basicbots** version of *BASIC* is based and adapted from [gobasic](https://github.com/skx/gobasic) by [James Kemp](https://github.com/skx). Mr. Kemp has gracely given me permission to adapt [gobasic](https://github.com/skx/gobasic) for my game.
4+
5+
6+
## BASIC
7+
---
8+
**basicbot** uses a subset of the *BASIC* language. Most of the early BASICs functionality is implemented. The assumption is that the players are passingly familiar with *BASIC*. This document is not meant to teach the *BASIC* programming language. I encourage you to seek out online guides.
9+
10+
**NOT TRUE**
11+
12+
### Qurkes
13+
- Variables are case sensitive. Primitives are not.
14+
- LOCALX is different than localx
15+
- Line numbers are not strictly required but are strongly suggested.
16+
- I do not suggest doing leaving out the line numbers. Error handling is still awful and needs work. Doing this would just make it harder.
17+
- Some of the custom statements seem not to play well with `IF` `THEN` & `ELSE`. I am not sure why but for now keep the `IF` states as simple as you can. If you get odd error messages. Rewrite the `IF` states around it.
18+
- Error reporting can be a bit difficult to interpret. Advice, save work often and make copies as you go. **git** is a good way to handle this.
19+
- I find it useful at the top of the program to initialize all the variables. This cuts down on some errors.
20+
21+
### Limitations
22+
A previously stated this is a subset of the *BASIC* standard.
23+
- There is no editor.
24+
- Errors in the program are only found during execution.
25+
- Only a single statement is allowed on each line. The exception is for `REM`arks. `REM`arks can be placed after ':' at the end of a line.
26+
- The only data types are floating-point and strings.
27+
- Arrays can have a maximum of two dimensions.
28+
- `LET` is not optional.
29+
- Only a single statement is allowed between `THEN` and `ELSE` and a single statement from `ELSE` to a newline.
30+
31+
### Program format
32+
33+
Programs are text files that are specified on the command line. They are loaded and parsed when the robots are initialized.
34+
35+
Each line contains a line number followed by a statement or command with an optional parameter(s).
36+
37+
All line numbers are integers.
38+
39+
### basicbots robot statements
40+
41+
- `SCAN` direction, width
42+
- Scan for other robots. Returning the range if any are found.
43+
- "direction" is the direction to scan
44+
- "width" is how wide the scan is. Width is specified as +- width. For example, SCAN 90, 10 would scan @ 90 degrees with a width that spans from 80 to 100 degrees.
45+
- `CANNON` direction, range
46+
- Fire the cannon in the direction "direction" with it exploding at the distance specified by "range"
47+
- `SPEED`
48+
- Returns the current speed of the robot.
49+
- `LOCX`
50+
- Returns the current X location of the robot on the battlefield.
51+
- `LOCY`
52+
- Returns the current Y location of the robot on the battlefield.
53+
- `DRIVE` direction, speed
54+
- Starts the drive system in the direction of "direction" with the speed specified. Turns can only be made when the speed is 50 or below. If the speed is above 50, the robot will slow down and then turn, returning to the former speed.
55+
- `DAMAGE`
56+
- Returns the amount of damage the robot has sustained.
57+
58+
### *BASIC* primitives
59+
60+
- Comments
61+
- `REM` Single-line comment only.
62+
63+
- Variable assignment
64+
- `LET`
65+
- `DIM`
66+
67+
- Loops
68+
- `FOR` `NEXT` `STEP` & `TO`
69+
70+
- Conditionals
71+
- `IF` / `THEN` / `ELSE`
72+
73+
- Communication
74+
- `PRINT` & `INPUT`
75+
76+
- Program termination
77+
- `END`
78+
79+
- Branching
80+
- `GOTO` & `GOSUB` / `RETURN`
81+
82+
- Stored data
83+
- `READ` & `DATA`
84+
85+
- Misc
86+
- `SWAP`
87+
- `DEF FN` & `FN`
88+
89+
- Strings
90+
- `LEN`
91+
- `LEFT$` & `RIGHT$`
92+
- `CHR$`
93+
- `CODE`
94+
95+
- Math
96+
- ABS
97+
- ACS
98+
- ATN
99+
- ATN2
100+
- BIN
101+
- COS
102+
- EXP
103+
- INT
104+
- LN
105+
- LOG
106+
- PI
107+
- RND
108+
- SGN
109+
- SIN
110+
- SQR
111+
- TAN
112+
- VAL
113+
114+
- `LET` variable = expression
115+
- Assigns a value, or the result of expression, to a variable. Variables are case sensitive and can be floating-point or strings.
116+
117+
- `IF` condition `THEN` statement `ELSE` statement
118+
- If the condition is true, then the statement following `THEN` is executed. If it is false then the statement after `ELSE` is executed.
119+
120+
- `GOTO` line number
121+
- Transfer execution to another part of the program specified by the line number.
122+
123+
- `GOSUB` line number
124+
- Transfers execution to a subroutine specified by the line number. The position of the `GOSUB` is remembered so that a `RETURN` can bring program execution back to the statement following the `GOSUB`.
125+
126+
- `RETURN`
127+
- Returns from a subroutine. Program execution returns to the statement following the `GOSUB`, which called the present subroutine.
128+
129+
- `END`
130+
- Terminates program execution.
131+
132+
~~PRINT output-list~~
133+
134+
~~Produces output to the console. Output-list is a list of items separated by commas. Each item can be either a string literal enclosed in double quotation marks or a numeric expression. An end of line sequence is output after all the values so that the next PRINT statement will put its output on a new line.~~
135+
136+
~~INPUT variable-list~~
137+
138+
~~Asks for input from the console. Variable-list is a list of variable names. For each variable given, a question mark is output, and the value typed by the user is stored in that variable. Tinybasic allows multiple values to be typed by the user on one line, each separated by any non-numeric character.~~
139+
140+
- `REM` comment-text
141+
- Provides space for free-format comment text in the program. Comments have no effect on the execution of a program and exist only to provide human-readable information to the programmer.
142+
143+
### EXPRESSIONS
144+
145+
Expressions in **basicbots** *BASIC* are purely arithmetic expressions. The four basic arithmetic operators are supported: multiplication (*), division (/), addition (+), and subtraction (-). Unary operators for positive (+) and negative (-) are supported, as are parentheses for affecting the order of operations.
146+
147+
Standard operator precedence evaluates parentheses first, then unary signs, then multiplication and division, with addition and subtraction last.
148+
149+
### CONDITIONS
150+
151+
The relational operators are =, >, <, <> or ><, >=, and <=. They are not supported within arithmetic expressions, but can only be used as conditions in IF statements in the form: expression relational-operator expression
152+
153+
- `IF a < b THEN ..`
154+
- `IF a > b THEN ..`
155+
- `IF a <= b THEN ..`
156+
- `IF a >= b THEN ..`
157+
- `IF a = b THEN ..`
158+
- `IF a <> b THEN ..`
159+
- `IF a THEN ..`
160+
- This passes if `a` is a number which is not zero.
161+
- This passes if `a` is a string which is non-empty.
162+
163+
164+
165+
---
166+
So much more to do.
167+
---
168+
---
169+
170+
## Interesting articles and Guides on *BASIC*
171+
172+
[Fifty Years of *BASIC*, the Programming Language That Made Computers Personal](https://web.archive.org/web/20150708131957/http://time.com/hive.org/web/20150708131957/http://time.com/69316/basic/)
173+
174+
[*BASIC* Programming](https://en.wikibooks.org/wiki/BASIC_Programming)
175+
176+
[Begginers Guide to *BASIC*](http://www.hoist-point.com/applesoft_basic_tutorial.htm)
177+

BASICBOTS.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# basicbots overview and guide
2+
3+
This is the overview manual for **basicbots** programming game; with examples that will hopefully start you on your way.
4+
5+
---
6+
7+
## The simulation
8+
9+
### The Battlefield
10+
The robots compete in a virtual battlefield that is 1000 units wide by 1000 units long. The upper left corner is 0,0 while the lower right corner is 1000,1000. There is a virtual wall that surrounds the battlefield. If a robot makes contact with this wall, it will take damage and its speed will be reduced to 0.
11+
12+
### Cardinal directions
13+
| | | |
14+
|:----|:---:| ---:|
15+
| 225 | 270 | 315 |
16+
| 180 | * | 000 |
17+
| 135 | 090 | 045 |
18+
| | | |
19+
20+
21+
### The Robot's Hardware
22+
The robot tank has three hardware systems.
23+
24+
- **A Scanner**. The scanner can scan in any direction instantly but has an angular resolution from +-2 degrees to +- 10 degrees. Example: Scan 90 degrees with a width of 2 would return results that are between 88 - 92 degrees. A width of 10 would return results that are from 80 to 100 degrees.
25+
26+
- **A Cannon**. The Cannon can fire a projectile in any direction but at a maximum range of 700 units. Any robot caught in the blast radius of 40 units. The farther from the center of the blast, the less damage a robot will take. Each robot can only have two projectiles in the air at any given time and it takes time to reload.
27+
28+
- **A Drive system**. The drive system has two parameters. Angle and speed. The angle can be any angle from 0 to 360 degrees and the speed can be from 0 to 100%. The robots do require time to reach a given speed and require time to slow down. The robot can only negotiate turns when the speed is less than 50%. If the speed is above 50% the robot will slow down to 50% then turn and increase speed to the previous setting.
29+
30+
### The Robot's Status
31+
The robot has access to:
32+
- **The X location**. The current X position on the battlefield of the robot.
33+
- **The Y location**. The current Y position on the battlefield of the robot.
34+
- **The Speed**. The current speed of the robot.
35+
- **The Damage**. The current amount of damage inflicted upon the robot. The robot can withstand up to 100 points of damage. Once a robot has reached 100 points, it has died and is removed from the battlefield. The amount of damage does not affect its performance.
36+
37+
That's it. Three commands and four status sensors. With that, you can navigate the battlefield and annihilate the other robots!
38+
39+
40+

CODE_OF_CONDUCT.md

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

0 commit comments

Comments
 (0)