joeheader16
friendsoffortiesfive Aimoo Forum List | Ticket | Today | Member | Search | Who's On | Help | Sign In | |
friendsoffortiesfive > General > Games Go to subcategory:
Author Content
Zenith
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Date Posted:02/05/2023 8:20 PMCopy HTML

CONCEIVE, BELIEVE, ACHIEVE!
Niceguy2 #801
  • Rank:Diamond
  • Score:331970
  • From:USA
  • Register:01/12/2009 5:00 AM

Re:Game Code Development Area

Date Posted:02/14/2024 4:49 AMCopy HTML

Oops, did you mean to take turns?

Zenith #802
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/14/2024 1:38 PMCopy HTML

I took a regular game and Java-scripted it.

If you see weird buttons, it's a demo, not a game.

You're lucky you got a new page since the IDs clash with the previous page.

That's why I put it in your MAILBOX!


And you already said you didn't like jigsaws.


I learned that I cannot run your code, but you can run mine since you are owner.

Mike will not be able to work the demos!!!

I cannot reset  your post, but any reset will do all of my posts on the page


CONCEIVE, BELIEVE, ACHIEVE!
Niceguy2 #803
  • Rank:Diamond
  • Score:331970
  • From:USA
  • Register:01/12/2009 5:00 AM

Re:Game Code Development Area

Date Posted:02/15/2024 6:54 AMCopy HTML

Oh, I see, said the blind man.

Was wondering why you put it in my mailbox.

Now I know!

Interesting.

Niceguy2 #804
  • Rank:Diamond
  • Score:331970
  • From:USA
  • Register:01/12/2009 5:00 AM

Re:Game Code Development Area

Date Posted:02/15/2024 6:57 AMCopy HTML


GARFIELD-01




Interchange pieces of the puzzle
until it is completed.
Take turns, and have fun!

PARKING SPOT >>>



Zenith #805
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/16/2024 2:33 PMCopy HTML

Mike could run demos if he knew how to change all the IDs.

He could run them on his desktop without that if he knew about copying to BLANK.TXT and HTML.

CONCEIVE, BELIEVE, ACHIEVE!
Zenith #806
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/16/2024 6:22 PMCopy HTML

~ COLORED LIGHTS V8 ~


 
CONCEIVE, BELIEVE, ACHIEVE!
Zenith #807
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/16/2024 9:04 PMCopy HTML

~ COLORED LIGHTS V10 ~


 
CONCEIVE, BELIEVE, ACHIEVE!
Niceguy2 #808
  • Rank:Diamond
  • Score:331970
  • From:USA
  • Register:01/12/2009 5:00 AM

Re:Game Code Development Area

Date Posted:02/17/2024 4:22 AMCopy HTML

Those are neat, Dave!

What happened to V9?

Zenith #809
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/17/2024 1:27 PMCopy HTML

It only went around once. I replaced it with v10.

Now I meed ideas for something else.

Zenith #810
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/17/2024 2:07 PMCopy HTML

Here's the code for V8

Please check if you can follow it.

Read down the code SLOWLY.

The IDs are the key.

Their TDs are put into LISTS

The Lists are lit up by FOR

The colors are randomized

The thing keeps running by setInterval(doLoops, 150);

Now we get to the brains of it

I count how many loops it does.

I do an all-black at the top of every loop

I look for the count and trigger off a certain list of lights.with each one ... if count is 2 then

light up L3 list ... n.style.background=myColor;     one-by-one ... n=L3[i];  ... very fast.

               if (count==2){for (i=0;i<L3.length;i++){n=L3[i];n.style.background=myColor;}}

             

I reset the count to 0 and change color at 4 ...if (count==4){count=0;myRand();}


More code here, but below is the main idea.

======================================

<tr>
<td id="8TD7" style="width:100px;
height:100px;
background-color:white;
border:5px solid #000099;"></td>
<td id="8TD8" style="width:100px;
height:100px;
background-color:white;
border:5px solid #000099;"></td>
<td id="8TD9" style="width:100px;
height:100px;
background-color:white;
border:5px solid #000099;"></td>
</tr>

</tbody>
</table>
</td>
</tr>

</tbody>
</table><a href="javascript:
var r;
var myColor='yellow';

var t1_8 =document.getElementById('8TD1');
var t2_8 =document.getElementById('8TD2');
var t3_8 =document.getElementById('8TD3');
var t4_8 =document.getElementById('8TD4');
var t5_8 =document.getElementById('8TD5');
var t6_8 =document.getElementById('8TD6');
var t7_8 =document.getElementById('8TD7');
var t8_8 =document.getElementById('8TD8');
var t9_8 =document.getElementById('8TD9');

