Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 04:37 25 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Game: various *mites: Four Equals Ten

     Page 2 of 2    
Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3839
Posted: 06:16pm 15 Jan 2023
Copy link to clipboard 
Print this post

  vegipete said  The program shown below doesn't output as expected:...


In what way? because the C heap and stack don't change? SUB calls and LOCAL variables aren't implemented internally the way you think. Try making recursive FUNCTION calls instead.

Best wishes,

Tom
Edited 2023-01-16 04:16 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 08:36pm 15 Jan 2023
Copy link to clipboard 
Print this post

Yupp, functions break it much faster, and drop the console connection too.

(partial retyping from VGA display:)
1      &h20041300 &h18700
2      &h20041088 &h18700
3      &h20040E10 &h18700
4      &h20040B98 &h18700
5      &h20040920 &h18700
6      &h200406A8 &h18700
7      &h20040430 &h18700
8      &h200401B8 &h18700
9      &h2003FF40 &h18700
10     &h2003FCC8 &h18700
11     &h2003FA50 &h18700
12     &h2003F7D8 &h18700
13     &h
[7] Print i, "&h" Hex$(MM.Info(STACK)) " &h" Hex$(MM.Info(HEAP))
Error : Stack overflow, expression too complex at depth 13
>list
CLS
c = 0
c = Recurr(c+1)
End

Function Recurr(i)
 Print i, "&h" Hex$(MM.Info(STACK)) " &h" Hex$(MM.Info(HEAP))
 Pause 100
 Recurr = Recurr(i+1)
end function
>

Not quite the same error as the 4 = 10 game, but similar...
Visit Vegipete's *Mite Library for cool programs.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3653
Posted: 09:12pm 15 Jan 2023
Copy link to clipboard 
Print this post

  vegipete said  Here is a silly little arithmetic game based on the app 4 = 10

We used to do something similar at school:

Using four 7s, make each number from one up.  You can use any of the usual mathematical operators (and parentheses). You always have to use all four 7s. You can use numbers such as 77 (using up two 7s).

E.g. 77 / 77 = 1, 7/7 + 7/7 = 2.

I can't recall if CEIL / FLOOR were allowed, but I think not as they probably make things too easy.

John
 
bar1010
Senior Member

Joined: 10/08/2020
Location: United States
Posts: 197
Posted: 05:34pm 20 Jan 2023
Copy link to clipboard 
Print this post

Thanks for uploading this nice program, Vegipete.
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024