This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Your Projects subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Protocol => Your Projects
United-TI Archives -> Protocol
 
    » Goto page Previous  1, 2
» View previous topic :: View next topic  
Author Message
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 07 Sep 2007 04:45:41 pm    Post subject:

PROGRAM:SWITCHIT
:.5^seq(A,A,1,9→A
:Repeat 1=sum(Ans=real(max(Ans+[font="times new roman"]i
[font="verdana"]E
9seq(sum(Ans(A)=Ans),A,1,9
:randInt(1,511,9
:End
:For(A,1,9
:If int(2rand
:Ans+.1int(2fPart(LAAns(randInt(1,9→B
:End
:1.1→S
:ClrHome
:While Ans≠4.5 and max(fPart(LB
:LB+.1int(2fPart(LALB(3int(Ans)-3+10fPart(Ans
:int(Ans)+.2fPart(5Ans→B
:For(A,1,3
:For(B,1,3
:Output(2A,2B,sub("▫·",1+not(fPart(Ans(3A+B-3))),1
:End
:End
:S+1→S
:Repeat Ans=45 or 2>abs(5-abs(5-abs(Ans-83
:getKey
:End
:round(6.1fPart(Ans/61
:End
:DelVar LADelVar LBClrHome
:Disp "Steps:
:max(int(S-2),9999(Ans=4.5

[attachment=1870:attachment]

Each number 1 through 9 toggles a set of switches, randomly defined but constant throughout the puzzle. Objective: Remove all of the squares. (Nothing a little pencil and paper can't solve.) Thanks to DarkerLine for two of the lines used here (mode calculator and getKey condition – both from the Brain Teaser thread).

Last edited by Guest on 24 Sep 2010 03:11:43 pm; edited 1 time in total
Back to top
nitacku


Advanced Member


Joined: 23 Aug 2005
Posts: 408

Posted: 07 Sep 2007 04:54:44 pm    Post subject:

Sweet! I didn't know you programmed games :P

I'm going to download it right now.
Back to top
Super Speler
Super Awesome Dude


Calc Guru


Joined: 28 Nov 2005
Posts: 1391

Posted: 07 Sep 2007 09:27:20 pm    Post subject:

Thanks Goose!
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 07 Sep 2007 10:43:23 pm    Post subject:

I messed up. Please change randInt(1,9 in line 7 to A. Smile

Last edited by Guest on 24 Sep 2010 03:12:21 pm; edited 1 time in total
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 10 Sep 2007 06:57:54 am    Post subject:

I have a spot where this could go... the first locked door! As soon as I get this new computer set up, I'll try it out.
Back to top
nitacku


Advanced Member


Joined: 23 Aug 2005
Posts: 408

Posted: 10 Sep 2007 08:00:16 pm    Post subject:

Would you mind explaining the code? :biggrin:

I can't seem to figure out that first Repeat loop.
This is what I've figured out so far:

It's generating a list of 9 random integers from 1 to 511
Then it's checking to make sure each element in the list equals itself.
If the element equals itself, then 1 is stored into a list
The list is then multiplied by iE9 and the random list in Ans is added to it
If any part of the list in Ans equals the real( part of the the checked list, then exit loop.

So what does this do?
Obviously it does something, but it is beyond me.
I can't seem to figure out what the trick is.
Is it an operating system loop hole or something?

I'm guessing that it's the mode calculator part that I don't get.
Well then, what's a mode calculator?

btw, I am here by awarding this code the medal for being the most awesomely optimized Basic guru genius code. Razz
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 10 Sep 2007 09:59:59 pm    Post subject:

The general idea is that each number in LB will reveal what switches it will activate when it is expressed in base two; the point-one will go at the end of this number if the associated switch is turned "on." The mode calculator is only there to make sure that no two elements are equal (so they won't do the same things). The first For() loop randomly "presses" the switches a few times using the same rules as the user inputs in order to shuffle the puzzle a bit. The rest is kind of intricate—obtaining and processing of the input and such. Sorry it's so complicated; it seemed a decent enough approach at the time. :)

If you want to make this a real puzzle, have it output the number that is in base ten which corresponds to the current state of the switches. That'll rattle a few minds! (Don't do it for the game, though.) Smile


Last edited by Guest on 24 Sep 2010 03:13:02 pm; edited 1 time in total
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 23 Sep 2007 08:14:31 pm    Post subject:

After looking at the code and program, I think I will try to meld this into the game itself, Like unlocking the 2nd weapon.
It would take some interesting coding...

Edit: The real( in the second line is not good because of Xlib. How would we get around this?


Last edited by Guest on 23 Sep 2007 08:45:58 pm; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 23 Sep 2007 09:51:55 pm    Post subject:

Replace:

    Repeat 1=sum(Ans=real(max(Ans+iE9seq(sum(Ans(A)=Ans),A,1,9
    randInt(1,511,9
    End


With:

    {0→B
    Repeat 9<dim(LB
    randInt(1,511
    If not(max(LB=Ans
    augment(LB,{Ans→B
    End
    [font="times new roman"]
    List(cumSum(Ans


Last edited by Guest on 24 Sep 2010 03:14:29 pm; edited 1 time in total
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 26 Sep 2007 08:45:28 pm    Post subject:

Thank you very much. It works now!!
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 26 Sep 2007 09:49:12 pm    Post subject:

Alternatively, you could replace ...real(max(Ans+iE9seq(... with ...imag(max(iAns+E9seq(... which is still basically the same algorithm.

(specifically, you're replacing real( with imag( and moving the i from after the + to before it)


Last edited by Guest on 24 Sep 2010 03:15:36 pm; edited 1 time in total
Back to top
Super Speler
Super Awesome Dude


Calc Guru


Joined: 28 Nov 2005
Posts: 1391

Posted: 26 Sep 2007 09:57:21 pm    Post subject:

We can't use real( however since xLib is being used in this game.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 26 Sep 2007 10:02:19 pm    Post subject:

I know, which is why my suggestion replaces it with imag(.

Last edited by Guest on 24 Sep 2010 03:10:27 pm; edited 1 time in total
Back to top
Super Speler
Super Awesome Dude


Calc Guru


Joined: 28 Nov 2005
Posts: 1391

Posted: 27 Sep 2007 05:07:09 pm    Post subject:

Sorry, I misread your post.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page Previous  1, 2
» View previous topic :: View next topic  
Page 2 of 2 » All times are UTC - 5 Hours

 

Advertisement