locked
September Challenge: Draw a Face RRS feed

  • General discussion

  • This is my suggestion for September challenge.

    • Draw a face of something.

    Here is a sample code: QRW993.

    Screen shot of a program Draw Arc 0.2


    Nonki Takahashi


    Sunday, August 21, 2016 1:29 AM

All replies

  • Just4Fun (no drawing)

    'arr= "1=πŸ™ˆ;2=πŸ™‰;3=πŸ™Š;"      ' ALT1
    gw = GraphicsWindow.Width
    gh = GraphicsWindow.Height
    GraphicsWindow.FontSize = 128

    For n = 1 To 3
      GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor()
      shp[n] = Shapes.AddText(Text.GetCharacter(9784 + n))  ' "☹☺☻"

      'shp[n] = Shapes.AddText(arr[n])     ' ALT1
      'shp[n] = Shapes.AddText(Text.GetCharacter(128583 + n))  '  ??? ALT2  "πŸ™ˆπŸ™‰πŸ™Š"

      Shapes.Move(shp[n], (2*n-1) * gw/7, gh/3)
    EndFor

    But leads me to a question: Any change to use ALT2 like above on Win7 ?

    I can't find a font with characters > #FFFF like U+1F648 (128584), U+1F649 (128585), U+1F64A (128586) !! Where are the monkeys on W7?

         

    Sunday, August 21, 2016 4:43 PM
    Answerer
  • cool challenge !!

    i like  drawing and skectching ;)

    Sunday, August 21, 2016 6:56 PM
    Answerer
  • Just4Fun (no drawing)

    'arr= "1=πŸ™ˆ;2=πŸ™‰;3=πŸ™Š;"      ' ALT1
    gw = GraphicsWindow.Width
    gh = GraphicsWindow.Height
    GraphicsWindow.FontSize = 128

    For n = 1 To 3
      GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor()
      shp[n] = Shapes.AddText(Text.GetCharacter(9784 + n))  ' "☹☺☻"

      'shp[n] = Shapes.AddText(arr[n])     ' ALT1
      'shp[n] = Shapes.AddText(Text.GetCharacter(128583 + n))  '  ??? ALT2  "πŸ™ˆπŸ™‰πŸ™Š"

      Shapes.Move(shp[n], (2*n-1) * gw/7, gh/3)
    EndFor

    But leads me to a question: Any change to use ALT2 like above on Win7 ?

    I can't find a font with characters > #FFFF like U+1F648 (128584), U+1F649 (128585), U+1F64A (128586) !! Where are the monkeys on W7?

         

    My understanding was that Small Basic doesn't support SMP in Unicode.  But I didn't know SMP can be displayed as literal.

    http://social.technet.microsoft.com/wiki/contents/articles/25196.small-basic-character-set-unicode.aspx


    Nonki Takahashi


    Monday, August 22, 2016 12:23 AM
  • Got it, W7 charmap.exe does'nt show chars > #FFFF, even after installing Symbola.ttf font. But after updating BabelMap/BabelPad to v9 it's all there (also in Segoe UI Symbol 5.01 from KB2729094 hotfix)

    However, highest charCode, that SB can show via Text.GetCharacter is #FFFD (65533, οΏ½)

    For charCodes >= 65536 (#10000),

    Text.GetCharacterCode(Text.GetCharacter(charCode))   returns Math.Remainder(charCode, 65536)

    while eg.

    Text.GetCharacterCode("πŒ€")   ' character #1D300 (119552, I-Ging MONOGRAM FOR EARTH) returns 55348 !!   [but  119552 % 65536 = 54016] or

    Text.GetCharacterCode("🐡")  ' character ##1F435 (128053, MONKEY FACE)  returns 55357 !! [but 128053 % 65536 = 62517]

    Did'nt already figure out this discrepancy, but there must be a logic behind, internally it's (int)character[0]). Hmm ??


    Monday, August 22, 2016 5:24 PM
    Answerer
  • Got it, W7 charmap.exe does'nt show chars > #FFFF, even after installing Symbola.ttf font. But after updating BabelMap/BabelPad to v9 it's all there (also in Segoe UI Symbol 5.01 from KB2729094 hotfix)

    However, highest charCode, that SB can show via Text.GetCharacter is #FFFD (65533, οΏ½)

    For charCodes >= 65536 (#10000),

    Text.GetCharacterCode(Text.GetCharacter(charCode))   returns Math.Remainder(charCode, 65536)

    while eg.

    Text.GetCharacterCode("πŒ€")   ' character #1D300 (119552, I-Ging MONOGRAM FOR EARTH) returns 55348 !!   [but  119552 % 65536 = 54016] or

    Text.GetCharacterCode("🐡")  ' character ##1F435 (128053, MONKEY FACE)  returns 55357 !! [but 128053 % 65536 = 62517]

    Did'nt already figure out this discrepancy, but there must be a logic behind, internally it's (int)character[0]). Hmm ??


    Pappa Lapub,

    My guess is that each character is encoded in UTF-16 internally.  For example, U+1D300 is

    D8 34 DF 00 in UTF-16 (hex).  Text.GetCharacter() must return D834 for U+1D300.


    Nonki Takahashi

    Tuesday, August 23, 2016 12:58 PM
  • Yep, that would fit (55348 = 0xD834). I'll take a closer look at evening when back home.  Thx

    Edit:

    Can see it under Options- Alt Representation - 'UNC Escape Sequence (16 bit codepoints)' as '\uD834\uDF00' or as 'D834, DF00' in charProps ('?') for described double-character.

    So if Text.GetCharacterCode("character") returns eg. 55348, then the "character" may be

    1.) the chr U+D834 (55348, which does'nt exist in this case-at least on my System) if it's a single character, OR

    2.) the upper 2 bytes from a characters UTF-16 representation -> in decimal (decadically) like 55348 (#D834), if it's a double-character like 119552 (#1D300), 1st double-char part.

    I'll have to add a note to the SmallBasicLibrary.XX.xml together with an <example> under Text.GetCharacterCode.


    Tuesday, August 23, 2016 1:36 PM
    Answerer
  • This is an another sample: TCC509.

    Screen shot of a program Frog 0.1


    Nonki Takahashi

    Friday, August 26, 2016 11:52 AM
  • I also have to write about ability to set SMP characters as literal in TechNet Wiki.

    Thanks, Pappa Lapub.

    Edit:

    I wrote about SMP in following article.

    Small Basic: Character Set - Unicode


    Nonki Takahashi



    Sunday, August 28, 2016 10:38 AM
  • Face using characters:

    Screen shot of a program Face

    gw = GraphicsWindow.Width
    gh = GraphicsWindow.Height
    size = gh * 0.7
    GraphicsWindow.BackgroundColor = "Yellow"
    GraphicsWindow.BrushColor = "White"
    x = (gw - size) / 2
    y = (gh - size) / 2
    GraphicsWindow.FillEllipse(x, y, size, size)
    GraphicsWindow.FontName = "Times New Roman"
    GraphicsWindow.BrushColor = "Black"
    fs = size * 0.4
    GraphicsWindow.FontSize = fs
    x = (gw - fs * 1.6) / 2
    y = (gh - fs) / 2
    GraphicsWindow.DrawText(x, y, "^_^")
    


    Nonki Takahashi

    Friday, September 2, 2016 12:46 AM
  • OH ! here is my face of the month !!

    program:  SSZ395

    Friday, September 2, 2016 1:07 AM
    Answerer
  • This is a sample using Emoticons: GXB625.

    Screen shot of a program Emoticons


    Nonki Takahashi

    Friday, September 2, 2016 2:19 AM
  • OH ! here is my face of the month !!

    program:  SSZ395

    Nice another sample using characters!  Thanks.

    Nonki Takahashi

    Friday, September 2, 2016 2:28 AM
  • Another smile: LBX119-0.

    Screen shot of a program Smile 0.2

    • Edited by Nonki Takahashi Wednesday, September 7, 2016 6:18 AM minor change
    Wednesday, September 7, 2016 1:42 AM
  • This face (DKT453) is created with Shapes 2.2b (CodePlex). 

    Screen shot of a program Face created with Shapes 2.2b


    Nonki Takahashi

    Wednesday, September 7, 2016 9:41 AM
  • @Nonki

    I so find your fascinating program, I've added a guy who made an expression of surprise, with a smile  and says  "COOL !"

    The 2 faces alternate  every 2 seconds indefinitely

           program : DKT453-0

    Wednesday, September 7, 2016 1:50 PM
    Answerer
  • YLed, nice modification! Thanks.

    Nonki Takahashi

    Wednesday, September 7, 2016 2:20 PM
  • This is a 3-D face sample: DJV974.

    Screen shot of a program 3-D Face Sample


    Nonki Takahashi

    Saturday, September 17, 2016 1:16 PM
  • Cool with the nose growing up like Pinocchio :)

    great programming !!

    Saturday, September 17, 2016 5:18 PM
    Answerer
  • This is yet another face: KDH145-2.

    Screen shot of a program Turtle Brick 0.21


    Nonki Takahashi


    Sunday, September 18, 2016 2:24 AM
  • This face is drawn with a polyline: CBF139-3.

    Screen shot of a program Polyline Editor 0.32b

    <svg width='550' height='340'>
      <polyline points='207,194 176,209 166,179 149,154 162,97 181,57 228,43 255,35 277,57 263,91 266,109 270,105 268,91 281,54 261,35 359,66 368,108 371,157 363,195 331,211 307,187 306,235 289,239 288,220 284,220 282,239 262,240 266,220 259,220 257,238 240,238 239,218 234,217 230,238 218,234 211,197 204,202 217,274 218,246 227,247 231,268 237,269 233,249 252,251 250,267 257,268 260,252 272,252 272,272 280,270 277,253 299,250 296,271 303,272 310,209 327,216 313,295 302,298 275,296 246,294 218,302 210,300 194,176 182,167 176,150 186,127 199,122 233,124 241,137 243,149 227,165 211,175 195,177 249,196 258,189 260,151 245,185 251,203 272,205 276,188 270,151 264,186 277,199 320,167 298,161 284,148 275,133 277,125 288,117 325,124 346,132 347,142 343,165 328,173 320,167'
      style='fill:none;stroke:#000000;stroke-width:2' />
    </svg>


    Nonki Takahashi

    Sunday, September 18, 2016 3:29 AM