Compare commits

...

10 Commits

36 changed files with 7936 additions and 0 deletions

23
basic/ordering-system.bas Normal file
View File

@ -0,0 +1,23 @@
REM Order System 0.5 - FreeBasic Edition
REM by John Paul Wohlscheid
REM Variables
DIM items as integer 'item total
DIM fname as string 'customer first name
DIM lname as string 'customer last name
DIM total as integer 'order total
REM Main Program
PRINT TAB(15); "Welcome to the first version of this Order System."
PRINT TAB(15); "To place your order, enter the amount you of each"
PRINT TAB(15); "item you want and the amount will be totalled"
PRINT TAB(15); "at the end."
PRINT
PRINT TAB(15); "First of all, please enter your name."
INPUT "Enter your first name: ", fname
INPUT "Enter your last name: ", lname
PRINT "Thank you, " + fname + "!"
PRINT

38
basic/social-security.bas Normal file
View File

@ -0,0 +1,38 @@
[start]
cls
print "This program will help you determine"
print "if you are old enough to apply for"
print "Social Security."
print
input "Please enter your current age."; age
if age < 65 then [young]
if age > 65 then [old]
if age = 65 then [correct]
goto [start]
[young]
cls
print "You are too young. Please try again"
print "in a couple of years."
print
input "Press 'Enter' to continue."; dummyVariable
print
goto [start]
[old]
cls
print "You are should have applied for"
print "Social Security by now."
print
input "Press 'Enter' to continue."; dummyVariable
print
goto [start]
[correct]
cls
print "You are now eligiable to apply for "
print "Social Security."
print
input "Press 'Enter' to continue."; dummyVariable
print
goto [start]

18
basic/taxes.bas Normal file
View File

@ -0,0 +1,18 @@
[start]
print "Type a dollar and cent amount ?"
input "(Press 'Enter' alone for help) "; amount
let tax = amount * 0.05
print "Tax is: "; tax; ". Total is: "; tax+amount
goto [start]
[help]
cls
print "SALESTAX.BAS Help"
print
print "This tax program determines how much tax is"
print "due on an amount entered and also computes"
print "the total amount. The tax rate is 5%."
print
input "Press [Enter] to continue."; dummyVariable
cls
goto [start]

25
basic/taxes2.bas Normal file
View File

@ -0,0 +1,25 @@
[start]
print "Type a dollar and cent amount ?"
input "(Press 'Enter' alone for help) "; valueA
let tax = amount * 0.05
let valueB = int(valueA)
valueC = valueA - valueB
goto [start]
[help]
cls
print "SALESTAX.BAS Help"
print
print "This tax program determines how much tax is"
print "due on an amount entered and also computes"
print "the total amount. The tax rate is 5%."
print
input "Press [Enter] to continue."; dummyVariable
cls
goto [start]

0
index.html Normal file
View File

10
ldpl/hello.ldpl Normal file
View File

@ -0,0 +1,10 @@
# LDPL 'Hello World' example
data:
name is text # Your name will go here.
procedure:
display "Hello World!" lf "What's your name? "
accept name
display "你好, " name ", welcome to LDPL!" lf

2
perl/hello Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/perl
print "Hello, world!\n";

4
perl/hello2 Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/perl
use v5.10;
say "Hello, World!";

25
qb64/Artillery3.bas Normal file
View File

@ -0,0 +1,25 @@
PRINT "Artillery 3"
PRINT TAB(7); "Copyright 1979 Creative Computing"
INPUT "Do you need instructions?"; I$
t = 0
DIM S(2, 9)
DIM V(3), X(3), P(3), R(3, 3)
DATA 1,2,2,3,3,1,1,3,3,2,2,1,2,3,3,1,1,2,0
IF LEFT$(I$, 1) = "Y" THEN 1240 ELSE CLS
players:
PRINT
PRINT "No. of Players"
INPUT N
IF N = 2 THEN 170
IF N = 3 THEN 200
PRINT "Error -- Two or Three Players!"
PRINT
RETURN
GOSUB players
N1 = 1
PRINT ""

View File