var noir=[t1_8,t2_8,t3_8,t4_8,t5_8,t6_8,t7_8,t8_8,t9_8];
var L1=[t1_8,t5_8,t9_8];
var L2=[t2_8,t5_8,t8_8];
var L3=[t3_8,t5_8,t7_8];
var L4=[t4_8,t5_8,t6_8];

/*called by internal*/
var lastColor;
function myRand(){
var r=Math.floor(Math.random()*9)+1;
if (r==1){myColor='red';}
if (r==2){myColor='orange';}
if (r==3){myColor='green';}
if (r==4){myColor='blue';}
if (r==5){myColor='magenta';}
if (r==6){myColor='cyan';}
if (r==7){myColor='gray';}
if (r==8){myColor='white';}
if (r==9){myColor='yellow';}
if (myColor==lastColor){myRand();}
lastColor=myColor;
} /*end myRand*/

function init(){
var i;
var n;
var count=0;
setInterval(doLoops, 150);

function doLoops(){
count+=1;
if (count==4){count=0;myRand();}
for(i=0;i<noir.length;i++){n=noir[i];n.style.background='black';}
if (count==0){for(i=0;i<L1.length;i++){n=L1[i];n.style.background=myColor;}}
if (count==1){for(i=0;i<L2.length;i++){n=L2[i];n.style.background=myColor;}}
if (count==2){for(i=0;i<L3.length;i++){n=L3[i];n.style.background=myColor;}}
if (count==3){for(i=0;i<L4.length;i++){n=L4[i];n.style.background=myColor;}}

} /*end doLoops */
} /*end init*/
">

<br/>
<button style="padding:10px;
color:white;
font-weight:900;
background-color:#0000cc;
border:5px solid black;"
onclick="init()">Click Twice</button>
&nbsp;
<button style="padding:10px;
color:white;
font-weight:900;
background-color:#0000cc;
border:5px solid black;"
onclick="location.reload()">Reset</button></a>
</div>
CONCEIVE, BELIEVE, ACHIEVE!
Zenith #811
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/17/2024 3:21 PMCopy HTML

Apart from my attempts to explain FOR loops, check out:

https://www.w3schools.com/js/js_loop_for.asp

Zenith #812
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/17/2024 7:35 PMCopy HTML

Joe:

Homework:

Cococt a Javascript way to turn 0.876501 and 0.812373 into 8.

You can look for help online.


You can use them as

var n=0.876501 and

var m=0.812373


The answer routines can be in

var eight_n; and

var eight_m;


CONCEIVE, BELIEVE, ACHIEVE!
Niceguy2 #813
  • Rank:Diamond
  • Score:331970
  • From:USA
  • Register:01/12/2009 5:00 AM

Re:Game Code Development Area

Date Posted:02/18/2024 3:44 AMCopy HTML

I wouldn't know where to even start.  Sorry Dave.

Zenith #814
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/18/2024 2:22 PMCopy HTML

How about multiplying by 10 and dropping the decimal places.


Search for:

Javascript drop decimal places


EDIT:

===============================

How do you get rid of decimals in HTML?

You could use...

1
Math.trunc() (truncate fractional part)
2
Math.floor() (round down)
3
Math.ceil() (round up)
4
Math.round() (round to nearest integer)

===============================

<a href="javascript:

var n = 0.876501;

var eight_n = Math.floor(10 * n);

alert('answer=' + eight_n);

">Click Here</a>

===============================


Joe:

Write a similar program for m using trunc.




Note: Math is the page all the math functions are on inside JS, so we have to specify it to get the function to work.

CONCEIVE, BELIEVE, ACHIEVE!
Zenith #815
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/19/2024 2:23 PMCopy HTML

You can copy and paste that code into BLANK.TXT and save as WHATEVER.HTM. Close Notepad and double click the HTM.


You can write your own code in Notepad, and do the same to run it.


If you have a code problem, push F12 while it is running, and select CONSOLE.

It may give you some tips.


When debugging, instead of alert('My check  for ' + myvar); you can send it to the console without having to close the alert.

Use console.log('My check  for ' + myvar);


myvar is a name specified by yourself, and is not a key word

same as 'My check  for '  is your own concoction.

It's so you can see the results that some code is giving back to you during debugging,

and in a longer code you may want to watch several different results.

Niceguy2 #816
  • Rank:Diamond
  • Score:331970
  • From:USA
  • Register:01/12/2009 5:00 AM

Re:Game Code Development Area

Date Posted:02/20/2024 3:16 AMCopy HTML

Zenith #817
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/20/2024 1:07 PMCopy HTML

