Math - Remainders - Challenge

52/4=13 remainder is 0. Player 1 goes first

New Number is 512

New number: 457

Udemy Question: 63%4=3 so Player 4 goes first.
Previous Number Answer: 512%4=0 so Player 1 goes first.

Initial Challenge:

63%4
4*15 = 60.
63-60 = 3.
Remainder = 3.
Player 4’s value is 3.
Player 4 is selected.

New Number:

457%4
114 * 4 = 456
457 - 456 = 1
Remainder = 1
Player 2’s value is 1.
Player 2 is selected.

I don’t know how to set this up in code yet. I’ll be starting the Unity course soon.

New Number 236

Initial challenge: 63%4=3. Player 4 starts.
New challenge: 236%4=0. Player 1 starts
Next challenge: 0

In Rust:

use rand::prelude::*;

fn main() {
let mut rng = rand::thread_rng();
let number_of_players = 4;
let x = rng.gen_range(0…3);
let remainder = x % number_of_players;
println!(“x= {}, player {} starts”, x, remainder+1);
}

Initial Challenge: 63%4=3 => Player 4 starts
New challenge: 0%4=0 => Player 1 starts
Next Challenge: 256

In Unity (bit lazy - normally you should save the remainder in a variable if intending to be reused):

public class NumberCode : MonoBehaviour
{

int number = 63, players = 4;

// Start is called before the first frame update
void Start()
{
    Debug.Log(number%players);
}

// Update is called once per frame
void Update()
{
    
}

}

New challenge: 256 → Player 1

Next challenge: 2147483648

My Code in C#

New challenge: 2147483648 → Player 1 Starts (or player 0)

Next Challenge:

  • Hard: 6.45 (Use past lectures to figure out how to deal with decimals).
  • Normal: 645

Hard: 6.45 → 6%4 = 2. Player 3 starts
Normal: 645%4 = 1. Player 2 starts.

Next Challenge: 1709

Udemy Question: 63%4 = 3,
Player 4 goes first

New Challenge:1709%4 = 1,
Player 2 goes first

Next Challenge:787651

Remainder challenge: 63 / 4 = 15.75 - 15 = 0.75 * 4 = 3
Who is playing = Player4

D3rut0 challenge: 787651 / 4 = 196912.75 - 196912 = 0.75 * 4 = 3
Who is playing = Player 4

New challenge: 49434

by the way, this is my code in C#:

1 Like

Remainder course challenge: 63 % 4 = 3, so player 4 goes first.

Prior post’s remainder challenge (courtesy of beltran): 49434 % 4 = 2, so player 3 will go first.

Number for next user: 577

Course Challenge
63/4 = 15.75
15.75 - 15 = 0.75
0.75 * 4 = 3
Since Player 4 is assigned the remainder 3
Then Player 4 goes first


New Challenge
577/4 = 144.25
144.25 - 144 = 0.25
0.25 * 4 = 1
Since Player 2 is assigned the remainder 1
Then Player 2 goes first


New Challenge for next user: 6164

Course challenge: 63 % 4 = 3 So player 4
New challenge: 6164 % 4 = 0 So player 1
New Challenge for next user: 1897

Original challenge answer 63 % 4 = 15 3/4 therefore player 4 goes first
New challenge answer 1897 % 4 = 474 1/4 therefore player 2 goes first

New challenge for the next user: 2722

Original Problem Provided

In Calculator:

63 % 4: 63 / 4 = 15.75 → .75 * 4 = 3 - Player 4 Starts.

In Code:

using System;
					
public class Program
{
	public static void Main()
	{
		int intPlayer = (63 % 4) + 1;
		Console.WriteLine("Player " + intPlayer + " starts first!");
	}
}

Output:

> Player 4 starts first!

Number provided by previous poster: [2722]

In Calculator:

2722 % 4 = 2722 / 4 = 680.5 → .5 * 4 = 2 - Player 3 Starts.

In Code:

using System;
					
public class Program
{
	public static void Main()
	{
		int intPlayer = (2722 % 4) + 1;
		Console.WriteLine("Player " + intPlayer + " starts first!");
	}
}

Output:

Player 3 starts first!

Next Number to Try: 6982

63 % 4 = 3
Player 4

New challenge answer:
6982 % 2 = 2
Player 3

Next Number to try: 40

64%4 = 3
Player 4 turn

My challenge is:
40 % 4

In code

Int randomNumber = 40;
int playerNumber = 0;

switch(randomNumber % 4) {

    case 1:
        playerNumber = 1;
        break;

    case 2:
        playerNumber = 2;
        break;

    case 3:
        playerNumber = 3;
        break;

    case 4:
        playerNumber = 4;
        break;

}

Console.WriteLine("The number of player is " + playerNumber);

Next challenge is with number: 737

737 % 4 = 1

Player 4 turn

In code

int randomNumber = 737;
int playerNumber = randomNumber % 4

Console.WriteLine($"The player number is {playerNumber + 1}");

Next challenge is with number 42

1 Like

Original challenge:
Original calculation demonstration

63 / 4 = 15.75 - 15 = 0.75 x 4 = 3 - Player 4’s turn

Scientific calculator:

63 % 4 = 3 - Player 4’s turn

Previous post’s challenge: 42

42 % 4 = 2 - Player 3’s turn

Next challenge number: 317

Good luck!

1 Like

Original question:

64 % 4 = 3
Player 4 is selected

Previous post: 317
317 % 4 = 1
Player 2 selected

next challenge number is… 481

1 Like

Privacy & Terms