@ -0,0 +1,40 @@
REM Cascading numbers
REM by John Paul Wohlscheid
REM ask for numbers
PRINT "Please enter four numbers and watch the values cacade"
INPUT "Enter your first number: "; num1%
INPUT "Enter your second number: "; num2%
INPUT "Enter your third number: "; num3%
INPUT "Enter your fourth number: "; num4%
ab% = num1% - num2%
cd% = num3% - num4%
finalnum% = ab% - cd%
REM displaying numbers while using str$ to convert numbers to strings
CLS
PRINT STR$(num1%) + " " + STR$(num2%) + " " + STR$(num3%) + " " + STR$(num4%)
PRINT " \ / \ /"
PRINT " \ / \ /"
PRINT " \ / \ /"
PRINT " \ / \ /"
PRINT " \ / \ /"
PRINT
print " " + STR$(ab%) + " " + STR$(cd%)
PRINT
print " \ /"
PRINT " \ /"
print " \ /"
print " \ /"
PRINT " \ /"
PRINT " \ /"
PRINT " \ /"
print " \ /"
PRINT " \ /"
PRINT " \ /"
PRINT " \ /"
print " \/"
PRINT
print " " + STR$(finalnum%)
PRINT "=========================================================="

View File

@ -0,0 +1,30 @@
REM Cascading numbers 2.0
REM by John Paul Wohlscheid
REM ask for numbers
PRINT "Please enter twn numbers and watch the values cacade"
INPUT "Enter your first number: "; num1%
INPUT "Enter your second number: "; num2%
INPUT "Enter your third number: "; num3%
INPUT "Enter your fourth number: "; num4%
INPUT "Enter your fifth number: "; num5%
INPUT "Enter your sixth number: "; num6%
INPUT "Enter your seventh number: "; num7%
input "Enter your eighth number: "; num8%
INPUT "Enter your ninth number: "; num9%
INPUT "Enter your tenth number: "; num10%
ab% = num1% - num2%
cd% = num3% - num4%
ef% = num5% - num6%
gh% = num7% - num8%
ij% = num9% - num10%
finalnum% = ab% - cd%
REM displaying numbers while using str$ to convert numbers to strings
CLS
PRINT STR$(num1%) + " " + STR$(num2%) + " " + STR$(num3%) + " " + STR$(num4%) + " " + STR$(num5%) + " " + STR$(num6%) + " " + STR$(num7%) + " " + STR$(num8%) + " " + STR$(num9%) + " " + STR$(num10%)
PRINT " " + STR$(ab%) + " " + STR$(cd%) + " " + STR$(ef%) + " " + STR$(gh%) + " " + STR$(ij%)
PRINT "=========================================================="

24
qb64/guessing-game.bas Normal file
View File

@ -0,0 +1,24 @@
score% = 0
Print "Hello, Player! What is your name?"
Input ; name$
Print
Print "Welcome " + name$ + "!"
Print "Please answer the following questions."
Print "A score of 5 is perfect."
Print "What is the result of 1 + 1?"
Input ; answer
If answer = 2 Then score = score + 1
Print "What does 3 times 4 equal?"
Input ; answer
If answer = 12 Then score = score + 1
Print "What is the answer to 81 divided by 9"
Input ; answer
If answer = 9 Then score = score + 1
Print "What does 7 time 8 plus 10 equal"
Input ; answer
If answer = 66 Then score = score + 1
Print "What is the answer to the ultimate auestion of life, the universe, and everything."
Input ; answer
If answer = 42 Then score = score + 1
print "Your score: " + score
print "You have the skill of

5
qb64/hello.bas Normal file
View File

@ -0,0 +1,5 @@
PRINT "Hello World"

20
qb64/linedemo2.bas Normal file
View File

@ -0,0 +1,20 @@
'-------------------------
'-LINE demonstration #2 -
'-------------------------
const YELLOW = _RGB32(255, 255, 0)
SCREEN _NEWIMAGE(640, 480, 32)
cls
line (299, 219)-(319,0), YELLOW
LINE -(339, 219), YELLOW
LINE -(629, 239), YELLOW
LINE -(339, 259), YELLOW
LINE -(319, 479), YELLOW
LINE -(299, 259), YELLOW
LINE -(0, 239), YELLOW
LINE -(299, 219), YELLOW
LOCATE 16.36
PRINT "PRESS A KEY"
SLEEP
SYSTEM