===============================

<a href="javascript:

var n = 0.876501;

var eight_n = Math.floor(10 * n);

alert('answer=' + eight_n);

">Click Here</a>

===============================


Joe:

Write a similar program for m using trunc.

CONCEIVE, BELIEVE, ACHIEVE!
Zenith #818
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/20/2024 1:08 PMCopy HTML

===============================

<a href="javascript:

var n = 0.876501;

var eight_n = Math.floor(10 * n);

alert('answer=' + eight_n);

">Click Here</a>

===============================


Joe:

Write a similar program for m using trunc.

Math.trunc()

m=0.812373


Substitute new number and command for crossed out parts.

Run it in your work area to check it.

If you don't remember how to run it, I will go through all that stuff again.

In fact, WRITE it in your work area in Notepad to start with. Save as HTM.


Niceguy2 #819
  • Rank:Diamond
  • Score:331970
  • From:USA
  • Register:01/12/2009 5:00 AM

Re:Game Code Development Area

Date Posted:02/21/2024 5:10 AMCopy HTML

I wrote it in Notepad.  Would only save it as a .txt file.  I don't know wth I'm doing, anyway.

Zenith #820
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/21/2024 2:20 PMCopy HTML

Copy the code into here and run it.

"SAVE AS" fudpucker.htm should have done it


============================================================================================

This is a lead-up to how to get a random number.

The original rand() only gives numbers from 0 to 0.999999999


Say the rand() gave you  0.812373

We need that as 8, since you can't move 0.812373 blockers, for instance.


In javascript YOU MUST DECLARE YOUR VARIABLES prior to or on first usage.

That means telling JS you need a memory hole for one, or need a hole and put in a number.

Like we don't know what will be in eight_m yet, so we just say var eight_m;

but we do know what's in m, so we say var m = 0.876501;.


Same as in School-Daze, A - 9=(10 + A)/5 or whatever, A is the variable, and we solve for A.

It's a variable because every question has a different value for A.


Here we set

var m = 0.876501;

We could set charlie_browns_favorite _number = 0.812373; but that is too unweildly.


Multiplying m=0.812373 by 10 gets us in the ballpark, but let's give that variable a different name.

var m2 = 10 * m;

Solving (by the internal JS brain) gives us m2 = 8.12373

So what's left? Drop the decimal places.


You could use...

1
Math.trunc() (truncate fractional part)
2
Math.floor() (round down)
3
Math.ceil() (round up)
4
Math.round() (round to nearest integer)


Only 2 of these will do both m and n,

where n=0.876501

We don't want 9 for n and 8 for m, and we don't want 9 for both.

var eight_m = Math.trunc(m2);

gives us what we need. So does

var eight_m = Math.floor(m2);

But how do you know that? It's still inside the comp.

alert(eight_m); will display it.

So will console.log(eight_m); display it if you push F12.



You can join text to a number in alert ...alert('my friggin text = ' + my_friggin_variable);



Zenith #821
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/22/2024 3:26 PMCopy HTML

I noticed ed doubles up posts sometimes when I edit.

Short story: interchange m and n, and trunc and floor.

You can also rename a file with right-click method after it is saved.

===========

Shall we delete Quilting Bee since it is a piss-off to play under current conditions?

Niceguy2 #822
  • Rank:Diamond
  • Score:331970
  • From:USA
  • Register:01/12/2009 5:00 AM

Re:Game Code Development Area

Date Posted:02/23/2024 4:17 AMCopy HTML

A former member used to have a heck of a lot of trouble with her posts duplicating, sometimes as many as four identical posts.  It SO aggravated her!  And me, because I was the one that had to delete the extras, lol.

What's wrong with Quilting Bee?  I haven't noticed anything.

Zenith #823
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/23/2024 1:15 PMCopy HTML

Too much red!

Hey, change red to cyan!

Niceguy2 #824
  • Rank:Diamond
  • Score:331970
  • From:USA
  • Register:01/12/2009 5:00 AM

Re:Game Code Development Area

Date Posted:02/24/2024 3:00 AMCopy HTML

That's only because Mike insists on posting red every single time.  You're welcome to make any changes you want.

Zenith #825
  • Rank:Emerald
  • Score:89070
  • From:Canada
  • Register:07/31/2019 10:06 PM

Re:Game Code Development Area

Date Posted:02/24/2024 2:15 PMCopy HTML

That's what 'current conditions' meant!
CONCEIVE, BELIEVE, ACHIEVE!
Copyright © 2000- Aimoo Free Forum All rights reserved.
Skin by SandhillsDebby - Elements from DivaAmyMarie.blogspot.com