# Can someone help me please? (QUIZ)

**URL:** <https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698>\
**Category:** Processing.py\
**Tags:** homework\
**Created:** [January 2, 2021, 6:39pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698 "2021-01-02T18:39:03Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hamedwow](https://avatars.discourse-cdn.com/v4/letter/h/6f9a4e/32.png) [@Hamedwow](https://discourse.processing.org/u/Hamedwow)\
**Post date:** [January 2, 2021, 6:39pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/1 "2021-01-02T18:39:04Z")

</div>

Hi everyone , I have made 1 board game with pawn’s and i have to add MCQ’s in so that when pawn’s moves on one of the place’s like (PHP, PYTHON, JAVA) it has to show automatically the questions and answers one by one.  
about one of them. for example if pawn’s moves on Python it has to show me python mcq like 1 question and 4 answer that one of them. i have also questions and also answers but i have no idea how can i set this in my boardgame . can u please help me ?  
Because i am a new use i can not put a image.jpeg here  
the links below is my board game and my code .

Thank U

> **[boardgame](https://ibb.co/30pBLxG)**
>
> Image boardgame hosted in ImgBB

> **[Codesprocessing](https://ibb.co/Xy7twtS)**
>
> Image Codesprocessing hosted in ImgBB

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [January 2, 2021, 7:06pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/2 "2021-01-02T19:06:14Z")

</div>

Hey, welcome to the forum!

Great to have you here!

Please post your entire code as text, not as an image.

Best is when you have a list that represents one

multiple choice question

as you can see the questions and answers and correct answer number are separated by #

you can use split() to split it up to an array

When you have a list for your board, you want to have one line of the list associated with a cell in the board

```auto
String[] listMCQ = 
  {
  "Who has...?#Frank#Paul#Ann#Mary#2#", 
  "Where is...?#France#Brasil#Italy#UK#3#", 
  "When......# # # # ......."
};

```

Chrisir

---

<div class="post-metadata">

**Author:** ![Hamedwow](https://avatars.discourse-cdn.com/v4/letter/h/6f9a4e/32.png) [@Hamedwow](https://discourse.processing.org/u/Hamedwow)\
**Post date:** [January 2, 2021, 7:12pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/3 "2021-01-02T19:12:01Z")

</div>

Thanx for your advise , can i send my code as txt ? because its too long and i have 4 of them  
btw i use python

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [January 2, 2021, 7:13pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/4 "2021-01-02T19:13:17Z")

</div>

> [@Hamedwow](#):
>
> can i send my code as txt ?

you can post your code here and select it and click `</>` in the small command bar

---

<div class="post-metadata">

**Author:** ![Hamedwow](https://avatars.discourse-cdn.com/v4/letter/h/6f9a4e/32.png) [@Hamedwow](https://discourse.processing.org/u/Hamedwow)\
**Post date:** [January 2, 2021, 7:16pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/5 "2021-01-02T19:16:33Z")

</div>

```auto
from coords import coordinates
from js_coordinates import jsCoordinates
from php_coordinates import phpCoordinates
from python_coordinates import pythonCoordinates

diceNumber = 0
currentlyPlaying = "PHP"
currentLanguage = 'Start'
teamPosition = {
    "PHP": coordinates[0],
    "JS": coordinates[0],
    "Python": coordinates[0],
    "D-State": coordinates[0]
}

def setup():
    size(1412,1000)
    
def draw():
    global diceNumber, currentPosition
    img = loadImage("board1.jpg")
    background(img)
    
    # Dice Box
    fill(255,255,255)
    rect(1000, 750, 200, 200)
    
    fill(0,0,0)
    textSize(100)
    text(diceNumber, 1068, 885)
    
    # Pawn PHP
    x, y = teamPosition["PHP"].split(',')
    fill(148,0,211)
    noStroke()
    circle(int(x) + 42, int(y) + 50, 75)
    fill(255,255,255)
    textSize(26)
    text("PHP", int(x) + 20, int(y) + 58)
    
    # Pawn JS
    x, y = teamPosition["JS"].split(',')
    fill(255,255,0)
    noStroke()
    circle(int(x) + 46, int(y) + 50, 75)
    fill(255,255,255)
    textSize(26)
    text("JS", int(x) + 35, int(y) + 58)
    
    # Pawn Python
    x, y = teamPosition["Python"].split(',')
    fill(65,105,225)
    noStroke()
    circle(int(x) + 50, int(y) + 50, 75)
    fill(255,255,255)
    textSize(18)
    text("Python", int(x) + 25, int(y) + 58)
    
    # Pawn D-State
    x, y = teamPosition["D-State"].split(',')
    fill(220,20,60)
    noStroke()
    circle(int(x) + 54, int(y) + 50, 75)
    fill(255,255,255)
    textSize(16)
    text("D-State", int(x) + 22, int(y) + 58)

def mousePressed():
    global diceNumber, currentlyPlaying, currentLanguage
    if 1000 < mouseX < 1000 + 200 and 750 < mouseY < 750 + 200 :
        diceNumber = int(random(1, 7))
        oldPosition = coordinates.index(teamPosition[currentlyPlaying])
        if oldPosition + diceNumber >= len(coordinates):
            tempNewPosition = oldPosition + diceNumber
            teamPosition[currentlyPlaying] = coordinates[tempNewPosition - len(coordinates)]
        else:
            teamPosition[currentlyPlaying] = coordinates[oldPosition + diceNumber]
            
#cardselecter                        
        if currentlyPlaying == "PHP":
            if teamPosition['PHP'] in phpCoordinates:
                currentLanguage = 'PHP'
            elif teamPosition['PHP'] in jsCoordinates:
                currentLanguage = 'JS'
            elif teamPosition['PHP'] in pythonCoordinates:
                currentLanguage = "Python" 
        
        elif currentlyPlaying == "JS":
            if teamPosition['JS'] in phpCoordinates:
                currentLanguage = 'PHP'
            elif teamPosition['JS'] in jsCoordinates:
                currentLanguage = 'JS'
            elif teamPosition['JS'] in pythonCoordinates:
                currentLanguage = "Python" 
                
        elif currentlyPlaying == "D-State":
            if teamPosition['D-State'] in phpCoordinates:
                currentLanguage = 'PHP'
            elif teamPosition['D-State'] in jsCoordinates:
                currentLanguage = 'JS'
            elif teamPosition['D-State'] in pythonCoordinates:
                currentLanguage = "Python" 
                
        elif currentlyPlaying == "Python":
            if teamPosition['Python'] in phpCoordinates:
                currentLanguage = 'PHP'
            elif teamPosition['Python'] in jsCoordinates:
                currentLanguage = 'JS'
            elif teamPosition['Python'] in pythonCoordinates:
                currentLanguage = "Python" 
        print(currentLanguage)
#Turn switch 
        if currentlyPlaying == "PHP":
            currentlyPlaying = "JS"
        elif currentlyPlaying == "JS":
            currentlyPlaying = "Python"
        elif currentlyPlaying == "Python":
            currentlyPlaying = "D-State"
        elif currentlyPlaying == "D-State":
            currentlyPlaying = "PHP"

    #currentlanguage
        

        
  

```

---

<div class="post-metadata">

**Author:** ![Hamedwow](https://avatars.discourse-cdn.com/v4/letter/h/6f9a4e/32.png) [@Hamedwow](https://discourse.processing.org/u/Hamedwow)\
**Post date:** [January 2, 2021, 7:17pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/6 "2021-01-02T19:17:17Z")

</div>

```auto
coordinates = [
    "3,6", #start
    "116,6", #python
    "229,6", 
    "342,6", #php
    "453,6", #python
    "566,6",
    "679,6", #php
    "679,111", #python
    "793,111", #js
    "906,111", #php
    "906,216", #python
    "906,320", #js
    "793,320", #php
    "680,320", #python
    #"906,425", 
    #"906,530",
    #"906,630",
    #"1019,630",
    #"1132,630",
    "680,425", #js
    "680,525", #php
    "680,625", #python
    "567,625", #js
    "567,730", #php
    "567,830", #shortcut
    "453,830", #js
    "338,830", #php
    "223,830", #python
    "108,830", #js
    "108,724", #php
    "108,619", #python
    "108,522", #js
    "108,422", #php
    "220,422", #python
    "335,422", #js
    "447,422", #php
    "447,310", #python
    "447,220", #js
    "332,220", #php
    "217,220", #python
    "102,220", #js
    "3,220", #php
    "3,113", #death
]

```

---

<div class="post-metadata">

**Author:** ![Hamedwow](https://avatars.discourse-cdn.com/v4/letter/h/6f9a4e/32.png) [@Hamedwow](https://discourse.processing.org/u/Hamedwow)\
**Post date:** [January 2, 2021, 7:17pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/7 "2021-01-02T19:17:54Z")

</div>

```auto
jsCoordinates = [
    "229,6", #js
    "566,6", #js
    "793,111", #js
    "906,320", #js
    "680,425", #js
    "567,625", #js
    "453,830", #js
    "108,830", #js
    "108,522", #js
    "335,422", #js
    "447,220", #js
    "102,220", #js
]

```

---

<div class="post-metadata">

**Author:** ![Hamedwow](https://avatars.discourse-cdn.com/v4/letter/h/6f9a4e/32.png) [@Hamedwow](https://discourse.processing.org/u/Hamedwow)\
**Post date:** [January 2, 2021, 7:18pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/8 "2021-01-02T19:18:27Z")

</div>

```auto
phpCoordinates = [
    "342,6", #php
    "679,6", #php
    "906,111", #php
    "793,320", #php
    "680,525", #php
    "567,730", #php
    "338,830", #php
    "108,724", #php
    "108,422", #php
    "447,422", #php
    "332,220", #php
    "3,220", #php
]

```

---

<div class="post-metadata">

**Author:** ![Hamedwow](https://avatars.discourse-cdn.com/v4/letter/h/6f9a4e/32.png) [@Hamedwow](https://discourse.processing.org/u/Hamedwow)\
**Post date:** [January 2, 2021, 7:19pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/9 "2021-01-02T19:19:15Z")

</div>

```auto
pythonCoordinates = [
    "116,6", #python
    "453,6", #python
    "679,111", #python
    "906,216", #python
    "680,320", #python
    "680,625", #python
    "223,830", #python
    "108,619", #python
    "220,422", #python
    "447,310", #python
    "217,220", #python
]

```

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [January 3, 2021, 4:33pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/10 "2021-01-03T16:33:20Z")

</div>

Thank you.  
I cannot help you, I don’t know python.

But my idea should help you. Just make a list, couple it with the image grid and parse each line that is the current question

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [January 6, 2021, 3:06pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/11 "2021-01-06T15:06:39Z")

</div>

I mean a list with multiple lines

- each line is a set of questions and answer. Each line you have to split().

Alternatively you can make a 2D grid where you have a list A of lists B

and B is a list like Questions, answer1, answer 2 etc.

and then you show only ONE list B from the list A (and A receives its index from the image grid)

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [January 6, 2021, 8:53pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/12 "2021-01-06T20:53:52Z")

</div>

Hello,

Your subject clearly states homework and QUIZ.

Were you taking a quiz (academic that will be graded) and asking us for help?

Be honest…

---

<div class="post-metadata">

**Author:** ![Hamedwow](https://avatars.discourse-cdn.com/v4/letter/h/6f9a4e/32.png) [@Hamedwow](https://discourse.processing.org/u/Hamedwow)\
**Post date:** [January 7, 2021, 12:29pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/13 "2021-01-07T12:29:36Z")

</div>

if i had coaching or some help about my subject, believe me i would never ask here !  
and + i am a beginner and its my first project . Do u remember your self when u write the first if statement?  
iam in that time 😉

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [January 7, 2021, 1:14pm UTC](https://discourse.processing.org/t/can-someone-help-me-please-quiz/26698/14 "2021-01-07T13:14:59Z")

</div>

here is my example

```auto
String[] listMCQ = 
  {
  "Who has...?#Frank#Paul#Ann#Mary#2#", 
  "Where is...?#France#Brasil#Italy#UK#3#", 
  "When......# 1981 # 1891 # 387 # 1492 #4#"
};

int numberQuestion = 0; 

// ----------------------------------------------------
// main funcs 

void setup() {
  size(1100, 1000);
  background(0);
}

void draw() {
  background(0);

  text ("Question #"+numberQuestion+": ", 200, 200);

  String[] thisQuestionData = split(listMCQ[numberQuestion], "#"); 

  // Question 
  text( thisQuestionData[0], 200, 230); 

  // possible answers 
  for (int i = 1; i<thisQuestionData.length-2; i++) {
    noFill();
    stroke(255); 
    rect(230, 270+i*22-14, 200, 20); 
    fill(255); 
    text( thisQuestionData[i], 260, 270+i*22);
  }

  // Correct number 
  text( thisQuestionData[5], 422, 270+6*22);

  text( "Hit Space Bar to go on", width-222, 270+6*22);
}

// ----------------------------------------------------------------

void keyPressed() {

  if (key==' ') {
    numberQuestion++;
  }
  if (numberQuestion>=listMCQ.length)
    numberQuestion=0;

  // test
  println (listMCQ[numberQuestion]);
}
//

```