32
qb64/linedemo3.bas Normal file
View File

@ -0,0 +1,32 @@
'-------------------------
'-LINE demonstration #3 -
'-------------------------
CONST YELLOW = _RGB32(255, 255, 0)
dim Style&
dim Bit%
dim Dir%
Dir% = -1
SCREEN _NEWIMAGE(640, 480, 32)
do
cls
_LIMIT 30
LOCATE 2, 33
PRINT "A Stylized Line"
LOCATE 4, 21
PRINT "Press the Space Bar to change directions"
LOCATE 6, 23
PRINT "Press the Escape key to exit the program."
if _KEYHIT = 32 THEN Dir% = -Dir%
Bit% = Bit% + Dir%
if Bit% = 16 THEN
Bit% = 0
ELSEIF Bit% = -1 then
Bit% = 15
End if
Style& = 2 ^ Bit%
LINE (99, 129)-(539, 409), YELLOW, B , Style&
_DISPLAY
LOOP UNTIL _KEYDOWN(27)

4
qb64/name.bas Normal file
View File

@ -0,0 +1,4 @@
PRINT "Enter your name:"
INPUT user$
PRINT "Hello " + user$

30
qb64/order-system.bas Normal file
View File

@ -0,0 +1,30 @@
_Title "Generic Ordering System"
REM Order System 0.1
REM by John Paul Wohlscheid
REM Variables
DIM items% 'item total
DIM fname$ 'customer first name
DIM lname$ 'customer last name
DIM total% 'order total
REM Main Program
PRINT TAB(15); "Welcome to the first version of this Order System."
PRINT TAB(15); "To place your order, enter the amount you of each"
PRINT TAB(15); "item you want and the amount will be totalled"
PRINT TAB(15); "at the end."
print
print
print
PRINT
PRINT "First of all, please enter your name."
INPUT "Enter your first name: ", fname$
INPUT "Enter your last name: ", lname$
cls
PRINT TAB(15); "Thank you, " + fname$ + "!"
PRINT TAB(15); "Now, let's get to ordering."
PRINT

39
qb64/social-security.bas Normal file
View File

@ -0,0 +1,39 @@
start:
CLS
PRINT "This program will help you determine"
PRINT "if you are old enough to apply for"
PRINT "Social Security."
PRINT
INPUT "Please enter your current age."; age
IF age < 65 THEN GOSUB young:
IF age > 65 THEN GOSUB old:
IF age = 65 THEN GOSUB correct:
GOTO start
young:
CLS
PRINT "You are too young. Please try again"
PRINT "in a couple of years."
PRINT
INPUT "Press 'Enter' to continue."; dummyVariable
PRINT
GOTO start
old:
CLS
PRINT "You are should have applied for"
PRINT "Social Security by now."
PRINT
INPUT "Press 'Enter' to continue."; dummyVariable
PRINT
GOTO start
correct:
CLS
PRINT "You are now eligiable to apply for "
PRINT "Social Security."
PRINT
INPUT "Press 'Enter' to continue."; dummyVariable
PRINT
GOTO start

11
red/ask-age.red Normal file
View File

@ -0,0 +1,11 @@
Red [needs: view]
view [
f1: field "First name"
f2: field "Last name"
button "Greet me!" [
t1/text: rejoin ["Have a nice day " f1/text " " f2/text "!"]
]
return
t1: text "" 200
]

BIN
red/hello-gui.exe Normal file

Binary file not shown.

3
red/hello-gui.red Normal file
View File

