Showing posts with label Unicode. Show all posts
Showing posts with label Unicode. Show all posts

Sunday, June 3, 2018

HP Prime: At the Races


HP Prime:  At the Races

I am planning to do lots of gaming this month of June 2018.

Note: Symbols that are produced by Unicode should, but may not show up on all browsers. Please make sure your browsers are updated to the latest version.  

🐎 (Trumpet Sounds)  🐎

The program GAME_RACE simulates a race between seven racers:

Apple Ρ½  (Decimal Unicode: 1149, Hexadecimal Unicode: 47D)
Knight (Decimal Unicode: 9822, Hexadecimal Unicode: 265E)
Spade ♠ (Decimal Unicode: 9824, Hexadecimal Unicode: 2660)
Club ♣ (Decimal Unicode: 9827, Hexadecimal Unicode: 2663)
Heart ♥ (Decimal Unicode: 9289, Hexadecimal Unicode: 2665)
Diamond ♦ (Decimal Unicode: 9830, Hexadecimal Unicode: 2666)
Spike (Decimal Unicode: 10021, Hexadecimal Unicode: 2725)

To watch a race in action, all you have to do is to run GAME_RACE.  Betting not included. 



🐎  HP Prime Program GAME_RACE 🐎

EXPORT GAME_RACE()
BEGIN
// 2018-04-15 EWS