@ -0,0 +1,3 @@
Red [Needs: 'View]
view [text "Hello, World!"]

BIN
red/hello.exe Normal file

Binary file not shown.

3
red/hello.red Normal file
View File

@ -0,0 +1,3 @@
Red [Title: "Simple hello world Script"]
print "Hello, World"

3
red/image-viewer.red Normal file
View File

@ -0,0 +1,3 @@
Red [ tite: "Simple Image Viewer" needs: 'view]

6352
red/libRedRT-defs.r Normal file

File diff suppressed because one or more lines are too long

1
red/libRedRT-extras.r Normal file
View File

@ -0,0 +1 @@
red/symbol/make-opt red/alloc-at-tail red/none/make-in red/unicode/to-utf16-len red/unicode/to-utf16 red/handle/make-at red/unicode/load-utf16 red/ownership/unbind-each red/image/resize red/image/delete red/date/make-at red/vector/make-at red/OS-image/delete red/float/abs red/image/any-resize red/OS-image/width? red/OS-image/height? red/binary/make-at red/OS-image/make-image red/file/to-OS-path red/string/rs-abs-at red/map/put red/collector/keep red/collector/register red/unicode/get-cache red/percent/rs-make-at red/string/sniff-chars

1084
red/libRedRT-include.red Normal file

File diff suppressed because it is too large Load Diff

BIN
red/libRedRT.dll Normal file

Binary file not shown.

BIN
red/print-message.exe Normal file

Binary file not shown.

2
red/print-message.red Normal file
View File

@ -0,0 +1,2 @@
Red [ Title: "My program" needs: 'view]
view [ text "Its a great big world!" button "Quit" [quit] ]

BIN
red/print-name.exe Normal file

Binary file not shown.

3
red/print-name.red Normal file
View File

@ -0,0 +1,3 @@
Red [Needs: 'View]
view [name: field button "Hi" [print ["Hi" name/text]]]

60
ruby/get_number.rb Normal file
View File

@ -0,0 +1,60 @@
# Get My Number Game
# written by: you!
puts "Welcome to 'Get My Number!'"
print "What's your name? "
input = gets
name = input.chomp
puts "Welcome, #{name}!"
# Store a random number for the player to guess.
puts "I've got a number between 1 and 100."
puts "Can you guess it?"
target = rand(100) + 1
# Track how many gueses the player has made.
num_guesses = 0
# Track whether the player has guessed correctly
guessed_it = false
until num_guesses == 10 || guessed_it
puts "You've got #{10 - num_guesses} guesses left."
print "Make a guess."
guess = gets.to_i
num_guesses += 1
# Compare the guess to the target.
# Print the appropriate message.
if guess < target
puts "Oops. Your guess was LOW."
elsif guess > target
puts "Oops. Your guess was HIGH."
elsif guess == target
puts "Good job, #{name}!"
puts "You guessed my number in #{num_guesses} gueses!"
guessed_it = true
end
end
# If player ran out of turns, tell them what the nubmer was.
unless guessed_it
puts "Sorry. You didn't get my number. (It was #{target}.)"
end

13
ruby/soda_methods.rb Normal file
View File

@ -0,0 +1,13 @@
def order_soda(flavor, size = "medium", quantity = 1)
if quantity == 1
plural = "soda"
else
plural = "sodas"
end
puts "#{quantity} #{size} #{flavor} #{plural}!"
end
order_soda("orange")
order_soda("lemon-lime", "small", 2)
order_soda("grape", "large")

3
ruby/sort.rb Normal file
View File

@ -0,0 +1,3 @@
numbers = [5, 3, 2, 4, 1]
print numbers.sort

29
ruby/vehicle_methods.rb Normal file
View File

@ -0,0 +1,29 @@
def accelerate
puts "Stepping on the gas"
puts "Speeding up"
end
def sound_horn
puts "Pressing the horn button"
puts "Beep beep!"
end
def use_headlights(brightness)
puts "Turning on #{brightness} headlights"
puts "Watch out for deer!"
end
def use_headlights(brightness = "low-beam")
puts "Turning on #{brightness} headlights"
puts "Watch out for deer!"
end
def mileage(miles_driven, gas_used)
return miles_driven / gas_used
end
trip_mileage = mileage(400, 12)
puts "You got #{trip_mileage} MPG on this trip."
lifetime_mileage = mileage(11432, 366)
puts "This car averages #{lifetime_mileage} MPG."