// initialize racers
// apple
LOCAL l1:={1149,#FF0000h,300,30};
// knight
LOCAL l2:={9822,#C0C0C0h,300,45};
// spade
LOCAL l3:={9824,#400080h,300,60};
// club
LOCAL l4:={9827,#000080h,300,75};
// heart
LOCAL l5:={9829,#FF0000h,300,90};
// diamond
LOCAL l6:={9830,#F0E090h,300,105};
// spike
LOCAL l7:={10021,#808080h,300,120};

// the race
LOCAL h,k,j,q;

FOR h FROM 1 TO 3 DO
RECT(#00FF00h);
TEXTOUT_P(CHAR(1149)+CHAR(9822)+
CHAR(9824)+CHAR(9827)+CHAR(9829)+
CHAR(9830)+CHAR(10021),125,100,5);
TEXTOUT_P(STRING(3-h+1),125,120,5);
WAIT(1);
END;
TEXTOUT_P(" ",125,120,5,0,25,#00FF00h);
TEXTOUT_P("And they're off!",125,
120,5);
WAIT(0.5);

REPEAT

// background
RECT();

// background
FILLPOLY_P({(20,0),(20,150),
(330,150),(330,0)},#00FF00h);
FILLPOLY_P({(0,0),(0,150),
(20,150),(20,0)},#E0E0E0h);
LINE_P(0,25,330,25);
// crowd
FOR h FROM 20 TO 300 STEP 10 DO
TEXTOUT_P(CHAR(9823),h,0,5);
END;
TEXTOUT_P(CHAR(9818),140,0,5,#000080h);
TEXTOUT_P(CHAR(9819),150,0,5,#FF0000h);
// racers
FOR h FROM 1 TO 7 DO
TEXTOUT_P(CHAR(1149),l1(3),l1(4),5,l1(2));
TEXTOUT_P(CHAR(9822),l2(3),l2(4),5,l2(2));
TEXTOUT_P(CHAR(9824),l3(3),l3(4),5,l3(2));
TEXTOUT_P(CHAR(9827),l4(3),l4(4),5,l4(2));
TEXTOUT_P(CHAR(9829),l5(3),l5(4),5,l5(2));
TEXTOUT_P(CHAR(9830),l6(3),l6(4),5,l6(2));
TEXTOUT_P(CHAR(10021),l7(3),l7(4),5,l7(2));
END;

WAIT(0.5);
// move the racers
l1(3):=l1(3)-RANDINT(1,3)*5;
l2(3):=l2(3)-RANDINT(1,3)*5;
l3(3):=l3(3)-RANDINT(1,3)*5;
l4(3):=l4(3)-RANDINT(1,3)*5;
l5(3):=l5(3)-RANDINT(1,3)*5;
l6(3):=l6(3)-RANDINT(1,3)*5;
l7(3):=l7(3)-RANDINT(1,3)*5;


q:={l1(3),l2(3),l3(3),
l4(3),l5(3),l6(3),l7(3)};
q:=q<5;
q:=Ξ£LIST(q);
UNTIL q>0;

TEXTOUT_P("The race is over!",
0,160,5,#008000h);

WAIT(0);
END;

Eddie

All original content copyright, © 2011-2018.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.  Please contact the author if you have questions.

Thursday, January 18, 2018

App Review: SciPro Calculator (Apple iOS)

App Review:  SciPro Calculator (Apple iOS)

Title:  SciPro Calc
Author:  Jerry Montgomery, Digital Ambience, Inc
Platform:  iOS
Price: Free (as of 1/18/2018)
Version:  1.2.5  (2017)



Portrait Orientation:  Basic Calculator

In the portrait orientation, SciPro Calculator is a basic function calculator.  The screen is impressive.  The black display clearly shows the large blue numbers and function indicators.  There is only 1 memory, but you get M+, M-, MC, and MR all on separate keys, which is nice.  You can turn the AC key into an AC/backspace key in Basic mode throughout the options.

Scroll down will give you access to the calculator’s history, allowing to view and copy results, even share them by email. 

Landscape Orientation:  Scientific and Programmer Calculator

Scientific Calculator



The calculator follows a post-fix algebraic system (think of a Texas Instruments TI-30 Xa or a Casio fx-260 II as examples).  The SciPro Calculator app can handle        numbers as high as 10^9864, which is very impressive.  

Functions include:

* trigonometry and their inverses (sine, cosine, tangent)
* hyperbolic functions
* factorial, which handles all real numbers not just integers (nice!)
* logarithms and exponentials, base e, 2, and 10
* square root, cube root, power, root
* modulus (see note below)
* Two angle modes: degrees, radians

Modulus Function

The modulus function works well on positive numbers.  Comparing results using negative numbers to an HP Prime:

78 mod -11:

HP Prime:  -10
SciPro Calculator:  1


-78 mod 11:

HP Prime: 10
SciPro Calculator: -1

The scientific app does lack fractions and statistics.  Other than that, it’s a good standard scientific calculator.

Programmer Calculator



The programmer calculator is a Boolean math calculator with four integer representations:  Binary (64 bits), Octal, Decimal, and Hexadecimal.  Depending on whatever mode you are in, the numeric keyboard highlights only the appropriate keys, so there is no accidently typing A in Decimal mode or 9 in Octal mode.



The ENC key turns on a unique feature, binary numbers which will give you the ASCII character, Unicode character, and the color determined by the RGB color.  This is most useful when the calculator is Hexadecimal representation.  You can use the arithmetic and the other functions to work with colors.  Sweet!

Functions featured in the Programmer Calculator:

*  Byte and Word Flip
*  Bit count and shift
*  Random integer
*  Boolean operators:  AND, OR, NOR, XOR
*  Modulus
*  1’s and 2’s compliments (Yes, there is a difference)

The programmer calculator can handle integers as high as:  18,446,744,073,709,551,615.

Caution:  No Sign Bit

Be aware that there are no sign bits with this calculator, everything is positive integer representation.  Hence this why 0 – 1 returns 18,446,744,073,709,551,615 (64 1s in Binary) instead of -1. 

Impressions

I like the unique feature of the programmer calculator having the ability to look up ASCII, Unicode, and RGB codes.  It’s a fun feature.

You probably won’t have to worry if you have to work with large numbers (at least numbers 10^100 and beyond), the SciPro Calculator app can handle it.

The blue numbers against the black screen is really nice, big, and readable, regardless of orientation of your iPhone or iPod Touch.

This is a nice calculator to have, especially for quick calculations.


Eddie

This blog is property of Edward Shore, 2018

Tuesday, October 3, 2017

Adventures in Python: Printing Mathematical Symbols with Unicodes

Adventures in Python:  Printing Mathematical Symbols with Unicodes

Got to start somewhere.  I confess that I am a beginner when it comes to Python. 

With the use of the backslash, followed by a u, then four hexadecimal numbers, Python can print all sorts of symbols not easily found on a standard keyboard.  Some common math symbols and their Unicode:

039A
Ξ”
03C0
Ο€
2202
2248
03A3
Ξ£
00B0
°
221A
2260
03A6
Ο•
0283
2264
221E
03C3
ΞΌ
03B4
Ξ΄
2265
03B8
ΞΈ
03BB
Ξ»
2220
03B1
Ξ±
03B2
Ξ²
03C3
Οƒ
0413
Ξ“
2205
29A8
2282
2283
221B
221D

A short program that demonstrates calling the Unicode characters:

# Program 001: Python Program
# Unicode is the format \uxxxx
# print command is used
print("This is some of my favorite constants (to 8 places).")
print("\u221A \u2248 1.41421356")
print("\u03C0 \u2248 3.14159265")
print("e \u2248 2.71828183")
print("\u03A6 \u2248 1.61803399")

Anything that comes after the hashtag (#) is a comment. 

Output:

This is some of my favorite constants (to 8 places).
√ ≈ 1.41421356
Ο€ ≈ 3.14159265
e ≈ 2.71828183
Ξ¦ ≈ 1.61803399
>>> 

Fairly simple.  Next up, I learn about input and the type of objects (the hard way).

Eddie


This blog is property of Edward Shore, 2017.

HP 48G Collection

 HP 48G Collection  Contents:  Intensity of Spherical Light Source  Speed of Light in Dry Air  Pressure of Air  Earth's Gravity a...